/*
 * 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;

/**
 * Dynamic vectors with a maximum length equal to one
 * are another way to declare optional data. However,
 * they are mapped to Java arrays instead of Java objects
 * as with indirections. Therefore they get their place here. 
 */
public class OPTIONALDATA implements XdrAble, java.io.Serializable {
    /** TODO */
    protected byte[] optionalCharacter;
    /** TODO */
    protected int[] optionalInteger;
    /** TODO */
    protected float[] optionalFloat;
    /** TODO */
    protected double[] optionalDouble;
    /** TODO */
    protected STRING[] optionalString;
    /** TODO */
    protected ENUMFOO[] optionalEnum;
    /** TODO */
    protected ANSWER[] optionalUnion;
    /** TODO */
    protected SILLYSTRUCT[] optionalStruct;

    private static final long serialVersionUID = 7291765053706390896L;

    public void setOptionalCharacter(byte[] optionalCharacter) {
        this.optionalCharacter = optionalCharacter;
    }
    public void setOptionalCharacter(int index, byte optionalCharacterElement) {
        this.optionalCharacter[index] = optionalCharacterElement;
    }
    public byte[] getOptionalCharacter() {
        return this.optionalCharacter;
    }
    public byte getOptionalCharacter(int index) {
        return this.optionalCharacter[index];
    }

    public void setOptionalInteger(int[] optionalInteger) {
        this.optionalInteger = optionalInteger;
    }
    public void setOptionalInteger(int index, int optionalIntegerElement) {
        this.optionalInteger[index] = optionalIntegerElement;
    }
    public int[] getOptionalInteger() {
        return this.optionalInteger;
    }
    public int getOptionalInteger(int index) {
        return this.optionalInteger[index];
    }

    public void setOptionalFloat(float[] optionalFloat) {
        this.optionalFloat = optionalFloat;
    }
    public void setOptionalFloat(int index, float optionalFloatElement) {
        this.optionalFloat[index] = optionalFloatElement;
    }
    public float[] getOptionalFloat() {
        return this.optionalFloat;
    }
    public float getOptionalFloat(int index) {
        return this.optionalFloat[index];
    }

    public void setOptionalDouble(double[] optionalDouble) {
        this.optionalDouble = optionalDouble;
    }
    public void setOptionalDouble(int index, double optionalDoubleElement) {
        this.optionalDouble[index] = optionalDoubleElement;
    }
    public double[] getOptionalDouble() {
        return this.optionalDouble;
    }
    public double getOptionalDouble(int index) {
        return this.optionalDouble[index];
    }

    public void setOptionalString(STRING[] optionalString) {
        this.optionalString = optionalString;
    }
    public void setOptionalString(int index, STRING optionalStringElement) {
        this.optionalString[index] = optionalStringElement;
    }
    public STRING[] getOptionalString() {
        return this.optionalString;
    }
    public STRING getOptionalString(int index) {
        return this.optionalString[index];
    }

    public void setOptionalEnum(ENUMFOO[] optionalEnum) {
        this.optionalEnum = optionalEnum;
    }
    public void setOptionalEnum(int index, ENUMFOO optionalEnumElement) {
        this.optionalEnum[index] = optionalEnumElement;
    }
    public ENUMFOO[] getOptionalEnum() {
        return this.optionalEnum;
    }
    public ENUMFOO getOptionalEnum(int index) {
        return this.optionalEnum[index];
    }

    public void setOptionalUnion(ANSWER[] optionalUnion) {
        this.optionalUnion = optionalUnion;
    }
    public void setOptionalUnion(int index, ANSWER optionalUnionElement) {
        this.optionalUnion[index] = optionalUnionElement;
    }
    public ANSWER[] getOptionalUnion() {
        return this.optionalUnion;
    }
    public ANSWER getOptionalUnion(int index) {
        return this.optionalUnion[index];
    }

    public void setOptionalStruct(SILLYSTRUCT[] optionalStruct) {
        this.optionalStruct = optionalStruct;
    }
    public void setOptionalStruct(int index, SILLYSTRUCT optionalStructElement) {
        this.optionalStruct[index] = optionalStructElement;
    }
    public SILLYSTRUCT[] getOptionalStruct() {
        return this.optionalStruct;
    }
    public SILLYSTRUCT getOptionalStruct(int index) {
        return this.optionalStruct[index];
    }

    public OPTIONALDATA() {
    }

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

    public OPTIONALDATA(byte[] optionalCharacter, int[] optionalInteger,
           float[] optionalFloat, double[] optionalDouble,
           STRING[] optionalString, ENUMFOO[] optionalEnum,
           ANSWER[] optionalUnion, SILLYSTRUCT[] optionalStruct) {
        this.optionalCharacter = optionalCharacter;
        this.optionalInteger = optionalInteger;
        this.optionalFloat = optionalFloat;
        this.optionalDouble = optionalDouble;
        this.optionalString = optionalString;
        this.optionalEnum = optionalEnum;
        this.optionalUnion = optionalUnion;
        this.optionalStruct = optionalStruct;
    }

    @Override
    public void xdrEncode(XdrEncodingStream xdr)
           throws OncRpcException, IOException {
        xdr.xdrEncodeByteVector(optionalCharacter);
        xdr.xdrEncodeIntVector(optionalInteger);
        xdr.xdrEncodeFloatVector(optionalFloat);
        xdr.xdrEncodeDoubleVector(optionalDouble);
        STRING.xdrEncodeDynamicVector(xdr, optionalString);
        ENUMFOO.xdrEncodeDynamicVector(xdr, optionalEnum);
        ANSWER.xdrEncodeDynamicVector(xdr, optionalUnion);
        SILLYSTRUCT.xdrEncodeDynamicVector(xdr, optionalStruct);
    }

    @Override
    public void xdrDecode(XdrDecodingStream xdr)
           throws OncRpcException, IOException {
        optionalCharacter = xdr.xdrDecodeByteVector();
        optionalInteger = xdr.xdrDecodeIntVector();
        optionalFloat = xdr.xdrDecodeFloatVector();
        optionalDouble = xdr.xdrDecodeDoubleVector();
        optionalString = STRING.xdrDecodeDynamicVector(xdr);
        optionalEnum = ENUMFOO.xdrDecodeDynamicVector(xdr);
        optionalUnion = ANSWER.xdrDecodeDynamicVector(xdr);
        optionalStruct = SILLYSTRUCT.xdrDecodeDynamicVector(xdr);
    }

    @Override
    public String toString() {
        return "OPTIONALDATA ["
        + "optionalCharacter=" + java.util.Arrays.toString(optionalCharacter) + ", "
        + "optionalInteger=" + java.util.Arrays.toString(optionalInteger) + ", "
        + "optionalFloat=" + java.util.Arrays.toString(optionalFloat) + ", "
        + "optionalDouble=" + java.util.Arrays.toString(optionalDouble) + ", "
        + "optionalString=" + java.util.Arrays.toString(optionalString) + ", "
        + "optionalEnum=" + java.util.Arrays.toString(optionalEnum) + ", "
        + "optionalUnion=" + java.util.Arrays.toString(optionalUnion) + ", "
        + "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;
        OPTIONALDATA other = (OPTIONALDATA)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.optionalFloat, other.optionalFloat)) return false;
        if (! java.util.Arrays.equals(this.optionalDouble, other.optionalDouble)) return false;
        if (! java.util.Arrays.equals(this.optionalString, other.optionalString)) return false;
        if (! java.util.Arrays.equals(this.optionalEnum, other.optionalEnum)) return false;
        if (! java.util.Arrays.equals(this.optionalUnion, other.optionalUnion)) 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 OPTIONALDATA.java
