Class IndexedStorage

java.lang.Object
com.epam.fix.message.IndexedStorage
Direct Known Subclasses:
ExtendedIndexedStorage

public class IndexedStorage extends Object
Created with IntelliJ IDEA. User: wed Date: 29.10.12 Time: 15:57 To change this template use File | Settings | File Templates.
  • Field Details

  • Constructor Details

    • IndexedStorage

      public IndexedStorage(int initialSize)
  • Method Details

    • addTag

      public final int addTag(int tagId, byte value)
    • addTagAtIndex

      public final int addTagAtIndex(int addAtIndex, int tagId, byte value)
    • addTag

      public final int addTag(int tagId, char value)
    • addTagAtIndex

      public final int addTagAtIndex(int addAtIndex, int tagId, char value)
    • addTag

      public final int addTag(int tag, byte[] value, int offset, int length)
    • addTagAtIndex

      public final int addTagAtIndex(int addAtIndex, int tagId, byte[] value, int offset, int length)
    • addTag

      public final int addTag(int tag, long value)
    • addTagAtIndex

      public final int addTagAtIndex(int index, int tagId, long value)
    • addTagAtIndex

      public final int addTagAtIndex(int index, int tagId, long value, boolean shiftRG)
    • addTagAtIndexForRg

      protected final int addTagAtIndexForRg(int index, int tagId, long value, int rgId)
    • addTag

      public final int addTag(int tag, double value, int precision)
    • addTagAtIndex

      public final int addTagAtIndex(int index, int tagId, double value, int precision)
    • addTag

      public final int addTag(int tag, CharSequence value)
    • addTagAtIndex

      public final int addTagAtIndex(int index, int tagId, CharSequence value)
    • addTag

      public final int addTag(int tag, Calendar value, FIXDateFormatterFactory.FIX_DATE_TYPE type)
    • addTagAtIndex

      public final int addTagAtIndex(int index, int tagId, Calendar value, FIXDateFormatterFactory.FIX_DATE_TYPE type)
    • addTag

      public final int addTag(int tag, LocalTime value, TimestampPrecision precision)
    • addTagAtIndex

      public final int addTagAtIndex(int index, int tagId, LocalTime value, TimestampPrecision precision)
    • addTag

      public final int addTag(int tag, Period value)
    • addTag

      public final int addTag(int tag, Period value, TenorPrecision precision)
    • addTagAtIndex

      public final int addTagAtIndex(int index, int tagId, Period value, TenorPrecision precision)
    • addTag

      public final int addTag(int tag, OffsetTime value, TimestampPrecision precision)
    • addTagAtIndex

      public final int addTagAtIndex(int index, int tagId, OffsetTime value, TimestampPrecision precision)
    • addTag

      public final int addTag(int tag, LocalDateTime value, TimestampPrecision precision)
    • addTagAtIndex

      public final int addTagAtIndex(int index, int tagId, LocalDateTime value, TimestampPrecision precision)
    • addTag

      public final int addTag(int tag, OffsetDateTime value, TimestampPrecision precision)
    • addTagAtIndex

      public final int addTagAtIndex(int index, int tagId, OffsetDateTime value, TimestampPrecision precision)
    • reserveTagAtIndexForRg

      protected int reserveTagAtIndexForRg(int addAtIndex, int tagId, int rgId)
    • reserveTagAtIndex

      public int reserveTagAtIndex(int addAtIndex, int tagId)
    • reserveTagAtIndex

      public int reserveTagAtIndex(int addAtIndex, int tagId, boolean shiftRG)
    • getTag

      public final void getTag(int tagId, TagValue dest) throws FieldNotFoundException
      Throws:
      FieldNotFoundException
    • getTag

      public final void getTag(int tagId, TagValue dest, int occurrence) throws FieldNotFoundException
      Throws:
      FieldNotFoundException
    • getTagAtIndex

      public final void getTagAtIndex(int index, TagValue dest) throws FieldNotFoundException
      Throws:
      FieldNotFoundException
    • getTagValueAsBytesAtIndex

      public final byte[] getTagValueAsBytesAtIndex(int index) throws FieldNotFoundException
      Throws:
      FieldNotFoundException
    • getTagValueAsBytesAtIndex

      public final int getTagValueAsBytesAtIndex(int index, byte[] dest, int offset) throws FieldNotFoundException
      Throws:
      FieldNotFoundException
    • getTagValueAsByteAtIndex

      public final byte getTagValueAsByteAtIndex(int index, int offset) throws FieldNotFoundException
      Throws:
      FieldNotFoundException
    • getTagValueAsBoolAtIndex

      public final boolean getTagValueAsBoolAtIndex(int index) throws FieldNotFoundException
      Throws:
      FieldNotFoundException
    • getTagValueAsDoubleAtIndex

      public final double getTagValueAsDoubleAtIndex(int index) throws FieldNotFoundException
      Throws:
      FieldNotFoundException
    • getTagValueAsBigDecimalAtIndex

      public final BigDecimal getTagValueAsBigDecimalAtIndex(int index) throws FieldNotFoundException
      Throws:
      FieldNotFoundException
    • getTagValueAsLongAtIndex

      public final long getTagValueAsLongAtIndex(int index) throws FieldNotFoundException
      Throws:
      FieldNotFoundException
    • getTagValueAsStringBuffAtIndex

      public final void getTagValueAsStringBuffAtIndex(int index, StringBuffer str) throws FieldNotFoundException
      Throws:
      FieldNotFoundException
    • getTagValueAsReusableStringAtIndex

      public final void getTagValueAsReusableStringAtIndex(ReusableString reusableString, int index) throws FieldNotFoundException
      Throws:
      FieldNotFoundException
    • getTagValueAsStringAtIndex

      public String getTagValueAsStringAtIndex(int index) throws FieldNotFoundException
      Throws:
      FieldNotFoundException
    • getTagValueAtIndex

      public final void getTagValueAtIndex(int index, ByteBuffer destination)
    • updateValue

      public final int updateValue(int tag, byte[] value, int offset, int length, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValue

      public final int updateValue(int tag, int occurrence, byte[] value, int offset, int length, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValueAtIndex

      public void updateValueAtIndex(int tagIndex, byte[] value, int offset, int length)
    • updateValue

      public final int updateValue(int tag, byte[] value, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValue

      public final int updateValue(int tagId, int occurrence, byte[] value, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValueAtIndex

      public void updateValueAtIndex(int index, byte[] value)
    • updateValue

      public final int updateValue(int tag, long value, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValue

      public final int updateValue(int tag, int occurrence, long value, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValueAtIndex

      public void updateValueAtIndex(int index, long value)
    • updateValue

      public final int updateValue(int tag, double value, int precision, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValue

      public final int updateValue(int tag, int occurrence, double value, int precision, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValueAtIndex

      public void updateValueAtIndex(int index, double value, int precision)
    • updateValue

      public final int updateValue(int tag, CharSequence strBuffer, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValue

      public final int updateValue(int tag, int occurrence, CharSequence strBuffer, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValueAtIndex

      public void updateValueAtIndex(int tagIndex, CharSequence str)
    • updateValue

      public final int updateValue(int tag, boolean value, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValue

      public final int updateValue(int tag, int occurrence, boolean value, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValueAtIndex

      public void updateValueAtIndex(int tagIndex, boolean value)
    • updateValue

      public final int updateValue(TagValue value, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValue

      public final int updateValue(TagValue value, int occurrence, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValueAtIndex

      public void updateValueAtIndex(int tagIndex, TagValue value)
    • updateValue

      public final int updateValue(int tag, Calendar value, FIXDateFormatterFactory.FIX_DATE_TYPE type, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValue

      public final int updateValue(int tag, int occurrence, Calendar value, FIXDateFormatterFactory.FIX_DATE_TYPE type, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValueAtIndex

      public void updateValueAtIndex(int index, Calendar value, FIXDateFormatterFactory.FIX_DATE_TYPE type)
    • updateValue

      public final int updateValue(int tag, LocalTime value, TimestampPrecision precision, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValue

      public final int updateValue(int tag, int occurrence, LocalTime value, TimestampPrecision precision, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValueAtIndex

      public void updateValueAtIndex(int index, LocalTime value, TimestampPrecision precision)
    • updateValue

      public final int updateValue(int tag, Period value, TenorPrecision precision, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValue

      public final int updateValue(int tag, int occurrence, Period value, TenorPrecision precision, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValueAtIndex

      public void updateValueAtIndex(int index, Period value, TenorPrecision precision)
    • updateValue

      public final int updateValue(int tag, OffsetTime value, TimestampPrecision precision, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValue

      public final int updateValue(int tag, int occurrence, OffsetTime value, TimestampPrecision precision, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValueAtIndex

      public void updateValueAtIndex(int index, OffsetTime value, TimestampPrecision precision)
    • updateValue

      public final int updateValue(int tag, LocalDateTime value, TimestampPrecision precision, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValue

      public final int updateValue(int tag, int occurrence, LocalDateTime value, TimestampPrecision precision, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValueAtIndex

      public void updateValueAtIndex(int index, LocalDateTime value, TimestampPrecision precision)
    • updateValue

      public final int updateValue(int tag, OffsetDateTime value, TimestampPrecision precision, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValue

      public final int updateValue(int tag, int occurrence, OffsetDateTime value, TimestampPrecision precision, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • updateValueAtIndex

      public void updateValueAtIndex(int index, OffsetDateTime value, TimestampPrecision precision)
    • isTagExists

      public boolean isTagExists(int tag)
    • isTagExists

      public boolean isTagExists(int tag, int occurrence)
    • getTagIndex

      public int getTagIndex(int tag)
    • getTagIndex

      public int getTagIndex(int tag, int occurrence)
    • getTagIndexStartingFrom

      public final int getTagIndexStartingFrom(int tag, int fromIndex)
    • getTagIndexBetween

      public final int getTagIndexBetween(int tag, int startIndex, int endIndex)
    • getTagIdAtIndex

      public int getTagIdAtIndex(int index)
    • getTagValueLengthAtIndex

      public int getTagValueLengthAtIndex(int index)
    • getTagValueOffsetAtIndex

      protected int getTagValueOffsetAtIndex(int index)
    • getTagValueLength

      public int getTagValueLength(int tagId)
    • getTagValueLength

      public int getTagValueLength(int tagId, int occurrence)
    • getNumOfGroup

      public int getNumOfGroup()
    • getSize

      public int getSize()
    • getRawLength

      public final int getRawLength()
    • getFieldIndexData

      protected FieldIndexData getFieldIndexData()
    • isAllTagsInOneBuffer

      protected boolean isAllTagsInOneBuffer()
    • fillSubStorage

      protected void fillSubStorage(int fromIndex, int toIndex, IndexedStorage subStorage)
    • clear

      public void clear()
    • removeTag

      public boolean removeTag(int tag)
      Removes a fix field with specified tag from collection. The method removes the first occurrence of the specified tag.
      Parameters:
      tag - the fix tag.
      Returns:
      true if the element was removed.
    • removeTag

      public boolean removeTag(int tag, int occurrence)
    • removeTagAtIndex

      public boolean removeTagAtIndex(int tagIndex)
    • removeTagAtIndex

      public boolean removeTagAtIndex(int tagIndex, boolean shiftRG)
    • deepCopy

      protected void deepCopy(IndexedStorage source)
    • ensureCapacityAndEnlarge

      protected void ensureCapacityAndEnlarge()
    • ensureCapacityAndEnlarge

      protected boolean ensureCapacityAndEnlarge(int ratio)
    • onEnlarge

      protected void onEnlarge(int ratio, int newSize)
    • getIndexCapacity

      protected int getIndexCapacity()
    • toByteArrayAndReturnNextPosition

      public final int toByteArrayAndReturnNextPosition(byte[] dst, int offset, int[] excludedFields)
    • genericMessageToByteArrayAndReturnNextPosition

      protected int genericMessageToByteArrayAndReturnNextPosition(byte[] dst, int offset)
    • preparedToByteArrayAndReturnNextPosition

      protected int preparedToByteArrayAndReturnNextPosition(byte[] dst, int offset)
    • preparedToByteArrayAndReturnNextPosition2

      protected int preparedToByteArrayAndReturnNextPosition2(byte[] dst, int offset)
    • setOriginalBuffer

      protected void setOriginalBuffer(byte[] buf, int offset, int length)
    • transferDataToArena

      protected void transferDataToArena()
    • mapTagInOrigStorage

      protected int mapTagInOrigStorage(int tag, int offset, int length)
    • mapPreparedTagInOrigStorage

      protected int mapPreparedTagInOrigStorage(int tag, int offset, int length)
    • getRepeatingGroup

      public void getRepeatingGroup(int leadingTag, RepeatingGroup group)
      Fills passed repeating group instance by data from storage. If group doesn't exist, throws exception.
      Parameters:
      leadingTag - leading tag for repeating group
      group - repeating group object for fill
    • getRepeatingGroup

      public RepeatingGroup getRepeatingGroup(int leadingTag)
      Returns repeating group from storage by leading tag. If group doesn't exist, returns null.
      Parameters:
      leadingTag - leading tag for repeating group
      Returns:
      instance of RepeatingGroup from RepeatingGroupPool. There is no need to call release for this object.
    • getOrAddRepeatingGroup

      public RepeatingGroup getOrAddRepeatingGroup(int leadingTag)
      Returns repeating group from storage by leading tag. If group doesn't exist, add group at end of message.
      Parameters:
      leadingTag - leading tag for repeating group
      Returns:
      instance of RepeatingGroup from RepeatingGroupPool. There is no need to call release for this object.
    • getOrAddRepeatingGroup

      public void getOrAddRepeatingGroup(int leadingTag, RepeatingGroup group)
      Fills passed repeating group instance by data from storage. If group doesn't exist, add group at end of of message
      Parameters:
      leadingTag - leading tag for repeating group
      group - repeating group object for fill
    • getOrAddRepeatingGroupAtIndex

      public RepeatingGroup getOrAddRepeatingGroupAtIndex(int leadingTag, int index)
      Returns repeating group from storage by leading tag. If group doesn't exist, add group at passed index in message.
      Parameters:
      leadingTag - leading tag for repeating group
      Returns:
      instance of RepeatingGroup from RepeatingGroupPool. There is no need to call release for this object.
    • getOrAddRepeatingGroupAtIndex

      public void getOrAddRepeatingGroupAtIndex(int leadingTag, int index, RepeatingGroup group)
      Returns repeating group from storage by leading tag. If group doesn't exist, add group at passed index in message.
      Parameters:
      leadingTag - leading tag for repeating group
    • getRepeatingGroupAtIndex

      public RepeatingGroup getRepeatingGroupAtIndex(int index)
      Returns repeating group, founded by index of leading tag
      Parameters:
      index - index of repeating group's leading tag at message
      Returns:
      instance of RepeatingGroup from RepeatingGroupPool. There is no need to call release for this object.
    • getRepeatingGroupAtIndex

      public void getRepeatingGroupAtIndex(int index, RepeatingGroup group)
      Fills passed repeating group instance by data, founded by index of leading tag
      Parameters:
      index - leading tag for repeating group
      group - repeating group object for fill
    • isRepeatingGroupExists

      public boolean isRepeatingGroupExists(int leadingTag)
      Checks is message contains not nested group with passed leading tag. Note that empty groups, that doesn't appear in the message, also considered existing
      Parameters:
      leadingTag - leading tag for check
      Returns:
      true if repeating group exists.
    • removeRepeatingGroup

      public boolean removeRepeatingGroup(int leadingTag)
      Removes repeating group with specified leading tag
      Parameters:
      leadingTag - leading tag of group
      Returns:
      true if there is group with specified leading tag
    • removeRepeatingGroupAtIndex

      public boolean removeRepeatingGroupAtIndex(int index)
      Removes repeating group with leading tag at specified index
      Parameters:
      index - of repeating group's leading tag
      Returns:
      true if there is group with specified leading tag
    • invalidateRepeatingGroupIndex

      public void invalidateRepeatingGroupIndex()
      Returns all inner arrays, RepeatingGroup and Entry back to pool. It returns only those RepeatingGroup and Entry, that have been got implicitly from addRepeatingGroup/getRepeatingGroup. If you got RepeatingGroup or Entry explicit from RepeatingGroupPool, you should take care of call release. Also this method implicitly calls in FIXFieldList.releaseInstance().
    • addRepeatingGroup

      public void addRepeatingGroup(int leadingTag, RepeatingGroup group)
      Adds group without validation at the end of message. Trailer is ignored.
      Parameters:
      leadingTag - leading tag for new group
      group - repeating group object for further work with group
    • addRepeatingGroup

      public RepeatingGroup addRepeatingGroup(int leadingTag)
      Adds group without validation at the end of message. Trailer is ignored. Repeating
      Parameters:
      leadingTag - leading tag for new group
      Returns:
      instance of RepeatingGroup from RepeatingGroupPool. There is no need to call release for this object.
    • addRepeatingGroup

      public RepeatingGroup addRepeatingGroup(int leadingTag, boolean validation)
      Adds group at the end of message. Trailer is ignored.
      Parameters:
      leadingTag - leading tag for new group
      validation - turn on/off validation
      Returns:
      instance of RepeatingGroup from RepeatingGroupPool. There is no need to call release for this object.
    • addRepeatingGroup

      public void addRepeatingGroup(int leadingTag, boolean validation, RepeatingGroup group)
      Adds group without validation at the end of message. Trailer is ignored.
      Parameters:
      leadingTag - leading tag for new group
      group - repeating group object for further work with group
    • addRepeatingGroupAtIndex

      public void addRepeatingGroupAtIndex(int index, int leadingTag, boolean validation, RepeatingGroup group)
      Adds group at specific place at message
      Parameters:
      index - index in FIX message. Leading tag will be inserted at this index and all other group tags will follow.
      leadingTag - leading tag for new group
      validation - turn on/off validation
      group - repeating group object for further work with group
    • addRepeatingGroupAtIndex

      public RepeatingGroup addRepeatingGroupAtIndex(int index, int leadingTag, boolean validation)
      Adds group at specific place at message
      Parameters:
      index - index in FIX message. Leading tag will be inserted at this index and all other group tags will follow.
      leadingTag - leading tag for new group
      validation - turn on/off validation
      Returns:
      instance of RepeatingGroup from RepeatingGroupPool. There is no need to call release for this object.
    • addRepeatingGroupAtIndex

      public RepeatingGroup addRepeatingGroupAtIndex(int index, int leadingTag)
      Adds group at specific place at message
      Parameters:
      index - index in FIX message. Leading tag will be inserted at this index and all other group tags will follow.
      leadingTag - leading tag for new group
      Returns:
      instance of RepeatingGroup from RepeatingGroupPool. There is no need to call release for this object.
    • addRepeatingGroupAtIndex

      public void addRepeatingGroupAtIndex(int index, int leadingTag, RepeatingGroup group)
      Adds group at specific place at message
      Parameters:
      index - index in FIX message. Leading tag will be inserted at this index and all other group tags will follow.
      leadingTag - leading tag for new group
      group - repeating group object for further work with group
    • copyRepeatingGroup

      public RepeatingGroup copyRepeatingGroup(RepeatingGroup source)
      Copy repeating group at end of message
      Parameters:
      source - repeating group for copy
      Returns:
      copied repeating group
    • copyRepeatingGroup

      public RepeatingGroup copyRepeatingGroup(RepeatingGroup source, int index)
      Copy repeating group at specified index of message
      Parameters:
      source - repeating group for copy
      index - index at which the source entry is to be copied
      Returns:
      copied repeating group
    • copyRepeatingGroup

      public void copyRepeatingGroup(RepeatingGroup source, RepeatingGroup dest)
      Copy repeating group at end of message
      Parameters:
      source - repeating group for copy
      dest - entry for hold copied repeating group
    • copyRepeatingGroup

      public void copyRepeatingGroup(RepeatingGroup source, RepeatingGroup dest, int index)
      Copy repeating group at specified index of message
      Parameters:
      source - repeating group for copy
      dest - entry for hold copied repeating group
      index - index at which the source entry is to be copied
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • findOrPrepareToAdd

      protected int findOrPrepareToAdd(int tag, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
      Parameters:
      tag -
      addIfNotExists -
      Returns:
      index of tag
    • findOrPrepareToAdd

      protected int findOrPrepareToAdd(int tag, int occurrence, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
    • canCopyInPlaceNumber

      protected boolean canCopyInPlaceNumber(int index, int oldLen, int length)
    • canCopyInPlace

      protected boolean canCopyInPlace(int index, int oldLen, int length)
    • canCopyInPlaceWithLengthReducing

      protected boolean canCopyInPlaceWithLengthReducing(int index, int oldLen, int length)
    • getStorage

      protected MessageStorage getStorage(int index)
    • getStorageType

      protected int getStorageType(int index)
    • getFIXVersion

      public com.epam.fixengine.configuration.FIXVersionContainer getFIXVersion()
    • markUnserializableTag

      public final void markUnserializableTag(int tag)
    • clearUnserializableTags

      public final void clearUnserializableTags()