package com.gyee.edge.protocol.iec60870.infoelement;

import java.io.DataInputStream;
import java.io.IOException;

/**
 * Represents a quality descriptor (QDS) information element.
 */
public class IeQuality extends IeAbstractQuality {

    public IeQuality(boolean overflow, boolean blocked, boolean substituted, boolean notTopical, boolean invalid) {
        super(blocked, substituted, notTopical, invalid);

        if (overflow) {
            value |= 0x01;
        }
    }

    IeQuality(DataInputStream is) throws IOException {
        super(is);
    }

    public boolean isOverflow() {
        return (value & 0x01) == 0x01;
    }

    @Override
    public String toString() {
        return "Quality, overflow: " + isOverflow() + ", " + super.toString();
    }
}
