/*
 * 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 SILLYSTRUCT implements XdrAble, java.io.Serializable {
    /** TODO */
    protected byte[] fixedbuffer;
    /** TODO */
    protected byte[] buffer;
    /** TODO */
    protected byte[] fixedbytes;
    /** TODO */
    protected byte[] bytes;
    /** TODO */
    protected short si1;
    /** TODO */
    protected short usi1;
    /** TODO */
    protected int ui1;
    /** TODO */
    protected int ui2;
    /** TODO */
    protected long hyper1;
    /** TODO */
    protected long hyper2;
    /** TODO */
    protected long uhyper1;
    /** TODO */
    protected long uhyper2;
    /** TODO */
    protected String nonsense;

    private static final long serialVersionUID = 571748788309357016L;

    public void setFixedbuffer(byte[] fixedbuffer) {
        this.fixedbuffer = fixedbuffer;
    }
    public void setFixedbuffer(int index, byte fixedbufferElement) {
        this.fixedbuffer[index] = fixedbufferElement;
    }
    public byte[] getFixedbuffer() {
        return this.fixedbuffer;
    }
    public byte getFixedbuffer(int index) {
        return this.fixedbuffer[index];
    }

    public void setBuffer(byte[] buffer) {
        this.buffer = buffer;
    }
    public void setBuffer(int index, byte bufferElement) {
        this.buffer[index] = bufferElement;
    }
    public byte[] getBuffer() {
        return this.buffer;
    }
    public byte getBuffer(int index) {
        return this.buffer[index];
    }

    public void setFixedbytes(byte[] fixedbytes) {
        this.fixedbytes = fixedbytes;
    }
    public void setFixedbytes(int index, byte fixedbytesElement) {
        this.fixedbytes[index] = fixedbytesElement;
    }
    public byte[] getFixedbytes() {
        return this.fixedbytes;
    }
    public byte getFixedbytes(int index) {
        return this.fixedbytes[index];
    }

    public void setBytes(byte[] bytes) {
        this.bytes = bytes;
    }
    public void setBytes(int index, byte bytesElement) {
        this.bytes[index] = bytesElement;
    }
    public byte[] getBytes() {
        return this.bytes;
    }
    public byte getBytes(int index) {
        return this.bytes[index];
    }

    public void setSi1(short si1) {
        this.si1 = si1;
    }
    public short getSi1() {
        return this.si1;
    }

    public void setUsi1(short usi1) {
        this.usi1 = usi1;
    }
    public short getUsi1() {
        return this.usi1;
    }

    public void setUi1(int ui1) {
        this.ui1 = ui1;
    }
    public int getUi1() {
        return this.ui1;
    }

    public void setUi2(int ui2) {
        this.ui2 = ui2;
    }
    public int getUi2() {
        return this.ui2;
    }

    public void setHyper1(long hyper1) {
        this.hyper1 = hyper1;
    }
    public long getHyper1() {
        return this.hyper1;
    }

    public void setHyper2(long hyper2) {
        this.hyper2 = hyper2;
    }
    public long getHyper2() {
        return this.hyper2;
    }

    public void setUhyper1(long uhyper1) {
        this.uhyper1 = uhyper1;
    }
    public long getUhyper1() {
        return this.uhyper1;
    }

    public void setUhyper2(long uhyper2) {
        this.uhyper2 = uhyper2;
    }
    public long getUhyper2() {
        return this.uhyper2;
    }

    public void setNonsense(String nonsense) {
        this.nonsense = nonsense;
    }
    public String getNonsense() {
        return this.nonsense;
    }

    public SILLYSTRUCT() {
    }

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

    public SILLYSTRUCT(byte[] fixedbuffer, byte[] buffer, byte[] fixedbytes,
           byte[] bytes, short si1, short usi1, int ui1, int ui2, long hyper1,
           long hyper2, long uhyper1, long uhyper2, String nonsense) {
        this.fixedbuffer = fixedbuffer;
        this.buffer = buffer;
        this.fixedbytes = fixedbytes;
        this.bytes = bytes;
        this.si1 = si1;
        this.usi1 = usi1;
        this.ui1 = ui1;
        this.ui2 = ui2;
        this.hyper1 = hyper1;
        this.hyper2 = hyper2;
        this.uhyper1 = uhyper1;
        this.uhyper2 = uhyper2;
        this.nonsense = nonsense;
    }

    @Override
    public void xdrEncode(XdrEncodingStream xdr)
           throws OncRpcException, IOException {
        xdr.xdrEncodeByteFixedVector(fixedbuffer, 512);
        xdr.xdrEncodeByteVector(buffer);
        xdr.xdrEncodeOpaque(fixedbytes, demo.FIXEDBUFFERLENGTH);
        xdr.xdrEncodeDynamicOpaque(bytes);
        xdr.xdrEncodeShort(si1);
        xdr.xdrEncodeShort(usi1);
        xdr.xdrEncodeInt(ui1);
        xdr.xdrEncodeInt(ui2);
        xdr.xdrEncodeLong(hyper1);
        xdr.xdrEncodeLong(hyper2);
        xdr.xdrEncodeLong(uhyper1);
        xdr.xdrEncodeLong(uhyper2);
        xdr.xdrEncodeString(nonsense);
    }

    @Override
    public void xdrDecode(XdrDecodingStream xdr)
           throws OncRpcException, IOException {
        fixedbuffer = xdr.xdrDecodeByteFixedVector(512);
        buffer = xdr.xdrDecodeByteVector();
        fixedbytes = xdr.xdrDecodeOpaque(demo.FIXEDBUFFERLENGTH);
        bytes = xdr.xdrDecodeDynamicOpaque();
        si1 = xdr.xdrDecodeShort();
        usi1 = xdr.xdrDecodeShort();
        ui1 = xdr.xdrDecodeInt();
        ui2 = xdr.xdrDecodeInt();
        hyper1 = xdr.xdrDecodeLong();
        hyper2 = xdr.xdrDecodeLong();
        uhyper1 = xdr.xdrDecodeLong();
        uhyper2 = xdr.xdrDecodeLong();
        nonsense = xdr.xdrDecodeString();
    }

    @Override
    public String toString() {
        return "SILLYSTRUCT ["
        + "fixedbuffer=" + java.util.Arrays.toString(fixedbuffer) + ", "
        + "buffer=" + java.util.Arrays.toString(buffer) + ", "
        + "fixedbytes=" + java.util.Arrays.toString(fixedbytes) + ", "
        + "bytes=" + java.util.Arrays.toString(bytes) + ", "
        + "si1=" + si1 + ", "
        + "usi1=" + usi1 + ", "
        + "ui1=" + ui1 + ", "
        + "ui2=" + ui2 + ", "
        + "hyper1=" + hyper1 + ", "
        + "hyper2=" + hyper2 + ", "
        + "uhyper1=" + uhyper1 + ", "
        + "uhyper2=" + uhyper2 + ", "
        + "nonsense=" + nonsense
        + "]";
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;
        if (getClass() != obj.getClass()) return false;
        SILLYSTRUCT other = (SILLYSTRUCT)obj;
        if (! java.util.Arrays.equals(this.fixedbuffer, other.fixedbuffer)) return false;
        if (! java.util.Arrays.equals(this.buffer, other.buffer)) return false;
        if (! java.util.Arrays.equals(this.fixedbytes, other.fixedbytes)) return false;
        if (! java.util.Arrays.equals(this.bytes, other.bytes)) return false;
        if (this.si1 != other.si1) return false;
        if (this.usi1 != other.usi1) return false;
        if (this.ui1 != other.ui1) return false;
        if (this.ui2 != other.ui2) return false;
        if (this.hyper1 != other.hyper1) return false;
        if (this.hyper2 != other.hyper2) return false;
        if (this.uhyper1 != other.uhyper1) return false;
        if (this.uhyper2 != other.uhyper2) return false;
        if (! java.util.Objects.equals(this.nonsense, other.nonsense)) return false;
        return true;
    }

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

    public static void xdrEncodeFixedVector(XdrEncodingStream xdr, SILLYSTRUCT[] vector, int size)
           throws OncRpcException, IOException {
        if (vector.length != size) {
            throw new IllegalArgumentException("array size does not match protocol specification");
        }

        for (int index = 0; index < size; index++) {
            vector[index].xdrEncode(xdr);
        }
    }

    public static SILLYSTRUCT[] xdrDecodeFixedVector(XdrDecodingStream xdr, int size)
           throws OncRpcException, IOException {
        SILLYSTRUCT[] vector = new SILLYSTRUCT[size];

        for (int index = 0; index < size; index++) {
            vector[index] = new SILLYSTRUCT(xdr);
        }

        return vector;
    }

    public static void xdrEncodeDynamicVector(XdrEncodingStream xdr, SILLYSTRUCT[] vector)
           throws OncRpcException, IOException {
        xdr.xdrEncodeInt(vector.length);
        xdrEncodeFixedVector(xdr, vector, vector.length);
    }

    public static SILLYSTRUCT[] xdrDecodeDynamicVector(XdrDecodingStream xdr)
           throws OncRpcException, IOException {
        return xdrDecodeFixedVector(xdr, xdr.xdrDecodeInt());
    }

}
// End of SILLYSTRUCT.java
