com.epam.fix.message
Class IndexedStorage

java.lang.Object
  extended by 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.


Nested Class Summary
static class IndexedStorage.MISSING_TAG_HANDLING
           
 
Field Summary
protected static char FIELD_SEPARATOR
           
static int NOTFOUND
           
 
Constructor Summary
IndexedStorage(int initialSize)
           
 
Method Summary
 int addTag(int tagId, byte value)
           
 int addTag(int tagId, byte[] value, int offset, int length)
           
 int addTag(int tagId, Calendar value, FIXDateFormatterFactory.FIX_DATE_TYPE type)
           
 int addTag(int tagId, char value)
           
 int addTag(int tagId, CharSequence value)
           
 int addTag(int tagId, double value, int precision)
           
 int addTag(int tagId, long value)
           
 int addTagAtIndex(int addAtIndex, int tagId, byte value)
           
 int addTagAtIndex(int addAtIndex, int tagId, byte[] value, int offset, int length)
           
 int addTagAtIndex(int index, int tagId, Calendar value, FIXDateFormatterFactory.FIX_DATE_TYPE type)
           
 int addTagAtIndex(int addAtIndex, int tagId, char value)
           
 int addTagAtIndex(int index, int tagId, CharSequence value)
           
 int addTagAtIndex(int index, int tagId, double value, int precision)
           
 int addTagAtIndex(int index, int tagId, long value)
           
protected  boolean canCopyInPlace(int index, int oldLen, int length)
           
protected  boolean canCopyInPlaceNumber(int index, int oldLen, int length)
           
 void clear()
           
protected  void deepCopy(IndexedStorage source)
           
protected  void ensureCapacity(int minCapacity)
           
protected  void ensureCapacityAndEnlarge()
           
protected  boolean ensureCapacityAndEnlarge(int ratio)
           
protected  void fillSubStorage(int fromIndex, int toIndex, IndexedStorage subStorage)
           
protected  int findOrPrepareToAdd(int tag, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
           
protected  int findOrPrepareToAdd(int tag, int occurrence, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
           
protected  int genericMessageToByteArrayAndReturnNextPosition(byte[] dst, int offset)
           
protected  FieldIndexData getFieldIndexData()
           
protected  int getIndexCapacity()
           
 int getRawLength()
           
 int getSize()
           
protected  MessageStorage getStorage(int index)
           
protected  int getStorageType(int index)
           
 void getTag(int tagId, TagValue dest)
           
 void getTag(int tagId, TagValue dest, int occurrence)
           
 void getTagAtIndex(int index, TagValue dest)
           
 int getTagIdAtIndex(int index)
           
 int getTagIndex(int tag)
           
 int getTagIndex(int tag, int occurrence)
           
 int getTagIndexBetween(int tag, int startIndex, int endIndex)
           
 int getTagIndexStartingFrom(int tag, int fromIndex)
           
 boolean getTagValueAsBoolAtIndex(int index)
           
 byte getTagValueAsByteAtIndex(int index, int offset)
           
 byte[] getTagValueAsBytesAtIndex(int index)
           
 int getTagValueAsBytesAtIndex(int index, byte[] dest, int offset)
           
 double getTagValueAsDoubleAtIndex(int index)
           
 long getTagValueAsLongAtIndex(int index)
           
 String getTagValueAsStringAtIndex(int index)
           
 void getTagValueAsStringBuffAtIndex(int index, StringBuffer str)
           
 int getTagValueLength(int tagId)
           
 int getTagValueLength(int tagId, int occurrence)
           
 int getTagValueLengthAtIndex(int index)
           
protected  int getTagValueOffsetAtIndex(int index)
           
 int hashCode()
           
protected  boolean isAllTagsInOneBuffer()
           
 boolean isTagExists(int tag)
           
 boolean isTagExists(int tag, int occurrence)
           
protected  int mapTagInOrigStorage(int tag, int offset, int length)
           
protected  void onEnlarge(int ratio, int newSize)
           
protected  int preparedToByteArrayAndReturnNextPosition(byte[] dst, int offset)
           
protected  int preparedToByteArrayAndReturnNextPosition2(byte[] dst, int offset)
           
 boolean removeTag(int tag)
          Removes a fix field with specified tag from collection.
 boolean removeTag(int tag, int occurrence)
           
 boolean removeTagAtIndex(int tagIndex)
           
protected  int reserveTagAtIndex(int addAtIndex, int tagId)
           
protected  void setOriginalBuffer(byte[] buf, int offset, int length)
           
 int toByteArrayAndReturnNextPosition(byte[] dst, int offset, int[] excludedFields)
           
protected  void transferDataToArena()
           
 int updateValue(int tag, boolean value, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
           
 int updateValue(int tagId, byte[] value, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
           
 int updateValue(int tag, byte[] value, int offset, int length, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
           
 int updateValue(int tag, Calendar value, FIXDateFormatterFactory.FIX_DATE_TYPE type, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
           
 int updateValue(int tag, CharSequence strBuffer, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
           
 int updateValue(int tag, double value, int precision, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
           
 int updateValue(int tag, int occurrence, boolean value, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
           
 int updateValue(int tagId, int occurrence, byte[] value, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
           
 int updateValue(int tag, int occurrence, byte[] value, int offset, int length, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
           
 int updateValue(int tag, int occurrence, Calendar value, FIXDateFormatterFactory.FIX_DATE_TYPE type, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
           
 int updateValue(int tag, int occurrence, CharSequence strBuffer, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
           
 int updateValue(int tag, int occurrence, double value, int precision, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
           
 int updateValue(int tag, int occurrence, long value, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
           
 int updateValue(int tag, long value, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
           
 int updateValue(TagValue value, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
           
 int updateValue(TagValue value, int occurrence, IndexedStorage.MISSING_TAG_HANDLING addIfNotExists)
           
 void updateValueAtIndex(int tagIndex, boolean value)
           
 void updateValueAtIndex(int index, byte[] value)
           
 void updateValueAtIndex(int tagIndex, byte[] value, int offset, int length)
           
 void updateValueAtIndex(int index, Calendar value, FIXDateFormatterFactory.FIX_DATE_TYPE type)
           
 void updateValueAtIndex(int tagIndex, CharSequence str)
           
 void updateValueAtIndex(int index, double value, int precision)
           
 void updateValueAtIndex(int index, long value)
           
 void updateValueAtIndex(int tagIndex, TagValue value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIELD_SEPARATOR

protected static final char FIELD_SEPARATOR
See Also:
Constant Field Values

NOTFOUND

public static final int NOTFOUND
See Also:
Constant Field Values
Constructor Detail

IndexedStorage

public IndexedStorage(int initialSize)
Method Detail

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 tagId,
                        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 tagId,
                        long value)

addTagAtIndex

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

addTag

public final int addTag(int tagId,
                        double value,
                        int precision)

addTagAtIndex

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

addTag

public final int addTag(int tagId,
                        CharSequence value)

addTagAtIndex

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

addTag

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

addTagAtIndex

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

reserveTagAtIndex

protected int reserveTagAtIndex(int addAtIndex,
                                int tagId)

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

getTagValueAsLongAtIndex

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

getTagValueAsStringBuffAtIndex

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

getTagValueAsStringAtIndex

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

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 tagId,
                             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)

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)

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 methods 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)

deepCopy

protected void deepCopy(IndexedStorage source)

ensureCapacity

protected void ensureCapacity(int minCapacity)

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)

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)

getStorage

protected MessageStorage getStorage(int index)

getStorageType

protected int getStorageType(int index)


Copyright © 2000-2014 EPAM Systems. All Rights Reserved.