org.openfast.template
Class Sequence

java.lang.Object
  extended by org.openfast.template.Field
      extended by org.openfast.template.Sequence
All Implemented Interfaces:
java.io.Serializable, FieldSet

public class Sequence
extends Field
implements FieldSet

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.openfast.template.Field
id, key, name, optional
 
Constructor Summary
Sequence(QName name, Field[] fields, boolean optional)
          Sequence Constructor - Sets the implicitLength to true
Sequence(QName name, Scalar length, Field[] fields, boolean optional)
          Sequence Constructor - If no length, a length is created and the implicitLength is set to true.
Sequence(java.lang.String name, Field[] fields, boolean optional)
           
 
Method Summary
 FieldValue createValue(java.lang.String value)
          createValue method declaration
 FieldValue decode(java.io.InputStream in, Group template, Context context, BitVectorReader pmapReader)
          Decode the specified stream of data
 byte[] encode(FieldValue value, Group template, Context context, BitVectorBuilder presenceMapBuilder)
          Store the data passed to a byte array
 boolean equals(java.lang.Object obj)
           
 java.lang.String getAttribute(QName name)
           
 Field getField(int index)
          Find a specific field
 int getFieldCount()
          Find the number of fields in the current group
 Group getGroup()
           
 Scalar getLength()
          Find the length of a Scalar value
 java.lang.String getTypeName()
          getTypeName method declaration
 QName getTypeReference()
           
 java.lang.Class getValueType()
          getValueType method declaration
 boolean hasAttribute(QName attributeName)
           
 boolean hasField(java.lang.String fieldName)
           
 int hashCode()
           
 boolean hasTypeReference()
           
 boolean isImplicitLength()
           
 boolean isPresenceMapBitSet(byte[] encoding, FieldValue fieldValue)
          isPresenceMapBitSet method declaration
 void setTypeReference(QName typeReference)
          Set the type reference
 java.lang.String toString()
           
 boolean usesPresenceMapBit()
          usesPresenceMapBit method declaration
 
Methods inherited from class org.openfast.template.Field
addAttribute, getId, getKey, getName, getQName, isOptional, isPresent, setId, setKey
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Sequence

public Sequence(QName name,
                Field[] fields,
                boolean optional)
Sequence Constructor - Sets the implicitLength to true

Parameters:
name - The name of the sequence as a string
fields - Field array object
optional - Determines if the Field is required or not for the data

Sequence

public Sequence(java.lang.String name,
                Field[] fields,
                boolean optional)

Sequence

public Sequence(QName name,
                Scalar length,
                Field[] fields,
                boolean optional)
Sequence Constructor - If no length, a length is created and the implicitLength is set to true. A new Group is also created with with the respected information.

Parameters:
name - Name of the sequence, a string
length - Length of the sequence, a Scalar value
fields - Field array
optional - Determines if the Field is required or not for the data
Method Detail

getFieldCount

public int getFieldCount()
Find the number of fields in the current group

Specified by:
getFieldCount in interface FieldSet
Returns:
Returns an integer of the number of fields

getField

public Field getField(int index)
Find a specific field

Specified by:
getField in interface FieldSet
Parameters:
index - The field index that is passed
Returns:
Returns a Field object of the requested index

getLength

public Scalar getLength()
Find the length of a Scalar value

Returns:
The length of the Scalar value

usesPresenceMapBit

public boolean usesPresenceMapBit()
Description copied from class: Field
usesPresenceMapBit method declaration

Specified by:
usesPresenceMapBit in class Field
Returns:
True if there is a current MapBit, false otherwise

isPresenceMapBitSet

public boolean isPresenceMapBitSet(byte[] encoding,
                                   FieldValue fieldValue)
Description copied from class: Field
isPresenceMapBitSet method declaration

Specified by:
isPresenceMapBitSet in class Field
Parameters:
encoding - Byte array to be checked if there is a MapBit
fieldValue - FieldValue object
Returns:
True if there is a Map Bit set, false otherwise

encode

public byte[] encode(FieldValue value,
                     Group template,
                     Context context,
                     BitVectorBuilder presenceMapBuilder)
Store the data passed to a byte array

Specified by:
encode in class Field
Parameters:
value - The FieldValue object
template - The Group that is to be stored
context - The previous object to keep the data in sync
presenceMapBuilder - The BitVectorBuilder object to be encoded
Returns:
Returns the buffer of the byte array

decode

public FieldValue decode(java.io.InputStream in,
                         Group template,
                         Context context,
                         BitVectorReader pmapReader)
Decode the specified stream of data

Specified by:
decode in class Field
Parameters:
in - The input stream to be decoded
template - Which Group template is to be decoded
context - The previous object to keep the data in sync
present -
Returns:
If there is nothing to decode - returns null, otherwise returns a sequenceValue object that has the decoded information stored.

getValueType

public java.lang.Class getValueType()
Description copied from class: Field
getValueType method declaration

Specified by:
getValueType in class Field
Returns:
Returns the class of the current SequenceValue

createValue

public FieldValue createValue(java.lang.String value)
Description copied from class: Field
createValue method declaration

Specified by:
createValue in class Field
Parameters:
value - String of the new SequenceValue to create
Returns:
Returns a new SequenceValue with the specified value

getTypeName

public java.lang.String getTypeName()
Description copied from class: Field
getTypeName method declaration

Specified by:
getTypeName in class Field
Returns:
Returns the string 'sequence'

getGroup

public Group getGroup()
Returns:
Return the current Group

hasField

public boolean hasField(java.lang.String fieldName)
Parameters:
fieldName - String of the FieldName that is to be found
Returns:
Returns true if there is a field with the specified name, false otherwise

isImplicitLength

public boolean isImplicitLength()
Returns:
Returns the implicitLength, true or false - whichever is set

setTypeReference

public void setTypeReference(QName typeReference)
Set the type reference

Parameters:
typeReference - The type reference name as a string

getTypeReference

public QName getTypeReference()
Returns:
Returns the typeReference as a string

hasTypeReference

public boolean hasTypeReference()
Returns:
Returns true if there is a type reference

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hasAttribute

public boolean hasAttribute(QName attributeName)
Overrides:
hasAttribute in class Field

getAttribute

public java.lang.String getAttribute(QName name)
Overrides:
getAttribute in class Field


Copyright © 2006-2008 The LaSalle Technology Group, LLC. All Rights Reserved.