com.teraspaces.qwfix
Class FIXTagCollection

java.lang.Object
  extended by com.teraspaces.qwfix.FIXTagCollection

public final class FIXTagCollection
extends Object

Represents a collection of FIX tags. This class cannot be inherited.


Field Summary
static FIXTagCollection EMPTY
          The EMPTY collection.
 
Constructor Summary
FIXTagCollection(int[] data)
          Instantiates a new fIX tag collection.
 
Method Summary
 FIXTagCollection add(int tag)
          Adds the specified tag to the collection.
 boolean contains(int tag)
          Determines whether the collection contains the specified tag.
 boolean equals(Object obj)
           
 FIXTagCollection exclude(FIXTagCollection c)
          Removes the specified collection from the collection.
 FIXTagCollection exclude(int[] c)
          Removes the specified collection from the collection.
static FIXTagCollection fromSchema(FIXSchemaMessageFieldCollection schema)
          Generates an instance of FIXTagCollection from part of a message schema.
static FIXTagCollection fromSchema(FIXSchemaMessageFieldCollection schema, int tag)
          Generates an instance of FIXTagCollection from part of a message schema and a tag.
static FIXTagCollection fromSchema(FIXSchemaMessageFieldCollection schema, int[] tags)
          Generates an instance of FIXTagCollection from part of a message schema and an array of tags.
static FIXTagCollection fromXml(Element e)
          Conversion.
 int get(int index)
          Gets the tag at the specified index.
 FIXTagCollection intersect(FIXTagCollection c)
          Calculates the intersection of two collections.
 FIXTagCollection intersect(int[] c)
          Calculates the intersection of two collections.
 boolean isEmpty()
          Gets a value indicating whether this tag list is empty.
 FIXTagCollection remove(int tag)
          Removes the specified tag from the collection.
 int size()
          Gets the count of tags in collection.
 int[] toArray()
          Conversion.
 void toXml(Element e)
          To xml.
 FIXTagCollection union(FIXTagCollection c)
          Calculates the union of two collections.
 FIXTagCollection union(int[] c)
          Calculates the union of two collections.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY

public static final FIXTagCollection EMPTY
The EMPTY collection.

Constructor Detail

FIXTagCollection

public FIXTagCollection(int[] data)
Instantiates a new fIX tag collection.

Parameters:
data - the list of tags
Method Detail

isEmpty

public boolean isEmpty()
Gets a value indicating whether this tag list is empty.

Returns:
true if this tag list is empty; otherwise, false

contains

public boolean contains(int tag)
Determines whether the collection contains the specified tag.

If count of tags in collection is less than 25, a linear search is performed; otherwise, it searches the hash table.

Parameters:
tag - the tag
Returns:
true if the collection contains the specified tag; otherwise, false

size

public int size()
Gets the count of tags in collection.

Returns:
the count

get

public int get(int index)
Gets the tag at the specified index.

Parameters:
index - the index
Returns:
the tag

add

public FIXTagCollection add(int tag)
Adds the specified tag to the collection.

If the tag is already contained in the current collection, the current collection is returned.

Parameters:
tag - the tag
Returns:
A new FIXTagCollection that is equivalent to this collection with the new tag.

remove

public FIXTagCollection remove(int tag)
Removes the specified tag from the collection.

If the tag is not contained in the current collection, the current collection is returned.

Parameters:
tag - the tag
Returns:
A new FIXTagCollection that is equivalent to this collection less the tag specified.

exclude

public FIXTagCollection exclude(FIXTagCollection c)
Removes the specified collection from the collection.

Parameters:
c - the collection of tags to be excluded
Returns:
a new FIXTagCollection that is equivalent to this collection excluding the specified collection

exclude

public FIXTagCollection exclude(int[] c)
Removes the specified collection from the collection.

Parameters:
c - the collection of tags to be excluded
Returns:
a new FIXTagCollection that is equivalent to this collection excluding the specified collection

intersect

public FIXTagCollection intersect(FIXTagCollection c)
Calculates the intersection of two collections.

Parameters:
c - the collection of tags to be interacted
Returns:
a new FIXTagCollection that is equivalent to the intersect

intersect

public FIXTagCollection intersect(int[] c)
Calculates the intersection of two collections.

Parameters:
c - the collection of tags to be interacted
Returns:
a new FIXTagCollection that is equivalent to the intersect

union

public FIXTagCollection union(FIXTagCollection c)
Calculates the union of two collections.

Parameters:
c - the collection of tags to be joined
Returns:
a new FIXTagCollection that is equivalent to the union

union

public FIXTagCollection union(int[] c)
Calculates the union of two collections.

Parameters:
c - the collection of tags to be joined
Returns:
a new FIXTagCollection that is equivalent to the union

fromSchema

public static FIXTagCollection fromSchema(FIXSchemaMessageFieldCollection schema)
Generates an instance of FIXTagCollection from part of a message schema.

Parameters:
schema - a message schema, component schema, repeating group schema, header or trailer schema
Returns:
the tag collection

fromSchema

public static FIXTagCollection fromSchema(FIXSchemaMessageFieldCollection schema,
                                          int tag)
Generates an instance of FIXTagCollection from part of a message schema and a tag.

If the tag is defined in the schema, the tag will be added to the FIXTagCollection.
If the tag is also a number tag of a repeating group, the tags in the whole group will also be added.
If the tag is a data tag or a data length length, the corresponding tag will be added to the collection.
If the tag is not defined in the schema, an empty collection will be returned.

Parameters:
schema - a message schema, component schema, repeating group schema, header or trailer schema
tag - the tag
Returns:
the tag collection

fromSchema

public static FIXTagCollection fromSchema(FIXSchemaMessageFieldCollection schema,
                                          int[] tags)
Generates an instance of FIXTagCollection from part of a message schema and an array of tags.

If the tag is defined in the schema, the tag will be added to the FIXTagCollection.
If the tag is also a number tag of a repeating group, the tags in the whole group will also be added.
If the tag is a data tag or a data length length, the corresponding tag will be added to the collection.
If the tag is not defined in the schema, an empty collection will be returned.

Parameters:
schema - a message schema, component schema, repeating group schema, header or trailer schema
tags - array of tags
Returns:
the tag collection

toXml

public void toXml(Element e)
To xml.

Parameters:
e - the e

fromXml

public static FIXTagCollection fromXml(Element e)
Conversion.

Parameters:
e - the e
Returns:
the fIX tag collection

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toArray

public int[] toArray()
Conversion.

Returns:
the array of tags