|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.latencybusters.pdm.PDMDefinition
public class PDMDefinition
The message definition class that needs to be populated and finalized
before using in a PDMMessage
Constructor Summary | |
---|---|
protected |
PDMDefinition()
Protected constructor used by PDMMessage
when parsing a PDMDefinition included with the PDMMessage |
|
PDMDefinition(int numFields)
Creates a new definition with the specified number of fields |
|
PDMDefinition(int numFields,
boolean useIntsForNames)
Creates a new definition with the specified number of fields and whether or not to use ints or strings as field names |
Method Summary | |
---|---|
PDMFieldInfo |
addFieldInfo(int name,
PDMFieldType type,
boolean required)
Adds field information to the definition with an int field name |
PDMFieldInfo |
addFieldInfo(int name,
PDMFieldType type,
boolean required,
int numElements)
Adds field information to the definition for a fixed-size array field with an int field name |
PDMFieldInfo |
addFieldInfo(int name,
PDMFieldType type,
int fixedStrLen,
boolean required)
Adds field information to the definition for a fixed length string field with an int field name |
PDMFieldInfo |
addFieldInfo(int name,
PDMFieldType type,
int fixedStrLen,
boolean required,
int numElements)
Adds field information to the definition for a fixed-size array field of fixed length strings with an int field name |
protected PDMFieldInfo |
addFieldInfo(java.lang.String strName,
int intName,
PDMFieldType type,
int fixedStrLen,
boolean required,
int numElements)
The main method used internally to add field information to the definition |
PDMFieldInfo |
addFieldInfo(java.lang.String name,
PDMFieldType type,
boolean required)
Adds field information to the definition with a string field name |
PDMFieldInfo |
addFieldInfo(java.lang.String name,
PDMFieldType type,
boolean required,
int numElements)
Adds field information to the definition for a fixed-size array field with a string field name |
PDMFieldInfo |
addFieldInfo(java.lang.String name,
PDMFieldType type,
int fixedStrLen,
boolean required)
Adds field information to the definition for a fixed length string field with a string field name |
PDMFieldInfo |
addFieldInfo(java.lang.String name,
PDMFieldType type,
int fixedStrLen,
boolean required,
int numElements)
Adds field information to the definition for a fixed-size array field of fixed length strings with a string field name |
protected int |
calcLen(PDMSerializer ser)
Calculates the total length of the definition |
int |
compareTo(int otherDefnId)
Used to compare this PDMDefinition to another's id taking into account
only the the definition id |
int |
compareTo(PDMDefinition other)
Used to compare this PDMDefinition to another taking into account
only the the definition id |
int |
compareToWithVersion(int otherDefnId,
int otherMsgVersMajor,
int otherMsgVersMinor)
Used to compare this PDMDefinition to another's properties
taking into account the definition id and the major and minor message version |
int |
compareToWithVersion(PDMDefinition other)
Used to compare this PDMDefinition to another taking into account
the definition id and the major and minor message version |
java.util.Iterator<PDMFieldInfo> |
createFieldInfoIterator()
Creates an iterator of PDMFieldInfo to iterate
through the field information |
void |
finalizeDef()
Finalizes the definition to ready it for use in a message |
PDMFieldInfo |
getFieldInfo(int name)
Access the field information by integer name |
PDMFieldInfo |
getFieldInfo(java.lang.String name)
Access the field information by String name |
protected PDMFieldInfo |
getFieldInfoById(int id)
Gets the PDMFieldInfo object by its id |
java.util.List<PDMFieldInfo> |
getFieldInfoList()
|
protected int |
getFixedRequiredLen()
Gets or calcs the length of the fixed required fields |
int |
getId()
|
byte |
getMsgVersMajor()
|
byte |
getMsgVersMinor()
|
int |
getNumFields()
|
boolean |
isFinalized()
|
boolean |
isIntsForNames()
|
int |
parse(PDMDeserializer deser,
byte[] ba)
Parses an existing byte array into this object |
int |
parse(PDMDeserializer deser,
byte[] ba,
int pos)
Parses an existing byte array into this object |
void |
setId(int id)
|
void |
setMsgVersMajor(byte msgVersMajor)
|
void |
setMsgVersMinor(byte msgVersMinor)
|
byte[] |
toBytes(PDMSerializer ser)
Serializes the PDMDefinition to a new byte array |
int |
toBytes(PDMSerializer ser,
byte[] ba,
int pos)
Serialize the PDMDefinition to an existing byte array |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected PDMDefinition()
PDMMessage
when parsing a PDMDefinition included with the PDMMessage
public PDMDefinition(int numFields)
numFields
- the number of fieldspublic PDMDefinition(int numFields, boolean useIntsForNames)
numFields
- the number of fieldsuseIntsForNames
- true to use ints as field names or false to use string field names (the default)Method Detail |
---|
public java.util.List<PDMFieldInfo> getFieldInfoList()
public int getNumFields()
public boolean isFinalized()
public void setMsgVersMajor(byte msgVersMajor)
public byte getMsgVersMajor()
public void setMsgVersMinor(byte msgVersMinor)
public byte getMsgVersMinor()
public void setId(int id)
public int getId()
public boolean isIntsForNames()
protected int getFixedRequiredLen()
protected int calcLen(PDMSerializer ser)
ser
-
protected PDMFieldInfo getFieldInfoById(int id)
PDMFieldInfo
object by its id
id
- the internal id of the field
PDMFieldInfo
objectprotected PDMFieldInfo addFieldInfo(java.lang.String strName, int intName, PDMFieldType type, int fixedStrLen, boolean required, int numElements)
strName
- the string name of the field (if using string names)intName
- the int name of the field (if using int names)type
- the type of fieldfixedStrLen
- the fixed string length (number of characters) and is normally 0 unless the type is fixed string or fixed unicoderequired
- whether or not the field is requirednumElements
- a non-zero value is used to define a fixed-size array for array types
PDMFieldInfo
public java.util.Iterator<PDMFieldInfo> createFieldInfoIterator()
PDMFieldInfo
to iterate
through the field information
public void finalizeDef()
public PDMFieldInfo getFieldInfo(int name)
name
- the int field name
PDMFieldInfo
handlepublic PDMFieldInfo getFieldInfo(java.lang.String name)
name
- the string field name
PDMFieldInfo
handlepublic PDMFieldInfo addFieldInfo(java.lang.String name, PDMFieldType type, boolean required)
name
- the string name of the fieldtype
- the type of fieldrequired
- whether or not the field is required
PDMFieldInfo
handlepublic PDMFieldInfo addFieldInfo(int name, PDMFieldType type, boolean required)
name
- the int name of the fieldtype
- the type of fieldrequired
- whether or not the field is required
PDMFieldInfo
handlepublic PDMFieldInfo addFieldInfo(java.lang.String name, PDMFieldType type, int fixedStrLen, boolean required)
name
- the string name of the fieldtype
- the type of fieldfixedStrLen
- the fixed string length (number of characters) and is normally 0 unless the type is fixed string or fixed unicoderequired
- whether or not the field is required
PDMFieldInfo
handlepublic PDMFieldInfo addFieldInfo(int name, PDMFieldType type, int fixedStrLen, boolean required)
name
- the int name of the fieldtype
- the type of fieldfixedStrLen
- the fixed string length (number of characters) and is normally 0 unless the type is fixed string or fixed unicoderequired
- whether or not the field is required
PDMFieldInfo
handlepublic PDMFieldInfo addFieldInfo(java.lang.String name, PDMFieldType type, boolean required, int numElements)
name
- the string name of the fieldtype
- the type of fieldrequired
- whether or not the field is requirednumElements
- a non-zero value is used to define a fixed-size array for array types
PDMFieldInfo
handlepublic PDMFieldInfo addFieldInfo(int name, PDMFieldType type, boolean required, int numElements)
name
- the int name of the fieldtype
- the type of fieldrequired
- whether or not the field is requirednumElements
- a non-zero value is used to define a fixed-size array for array types
PDMFieldInfo
handlepublic PDMFieldInfo addFieldInfo(java.lang.String name, PDMFieldType type, int fixedStrLen, boolean required, int numElements)
name
- the string name of the fieldtype
- the type of fieldfixedStrLen
- the fixed string length (number of characters) and is normally 0 unless the type is fixed string or fixed unicoderequired
- whether or not the field is requirednumElements
- a non-zero value is used to define a fixed-size array for array types
PDMFieldInfo
handlepublic PDMFieldInfo addFieldInfo(int name, PDMFieldType type, int fixedStrLen, boolean required, int numElements)
name
- the int name of the fieldtype
- the type of fieldfixedStrLen
- the fixed string length (number of characters) and is normally 0 unless the type is fixed string or fixed unicoderequired
- whether or not the field is requirednumElements
- a non-zero value is used to define a fixed-size array for array types
PDMFieldInfo
handlepublic int compareToWithVersion(int otherDefnId, int otherMsgVersMajor, int otherMsgVersMinor)
PDMDefinition
to another's properties
taking into account the definition id and the major and minor message version
otherDefnId
- the other definition id to compare againstotherMsgVersMajor
- the other definition major version to compare againstotherMsgVersMinor
- the other definition minor version to compare against
PDMDefinition
is greater,
-1 if this PDMDefinition
is lesspublic int compareToWithVersion(PDMDefinition other)
PDMDefinition
to another taking into account
the definition id and the major and minor message version
other
- the other PDMDefinition to compare against
PDMDefinition
is greater,
-1 if this PDMDefinition
is lesspublic int compareTo(int otherDefnId)
PDMDefinition
to another's id taking into account
only the the definition id
otherDefnId
- the other definition id to compare against
PDMDefinition
is greater,
-1 if this PDMDefinition
is lesspublic int compareTo(PDMDefinition other)
PDMDefinition
to another taking into account
only the the definition id
other
- the other PDMDefinition to compare against
PDMDefinition
is greater,
-1 if this PDMDefinition
is lesspublic byte[] toBytes(PDMSerializer ser)
PDMDefinition
to a new byte array
ser
- the PDMSerializer to use
public int toBytes(PDMSerializer ser, byte[] ba, int pos)
PDMDefinition
to an existing byte array
ser
- the PDMSerializer to useba
- the byte array to serialize intopos
- the position to start at in the byte array
public int parse(PDMDeserializer deser, byte[] ba)
deser
- the PDMDeserializer to useba
- the byte array to parse
public int parse(PDMDeserializer deser, byte[] ba, int pos)
deser
- the PDMDeserializer to useba
- the byte array to parsepos
- the position to start parsing in the byte array
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |