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

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

/**
 * Represents a single-point information with quality descriptor (SIQ) information element.
 */
public class IeSinglePointWithQuality extends IeAbstractQuality {

    public IeSinglePointWithQuality(boolean on, boolean blocked, boolean substituted, boolean notTopical,
                                    boolean invalid) {
        super(blocked, substituted, notTopical, invalid);

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

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

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

    @Override
    public String toString() {
        return "Single Point, is on: " + isOn() + ", " + super.toString();
    }
}
