/*
 * 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 OPTIONALDATA2 implements XdrAble {
    /** TODO */
    public byte[] optionalCharacter;
    /** TODO */
    public int[] optionalInteger;
    /** TODO */
    public int[] optionalEnum;
    /** TODO */
    public TREE2[] optionalStruct;

    public OPTIONALDATA2() {
    }

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

    public OPTIONALDATA2(byte[] optionalCharacter, int[] optionalInteger,
           int[] optionalEnum, TREE2[] optionalStruct) {
        this.optionalCharacter = optionalCharacter;
        this.optionalInteger = optionalInteger;
        this.optionalEnum = optionalEnum;
        this.optionalStruct = optionalStruct;
    }

    @Override
    public void xdrEncode(XdrEncodingStream xdr)
           throws OncRpcException, IOException {
        xdr.xdrEncodeByteVector(optionalCharacter);
        xdr.xdrEncodeIntVector(optionalInteger);
        xdr.xdrEncodeIntVector(optionalEnum);
        TREE2.xdrEncodeDynamicVector(xdr, optionalStruct);
    }

    @Override
    public void xdrDecode(XdrDecodingStream xdr)
           throws OncRpcException, IOException {
        optionalCharacter = xdr.xdrDecodeByteVector();
        optionalInteger = xdr.xdrDecodeIntVector();
        optionalEnum = xdr.xdrDecodeIntVector();
        optionalStruct = TREE2.xdrDecodeDynamicVector(xdr);
    }

    @Override
    public String toString() {
        return "OPTIONALDATA2 ["
        + "optionalCharacter=" + java.util.Arrays.toString(optionalCharacter) + ", "
        + "optionalInteger=" + java.util.Arrays.toString(optionalInteger) + ", "
        + "optionalEnum=" + java.util.Arrays.toString(optionalEnum) + ", "
        + "optionalStruct=" + java.util.Arrays.toString(optionalStruct)
        + "]";
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;
        if (getClass() != obj.getClass()) return false;
        OPTIONALDATA2 other = (OPTIONALDATA2)obj;
        if (! java.util.Arrays.equals(this.optionalCharacter, other.optionalCharacter)) return false;
        if (! java.util.Arrays.equals(this.optionalInteger, other.optionalInteger)) return false;
        if (! java.util.Arrays.equals(this.optionalEnum, other.optionalEnum)) return false;
        if (! java.util.Arrays.equals(this.optionalStruct, other.optionalStruct)) return false;
        return true;
    }

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

}
// End of OPTIONALDATA2.java
