/*
 * Automatically generated by jrpcgen 1.1.6 on 21.02.24 22:11
 * jrpcgen is part of the "Remote Tea" ONC/RPC package for Java
 * See http://remotetea.sourceforge.net for details
 */
package tests.org.acplt.oncrpc.jrpcgen;
import org.acplt.oncrpc.*;
import java.io.IOException;

/** TODO */
public class UNION implements XdrAble, java.io.Serializable {
    /** TODO */
    public boolean okay;
    /** TODO */
    public LINKEDLIST list;

    private static final long serialVersionUID = -5038378683068054714L;

    public UNION() {
    }

    public UNION(XdrDecodingStream xdr)
           throws OncRpcException, IOException {
        xdrDecode(xdr);
    }

    public UNION(boolean okay, Object value) {
        this.okay = okay;
        if ( okay == true ) {
            this.list = (LINKEDLIST)value;
        }
    }

    @Override
    public void xdrEncode(XdrEncodingStream xdr)
           throws OncRpcException, IOException {
        xdr.xdrEncodeBoolean(okay);
        if ( okay == true ) {
            xdr.xdrEncodeBoolean(list != null);
            if (list != null) list.xdrEncode(xdr);
        }
    }

    @Override
    public void xdrDecode(XdrDecodingStream xdr)
           throws OncRpcException, IOException {
        okay = xdr.xdrDecodeBoolean();
        if ( okay == true ) {
            list = xdr.xdrDecodeBoolean() ? new LINKEDLIST(xdr) : null;
        }
    }

    @Override
    public String toString() {
        String ret = "UNION=";
        if ( okay == true ) {
            ret += this.list;
        }
        return ret;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;
        if (getClass() != obj.getClass()) return false;
        UNION other = (UNION)obj;
        if (this.okay != other.okay) return false;
        boolean ret = true;
        if ( okay == true ) {
            ret = java.util.Objects.equals(this.list, other.list);
        }
        return ret;
    }

    @Override
    public int hashCode() {
        return XdrHashCode.hashCode(this);
    }

}
// End of UNION.java
