All Downloads are FREE. Search and download functionalities are using the official Maven repository.

b3.entrypoint.fixp.sbe.AllocationInstructionDecoder Maven / Gradle / Ivy

/* Generated SBE (Simple Binary Encoding) message codec. */
package b3.entrypoint.fixp.sbe;

import org.agrona.MutableDirectBuffer;
import org.agrona.DirectBuffer;
import org.agrona.sbe.*;


/**
 * AllocationInstruction message submits a blocking position mechanism. The blocking specification functionality has been developed to provide the ability to the system, whenever necessary, to prevent the assignment of an options contract position.
 */
@SuppressWarnings("all")
public final class AllocationInstructionDecoder implements MessageDecoderFlyweight
{
    public static final int BLOCK_LENGTH = 45;
    public static final int TEMPLATE_ID = 601;
    public static final int SCHEMA_ID = 1;
    public static final int SCHEMA_VERSION = 5;
    public static final String SEMANTIC_VERSION = "5.6";
    public static final java.nio.ByteOrder BYTE_ORDER = java.nio.ByteOrder.LITTLE_ENDIAN;

    private final AllocationInstructionDecoder parentMessage = this;
    private DirectBuffer buffer;
    private int offset;
    private int limit;
    int actingBlockLength;
    int actingVersion;

    public int sbeBlockLength()
    {
        return BLOCK_LENGTH;
    }

    public int sbeTemplateId()
    {
        return TEMPLATE_ID;
    }

    public int sbeSchemaId()
    {
        return SCHEMA_ID;
    }

    public int sbeSchemaVersion()
    {
        return SCHEMA_VERSION;
    }

    public String sbeSemanticType()
    {
        return "";
    }

    public DirectBuffer buffer()
    {
        return buffer;
    }

    public int offset()
    {
        return offset;
    }

    public AllocationInstructionDecoder wrap(
        final DirectBuffer buffer,
        final int offset,
        final int actingBlockLength,
        final int actingVersion)
    {
        if (buffer != this.buffer)
        {
            this.buffer = buffer;
        }
        this.offset = offset;
        this.actingBlockLength = actingBlockLength;
        this.actingVersion = actingVersion;
        limit(offset + actingBlockLength);

        return this;
    }

    public AllocationInstructionDecoder wrapAndApplyHeader(
        final DirectBuffer buffer,
        final int offset,
        final MessageHeaderDecoder headerDecoder)
    {
        headerDecoder.wrap(buffer, offset);

        final int templateId = headerDecoder.templateId();
        if (TEMPLATE_ID != templateId)
        {
            throw new IllegalStateException("Invalid TEMPLATE_ID: " + templateId);
        }

        return wrap(
            buffer,
            offset + MessageHeaderDecoder.ENCODED_LENGTH,
            headerDecoder.blockLength(),
            headerDecoder.version());
    }

    public AllocationInstructionDecoder sbeRewind()
    {
        return wrap(buffer, offset, actingBlockLength, actingVersion);
    }

    public int sbeDecodedLength()
    {
        final int currentLimit = limit();
        sbeSkip();
        final int decodedLength = encodedLength();
        limit(currentLimit);

        return decodedLength;
    }

    public int actingVersion()
    {
        return actingVersion;
    }

    public int encodedLength()
    {
        return limit - offset;
    }

    public int limit()
    {
        return limit;
    }

    public void limit(final int limit)
    {
        this.limit = limit;
    }

    public static int messageTypeId()
    {
        return 35;
    }

    public static int messageTypeSinceVersion()
    {
        return 0;
    }

    public static int messageTypeEncodingOffset()
    {
        return 0;
    }

    public static int messageTypeEncodingLength()
    {
        return 1;
    }

    public static String messageTypeMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "constant";
        }

        return "";
    }

    public short messageTypeRaw()
    {
        return MessageType.AllocationInstruction.value();
    }


    public MessageType messageType()
    {
        return MessageType.AllocationInstruction;
    }


    public static int allocIDId()
    {
        return 70;
    }

    public static int allocIDSinceVersion()
    {
        return 0;
    }

    public static int allocIDEncodingOffset()
    {
        return 0;
    }

    public static int allocIDEncodingLength()
    {
        return 8;
    }

    public static String allocIDMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }

        return "";
    }

    public static long allocIDNullValue()
    {
        return 0xffffffffffffffffL;
    }

    public static long allocIDMinValue()
    {
        return 0x0L;
    }

    public static long allocIDMaxValue()
    {
        return 0xfffffffffffffffeL;
    }

    public long allocID()
    {
        return buffer.getLong(offset + 0, BYTE_ORDER);
    }


    public static int securityIDId()
    {
        return 48;
    }

    public static int securityIDSinceVersion()
    {
        return 0;
    }

    public static int securityIDEncodingOffset()
    {
        return 8;
    }

    public static int securityIDEncodingLength()
    {
        return 8;
    }

    public static String securityIDMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }

        return "";
    }

    public static long securityIDNullValue()
    {
        return 0xffffffffffffffffL;
    }

    public static long securityIDMinValue()
    {
        return 0x0L;
    }

    public static long securityIDMaxValue()
    {
        return 0xfffffffffffffffeL;
    }

    public long securityID()
    {
        return buffer.getLong(offset + 8, BYTE_ORDER);
    }


    public static int securityIDSourceId()
    {
        return 22;
    }

    public static int securityIDSourceSinceVersion()
    {
        return 0;
    }

    public static int securityIDSourceEncodingOffset()
    {
        return 16;
    }

    public static int securityIDSourceEncodingLength()
    {
        return 0;
    }

    public static String securityIDSourceMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "constant";
        }

        return "";
    }

    public static byte securityIDSourceNullValue()
    {
        return (byte)0;
    }

    public static byte securityIDSourceMinValue()
    {
        return (byte)32;
    }

    public static byte securityIDSourceMaxValue()
    {
        return (byte)126;
    }


    private static final byte[] SECURITYIDSOURCE_VALUE = { 56 };

    public static int securityIDSourceLength()
    {
        return 1;
    }


    public byte securityIDSource(final int index)
    {
        return SECURITYIDSOURCE_VALUE[index];
    }

    public int getSecurityIDSource(final byte[] dst, final int offset, final int length)
    {
        final int bytesCopied = Math.min(length, 1);
        System.arraycopy(SECURITYIDSOURCE_VALUE, 0, dst, offset, bytesCopied);

        return bytesCopied;
    }

    public byte securityIDSource()
    {
        return (byte)56;
    }


    public static int securityExchangeId()
    {
        return 207;
    }

    public static int securityExchangeSinceVersion()
    {
        return 0;
    }

    public static int securityExchangeEncodingOffset()
    {
        return 16;
    }

    public static int securityExchangeEncodingLength()
    {
        return 0;
    }

    public static String securityExchangeMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "constant";
        }

        return "";
    }

    public static byte securityExchangeNullValue()
    {
        return (byte)0;
    }

    public static byte securityExchangeMinValue()
    {
        return (byte)32;
    }

    public static byte securityExchangeMaxValue()
    {
        return (byte)126;
    }


    private static final byte[] SECURITYEXCHANGE_VALUE = { 66, 86, 77, 70 };

    public static int securityExchangeLength()
    {
        return 4;
    }


    public byte securityExchange(final int index)
    {
        return SECURITYEXCHANGE_VALUE[index];
    }

    public int getSecurityExchange(final byte[] dst, final int offset, final int length)
    {
        final int bytesCopied = Math.min(length, 4);
        System.arraycopy(SECURITYEXCHANGE_VALUE, 0, dst, offset, bytesCopied);

        return bytesCopied;
    }

    public String securityExchange()
    {
        return "BVMF";
    }


    public static int quantityId()
    {
        return 53;
    }

    public static int quantitySinceVersion()
    {
        return 0;
    }

    public static int quantityEncodingOffset()
    {
        return 16;
    }

    public static int quantityEncodingLength()
    {
        return 8;
    }

    public static String quantityMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }

        return "";
    }

    public static long quantityNullValue()
    {
        return 0xffffffffffffffffL;
    }

    public static long quantityMinValue()
    {
        return 0x0L;
    }

    public static long quantityMaxValue()
    {
        return 0xfffffffffffffffeL;
    }

    public long quantity()
    {
        return buffer.getLong(offset + 16, BYTE_ORDER);
    }


    public static int senderLocationId()
    {
        return 35503;
    }

    public static int senderLocationSinceVersion()
    {
        return 0;
    }

    public static int senderLocationEncodingOffset()
    {
        return 24;
    }

    public static int senderLocationEncodingLength()
    {
        return 10;
    }

    public static String senderLocationMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }

        return "";
    }

    public static byte senderLocationNullValue()
    {
        return (byte)0;
    }

    public static byte senderLocationMinValue()
    {
        return (byte)32;
    }

    public static byte senderLocationMaxValue()
    {
        return (byte)126;
    }

    public static int senderLocationLength()
    {
        return 10;
    }


    public byte senderLocation(final int index)
    {
        if (index < 0 || index >= 10)
        {
            throw new IndexOutOfBoundsException("index out of range: index=" + index);
        }

        final int pos = offset + 24 + (index * 1);

        return buffer.getByte(pos);
    }


    public static String senderLocationCharacterEncoding()
    {
        return java.nio.charset.StandardCharsets.US_ASCII.name();
    }

    public int getSenderLocation(final byte[] dst, final int dstOffset)
    {
        final int length = 10;
        if (dstOffset < 0 || dstOffset > (dst.length - length))
        {
            throw new IndexOutOfBoundsException("Copy will go out of range: offset=" + dstOffset);
        }

        buffer.getBytes(offset + 24, dst, dstOffset, length);

        return length;
    }

    public String senderLocation()
    {
        final byte[] dst = new byte[10];
        buffer.getBytes(offset + 24, dst, 0, 10);

        int end = 0;
        for (; end < 10 && dst[end] != 0; ++end);

        return new String(dst, 0, end, java.nio.charset.StandardCharsets.US_ASCII);
    }


    public int getSenderLocation(final Appendable value)
    {
        for (int i = 0; i < 10; ++i)
        {
            final int c = buffer.getByte(offset + 24 + i) & 0xFF;
            if (c == 0)
            {
                return i;
            }

            try
            {
                value.append(c > 127 ? '?' : (char)c);
            }
            catch (final java.io.IOException ex)
            {
                throw new java.io.UncheckedIOException(ex);
            }
        }

        return 10;
    }


    public static int enteringTraderId()
    {
        return 35502;
    }

    public static int enteringTraderSinceVersion()
    {
        return 0;
    }

    public static int enteringTraderEncodingOffset()
    {
        return 34;
    }

    public static int enteringTraderEncodingLength()
    {
        return 5;
    }

    public static String enteringTraderMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }

        return "";
    }

    public static byte enteringTraderNullValue()
    {
        return (byte)0;
    }

    public static byte enteringTraderMinValue()
    {
        return (byte)32;
    }

    public static byte enteringTraderMaxValue()
    {
        return (byte)126;
    }

    public static int enteringTraderLength()
    {
        return 5;
    }


    public byte enteringTrader(final int index)
    {
        if (index < 0 || index >= 5)
        {
            throw new IndexOutOfBoundsException("index out of range: index=" + index);
        }

        final int pos = offset + 34 + (index * 1);

        return buffer.getByte(pos);
    }


    public static String enteringTraderCharacterEncoding()
    {
        return java.nio.charset.StandardCharsets.US_ASCII.name();
    }

    public int getEnteringTrader(final byte[] dst, final int dstOffset)
    {
        final int length = 5;
        if (dstOffset < 0 || dstOffset > (dst.length - length))
        {
            throw new IndexOutOfBoundsException("Copy will go out of range: offset=" + dstOffset);
        }

        buffer.getBytes(offset + 34, dst, dstOffset, length);

        return length;
    }

    public String enteringTrader()
    {
        final byte[] dst = new byte[5];
        buffer.getBytes(offset + 34, dst, 0, 5);

        int end = 0;
        for (; end < 5 && dst[end] != 0; ++end);

        return new String(dst, 0, end, java.nio.charset.StandardCharsets.US_ASCII);
    }


    public int getEnteringTrader(final Appendable value)
    {
        for (int i = 0; i < 5; ++i)
        {
            final int c = buffer.getByte(offset + 34 + i) & 0xFF;
            if (c == 0)
            {
                return i;
            }

            try
            {
                value.append(c > 127 ? '?' : (char)c);
            }
            catch (final java.io.IOException ex)
            {
                throw new java.io.UncheckedIOException(ex);
            }
        }

        return 5;
    }


    public static int tradeDateId()
    {
        return 75;
    }

    public static int tradeDateSinceVersion()
    {
        return 0;
    }

    public static int tradeDateEncodingOffset()
    {
        return 39;
    }

    public static int tradeDateEncodingLength()
    {
        return 2;
    }

    public static String tradeDateMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "optional";
        }

        return "";
    }

    public static int tradeDateNullValue()
    {
        return 0;
    }

    public static int tradeDateMinValue()
    {
        return 0;
    }

    public static int tradeDateMaxValue()
    {
        return 65534;
    }

    public int tradeDate()
    {
        return (buffer.getShort(offset + 39, BYTE_ORDER) & 0xFFFF);
    }


    public static int allocTransTypeId()
    {
        return 71;
    }

    public static int allocTransTypeSinceVersion()
    {
        return 0;
    }

    public static int allocTransTypeEncodingOffset()
    {
        return 41;
    }

    public static int allocTransTypeEncodingLength()
    {
        return 1;
    }

    public static String allocTransTypeMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }

        return "";
    }

    public byte allocTransTypeRaw()
    {
        return buffer.getByte(offset + 41);
    }

    public AllocTransType allocTransType()
    {
        return AllocTransType.get(buffer.getByte(offset + 41));
    }


    public static int allocTypeId()
    {
        return 626;
    }

    public static int allocTypeSinceVersion()
    {
        return 0;
    }

    public static int allocTypeEncodingOffset()
    {
        return 42;
    }

    public static int allocTypeEncodingLength()
    {
        return 1;
    }

    public static String allocTypeMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }

        return "";
    }

    public byte allocTypeRaw()
    {
        return buffer.getByte(offset + 42);
    }

    public AllocType allocType()
    {
        return AllocType.get(buffer.getByte(offset + 42));
    }


    public static int allocNoOrdersTypeId()
    {
        return 857;
    }

    public static int allocNoOrdersTypeSinceVersion()
    {
        return 0;
    }

    public static int allocNoOrdersTypeEncodingOffset()
    {
        return 43;
    }

    public static int allocNoOrdersTypeEncodingLength()
    {
        return 1;
    }

    public static String allocNoOrdersTypeMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }

        return "";
    }

    public byte allocNoOrdersTypeRaw()
    {
        return buffer.getByte(offset + 43);
    }

    public AllocNoOrdersType allocNoOrdersType()
    {
        return AllocNoOrdersType.get(buffer.getByte(offset + 43));
    }


    public static int sideId()
    {
        return 54;
    }

    public static int sideSinceVersion()
    {
        return 0;
    }

    public static int sideEncodingOffset()
    {
        return 44;
    }

    public static int sideEncodingLength()
    {
        return 1;
    }

    public static String sideMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }

        return "";
    }

    public byte sideRaw()
    {
        return buffer.getByte(offset + 44);
    }

    public Side side()
    {
        return Side.get(buffer.getByte(offset + 44));
    }


    private final NoExecsDecoder noExecs = new NoExecsDecoder(this);

    public static long noExecsDecoderId()
    {
        return 124;
    }

    public static int noExecsDecoderSinceVersion()
    {
        return 0;
    }

    public NoExecsDecoder noExecs()
    {
        noExecs.wrap(buffer);
        return noExecs;
    }

    public static final class NoExecsDecoder
        implements Iterable, java.util.Iterator
    {
        public static final int HEADER_SIZE = 3;
        private final AllocationInstructionDecoder parentMessage;
        private DirectBuffer buffer;
        private int count;
        private int index;
        private int offset;
        private int blockLength;

        NoExecsDecoder(final AllocationInstructionDecoder parentMessage)
        {
            this.parentMessage = parentMessage;
        }

        public void wrap(final DirectBuffer buffer)
        {
            if (buffer != this.buffer)
            {
                this.buffer = buffer;
            }

            index = 0;
            final int limit = parentMessage.limit();
            parentMessage.limit(limit + HEADER_SIZE);
            blockLength = (buffer.getShort(limit + 0, BYTE_ORDER) & 0xFFFF);
            count = ((short)(buffer.getByte(limit + 2) & 0xFF));
        }

        public NoExecsDecoder next()
        {
            if (index >= count)
            {
                throw new java.util.NoSuchElementException();
            }

            offset = parentMessage.limit();
            parentMessage.limit(offset + blockLength);
            ++index;

            return this;
        }

        public static short countMinValue()
        {
            return (short)0;
        }

        public static short countMaxValue()
        {
            return (short)254;
        }

        public static int sbeHeaderSize()
        {
            return HEADER_SIZE;
        }

        public static int sbeBlockLength()
        {
            return 4;
        }

        public int actingBlockLength()
        {
            return blockLength;
        }

        public int count()
        {
            return count;
        }

        public java.util.Iterator iterator()
        {
            return this;
        }

        public void remove()
        {
            throw new UnsupportedOperationException();
        }

        public boolean hasNext()
        {
            return index < count;
        }

        public static int tradeIDId()
        {
            return 1003;
        }

        public static int tradeIDSinceVersion()
        {
            return 0;
        }

        public static int tradeIDEncodingOffset()
        {
            return 0;
        }

        public static int tradeIDEncodingLength()
        {
            return 4;
        }

        public static String tradeIDMetaAttribute(final MetaAttribute metaAttribute)
        {
            if (MetaAttribute.PRESENCE == metaAttribute)
            {
                return "optional";
            }

            return "";
        }

        public static long tradeIDNullValue()
        {
            return 0L;
        }

        public static long tradeIDMinValue()
        {
            return 0L;
        }

        public static long tradeIDMaxValue()
        {
            return 4294967294L;
        }

        public long tradeID()
        {
            return (buffer.getInt(offset + 0, BYTE_ORDER) & 0xFFFF_FFFFL);
        }


        public StringBuilder appendTo(final StringBuilder builder)
        {
            if (null == buffer)
            {
                return builder;
            }

            builder.append('(');
            builder.append("tradeID=");
            builder.append(this.tradeID());
            builder.append(')');

            return builder;
        }
        
        public NoExecsDecoder sbeSkip()
        {

            return this;
        }
    }

    private final NoAllocsDecoder noAllocs = new NoAllocsDecoder(this);

    public static long noAllocsDecoderId()
    {
        return 78;
    }

    public static int noAllocsDecoderSinceVersion()
    {
        return 0;
    }

    public NoAllocsDecoder noAllocs()
    {
        noAllocs.wrap(buffer);
        return noAllocs;
    }

    public static final class NoAllocsDecoder
        implements Iterable, java.util.Iterator
    {
        public static final int HEADER_SIZE = 3;
        private final AllocationInstructionDecoder parentMessage;
        private DirectBuffer buffer;
        private int count;
        private int index;
        private int offset;
        private int blockLength;

        NoAllocsDecoder(final AllocationInstructionDecoder parentMessage)
        {
            this.parentMessage = parentMessage;
        }

        public void wrap(final DirectBuffer buffer)
        {
            if (buffer != this.buffer)
            {
                this.buffer = buffer;
            }

            index = 0;
            final int limit = parentMessage.limit();
            parentMessage.limit(limit + HEADER_SIZE);
            blockLength = (buffer.getShort(limit + 0, BYTE_ORDER) & 0xFFFF);
            count = ((short)(buffer.getByte(limit + 2) & 0xFF));
        }

        public NoAllocsDecoder next()
        {
            if (index >= count)
            {
                throw new java.util.NoSuchElementException();
            }

            offset = parentMessage.limit();
            parentMessage.limit(offset + blockLength);
            ++index;

            return this;
        }

        public static short countMinValue()
        {
            return (short)0;
        }

        public static short countMaxValue()
        {
            return (short)254;
        }

        public static int sbeHeaderSize()
        {
            return HEADER_SIZE;
        }

        public static int sbeBlockLength()
        {
            return 20;
        }

        public int actingBlockLength()
        {
            return blockLength;
        }

        public int count()
        {
            return count;
        }

        public java.util.Iterator iterator()
        {
            return this;
        }

        public void remove()
        {
            throw new UnsupportedOperationException();
        }

        public boolean hasNext()
        {
            return index < count;
        }

        public static int individualAllocIDId()
        {
            return 467;
        }

        public static int individualAllocIDSinceVersion()
        {
            return 0;
        }

        public static int individualAllocIDEncodingOffset()
        {
            return 0;
        }

        public static int individualAllocIDEncodingLength()
        {
            return 8;
        }

        public static String individualAllocIDMetaAttribute(final MetaAttribute metaAttribute)
        {
            if (MetaAttribute.PRESENCE == metaAttribute)
            {
                return "required";
            }

            return "";
        }

        public static long individualAllocIDNullValue()
        {
            return 0xffffffffffffffffL;
        }

        public static long individualAllocIDMinValue()
        {
            return 0x0L;
        }

        public static long individualAllocIDMaxValue()
        {
            return 0xfffffffffffffffeL;
        }

        public long individualAllocID()
        {
            return buffer.getLong(offset + 0, BYTE_ORDER);
        }


        public static int allocAccountId()
        {
            return 79;
        }

        public static int allocAccountSinceVersion()
        {
            return 0;
        }

        public static int allocAccountEncodingOffset()
        {
            return 8;
        }

        public static int allocAccountEncodingLength()
        {
            return 4;
        }

        public static String allocAccountMetaAttribute(final MetaAttribute metaAttribute)
        {
            if (MetaAttribute.PRESENCE == metaAttribute)
            {
                return "optional";
            }

            return "";
        }

        public static long allocAccountNullValue()
        {
            return 0L;
        }

        public static long allocAccountMinValue()
        {
            return 0L;
        }

        public static long allocAccountMaxValue()
        {
            return 4294967294L;
        }

        public long allocAccount()
        {
            return (buffer.getInt(offset + 8, BYTE_ORDER) & 0xFFFF_FFFFL);
        }


        public static int allocQtyId()
        {
            return 80;
        }

        public static int allocQtySinceVersion()
        {
            return 0;
        }

        public static int allocQtyEncodingOffset()
        {
            return 12;
        }

        public static int allocQtyEncodingLength()
        {
            return 8;
        }

        public static String allocQtyMetaAttribute(final MetaAttribute metaAttribute)
        {
            if (MetaAttribute.PRESENCE == metaAttribute)
            {
                return "required";
            }

            return "";
        }

        public static long allocQtyNullValue()
        {
            return 0xffffffffffffffffL;
        }

        public static long allocQtyMinValue()
        {
            return 0x0L;
        }

        public static long allocQtyMaxValue()
        {
            return 0xfffffffffffffffeL;
        }

        public long allocQty()
        {
            return buffer.getLong(offset + 12, BYTE_ORDER);
        }


        public StringBuilder appendTo(final StringBuilder builder)
        {
            if (null == buffer)
            {
                return builder;
            }

            builder.append('(');
            builder.append("individualAllocID=");
            builder.append(this.individualAllocID());
            builder.append('|');
            builder.append("allocAccount=");
            builder.append(this.allocAccount());
            builder.append('|');
            builder.append("allocQty=");
            builder.append(this.allocQty());
            builder.append(')');

            return builder;
        }
        
        public NoAllocsDecoder sbeSkip()
        {

            return this;
        }
    }

    public static int deskIDId()
    {
        return 35510;
    }

    public static int deskIDSinceVersion()
    {
        return 0;
    }

    public static String deskIDCharacterEncoding()
    {
        return java.nio.charset.StandardCharsets.US_ASCII.name();
    }

    public static String deskIDMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }
        if (MetaAttribute.SEMANTIC_TYPE == metaAttribute)
        {
            return "String";
        }

        return "";
    }

    public static int deskIDHeaderLength()
    {
        return 1;
    }

    public int deskIDLength()
    {
        final int limit = parentMessage.limit();
        return ((short)(buffer.getByte(limit) & 0xFF));
    }

    public int skipDeskID()
    {
        final int headerLength = 1;
        final int limit = parentMessage.limit();
        final int dataLength = ((short)(buffer.getByte(limit) & 0xFF));
        final int dataOffset = limit + headerLength;
        parentMessage.limit(dataOffset + dataLength);

        return dataLength;
    }

    public int getDeskID(final MutableDirectBuffer dst, final int dstOffset, final int length)
    {
        final int headerLength = 1;
        final int limit = parentMessage.limit();
        final int dataLength = ((short)(buffer.getByte(limit) & 0xFF));
        final int bytesCopied = Math.min(length, dataLength);
        parentMessage.limit(limit + headerLength + dataLength);
        buffer.getBytes(limit + headerLength, dst, dstOffset, bytesCopied);

        return bytesCopied;
    }

    public int getDeskID(final byte[] dst, final int dstOffset, final int length)
    {
        final int headerLength = 1;
        final int limit = parentMessage.limit();
        final int dataLength = ((short)(buffer.getByte(limit) & 0xFF));
        final int bytesCopied = Math.min(length, dataLength);
        parentMessage.limit(limit + headerLength + dataLength);
        buffer.getBytes(limit + headerLength, dst, dstOffset, bytesCopied);

        return bytesCopied;
    }

    public void wrapDeskID(final DirectBuffer wrapBuffer)
    {
        final int headerLength = 1;
        final int limit = parentMessage.limit();
        final int dataLength = ((short)(buffer.getByte(limit) & 0xFF));
        parentMessage.limit(limit + headerLength + dataLength);
        wrapBuffer.wrap(buffer, limit + headerLength, dataLength);
    }

    public String deskID()
    {
        final int headerLength = 1;
        final int limit = parentMessage.limit();
        final int dataLength = ((short)(buffer.getByte(limit) & 0xFF));
        parentMessage.limit(limit + headerLength + dataLength);

        if (0 == dataLength)
        {
            return "";
        }

        final byte[] tmp = new byte[dataLength];
        buffer.getBytes(limit + headerLength, tmp, 0, dataLength);

        return new String(tmp, java.nio.charset.StandardCharsets.US_ASCII);
    }

    public int getDeskID(final Appendable appendable)
    {
        final int headerLength = 1;
        final int limit = parentMessage.limit();
        final int dataLength = ((short)(buffer.getByte(limit) & 0xFF));
        final int dataOffset = limit + headerLength;

        parentMessage.limit(dataOffset + dataLength);
        buffer.getStringWithoutLengthAscii(dataOffset, dataLength, appendable);

        return dataLength;
    }

    public static int memoId()
    {
        return 5149;
    }

    public static int memoSinceVersion()
    {
        return 0;
    }

    public static String memoCharacterEncoding()
    {
        return java.nio.charset.StandardCharsets.UTF_8.name();
    }

    public static String memoMetaAttribute(final MetaAttribute metaAttribute)
    {
        if (MetaAttribute.PRESENCE == metaAttribute)
        {
            return "required";
        }
        if (MetaAttribute.SEMANTIC_TYPE == metaAttribute)
        {
            return "String";
        }

        return "";
    }

    public static int memoHeaderLength()
    {
        return 1;
    }

    public int memoLength()
    {
        final int limit = parentMessage.limit();
        return ((short)(buffer.getByte(limit) & 0xFF));
    }

    public int skipMemo()
    {
        final int headerLength = 1;
        final int limit = parentMessage.limit();
        final int dataLength = ((short)(buffer.getByte(limit) & 0xFF));
        final int dataOffset = limit + headerLength;
        parentMessage.limit(dataOffset + dataLength);

        return dataLength;
    }

    public int getMemo(final MutableDirectBuffer dst, final int dstOffset, final int length)
    {
        final int headerLength = 1;
        final int limit = parentMessage.limit();
        final int dataLength = ((short)(buffer.getByte(limit) & 0xFF));
        final int bytesCopied = Math.min(length, dataLength);
        parentMessage.limit(limit + headerLength + dataLength);
        buffer.getBytes(limit + headerLength, dst, dstOffset, bytesCopied);

        return bytesCopied;
    }

    public int getMemo(final byte[] dst, final int dstOffset, final int length)
    {
        final int headerLength = 1;
        final int limit = parentMessage.limit();
        final int dataLength = ((short)(buffer.getByte(limit) & 0xFF));
        final int bytesCopied = Math.min(length, dataLength);
        parentMessage.limit(limit + headerLength + dataLength);
        buffer.getBytes(limit + headerLength, dst, dstOffset, bytesCopied);

        return bytesCopied;
    }

    public void wrapMemo(final DirectBuffer wrapBuffer)
    {
        final int headerLength = 1;
        final int limit = parentMessage.limit();
        final int dataLength = ((short)(buffer.getByte(limit) & 0xFF));
        parentMessage.limit(limit + headerLength + dataLength);
        wrapBuffer.wrap(buffer, limit + headerLength, dataLength);
    }

    public String memo()
    {
        final int headerLength = 1;
        final int limit = parentMessage.limit();
        final int dataLength = ((short)(buffer.getByte(limit) & 0xFF));
        parentMessage.limit(limit + headerLength + dataLength);

        if (0 == dataLength)
        {
            return "";
        }

        final byte[] tmp = new byte[dataLength];
        buffer.getBytes(limit + headerLength, tmp, 0, dataLength);

        return new String(tmp, java.nio.charset.StandardCharsets.UTF_8);
    }

    public String toString()
    {
        if (null == buffer)
        {
            return "";
        }

        final AllocationInstructionDecoder decoder = new AllocationInstructionDecoder();
        decoder.wrap(buffer, offset, actingBlockLength, actingVersion);

        return decoder.appendTo(new StringBuilder()).toString();
    }

    public StringBuilder appendTo(final StringBuilder builder)
    {
        if (null == buffer)
        {
            return builder;
        }

        final int originalLimit = limit();
        limit(offset + actingBlockLength);
        builder.append("[AllocationInstruction](sbeTemplateId=");
        builder.append(TEMPLATE_ID);
        builder.append("|sbeSchemaId=");
        builder.append(SCHEMA_ID);
        builder.append("|sbeSchemaVersion=");
        if (parentMessage.actingVersion != SCHEMA_VERSION)
        {
            builder.append(parentMessage.actingVersion);
            builder.append('/');
        }
        builder.append(SCHEMA_VERSION);
        builder.append("|sbeBlockLength=");
        if (actingBlockLength != BLOCK_LENGTH)
        {
            builder.append(actingBlockLength);
            builder.append('/');
        }
        builder.append(BLOCK_LENGTH);
        builder.append("):");
        builder.append("messageType=");
        builder.append(this.messageType());
        builder.append('|');
        builder.append("allocID=");
        builder.append(this.allocID());
        builder.append('|');
        builder.append("securityID=");
        builder.append(this.securityID());
        builder.append('|');
        builder.append("quantity=");
        builder.append(this.quantity());
        builder.append('|');
        builder.append("senderLocation=");
        for (int i = 0; i < senderLocationLength() && this.senderLocation(i) > 0; i++)
        {
            builder.append((char)this.senderLocation(i));
        }
        builder.append('|');
        builder.append("enteringTrader=");
        for (int i = 0; i < enteringTraderLength() && this.enteringTrader(i) > 0; i++)
        {
            builder.append((char)this.enteringTrader(i));
        }
        builder.append('|');
        builder.append("tradeDate=");
        builder.append(this.tradeDate());
        builder.append('|');
        builder.append("allocTransType=");
        builder.append(this.allocTransType());
        builder.append('|');
        builder.append("allocType=");
        builder.append(this.allocType());
        builder.append('|');
        builder.append("allocNoOrdersType=");
        builder.append(this.allocNoOrdersType());
        builder.append('|');
        builder.append("side=");
        builder.append(this.side());
        builder.append('|');
        builder.append("noExecs=[");
        final int noExecsOriginalOffset = noExecs.offset;
        final int noExecsOriginalIndex = noExecs.index;
        final NoExecsDecoder noExecs = this.noExecs();
        if (noExecs.count() > 0)
        {
            while (noExecs.hasNext())
            {
                noExecs.next().appendTo(builder);
                builder.append(',');
            }
            builder.setLength(builder.length() - 1);
        }
        noExecs.offset = noExecsOriginalOffset;
        noExecs.index = noExecsOriginalIndex;
        builder.append(']');
        builder.append('|');
        builder.append("noAllocs=[");
        final int noAllocsOriginalOffset = noAllocs.offset;
        final int noAllocsOriginalIndex = noAllocs.index;
        final NoAllocsDecoder noAllocs = this.noAllocs();
        if (noAllocs.count() > 0)
        {
            while (noAllocs.hasNext())
            {
                noAllocs.next().appendTo(builder);
                builder.append(',');
            }
            builder.setLength(builder.length() - 1);
        }
        noAllocs.offset = noAllocsOriginalOffset;
        noAllocs.index = noAllocsOriginalIndex;
        builder.append(']');
        builder.append('|');
        builder.append("deskID=");
        builder.append('\'');
        getDeskID(builder);
        builder.append('\'');
        builder.append('|');
        builder.append("memo=");
        builder.append('\'').append(memo()).append('\'');

        limit(originalLimit);

        return builder;
    }
    
    public AllocationInstructionDecoder sbeSkip()
    {
        sbeRewind();
        NoExecsDecoder noExecs = this.noExecs();
        if (noExecs.count() > 0)
        {
            while (noExecs.hasNext())
            {
                noExecs.next();
                noExecs.sbeSkip();
            }
        }
        NoAllocsDecoder noAllocs = this.noAllocs();
        if (noAllocs.count() > 0)
        {
            while (noAllocs.hasNext())
            {
                noAllocs.next();
                noAllocs.sbeSkip();
            }
        }
        skipDeskID();
        skipMemo();

        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy