Class GeneratedClassAttribute
java.lang.Object
edu.nps.moves.dis7.source.generator.pdus.GeneratedClassAttribute
Represents one attribute of a class, ie an instance variable. this may be a
primitive type, a class defined elsewhere in the document, a list, or an
array.
- Author:
- DMcG
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
The various things an attribute can be: a primitive type (int, short, byte, etc), a reference to another class defined in this document, a list of primitives, aka an array, or a list of objects of variable length. -
Field Summary
FieldsModifier and TypeFieldDescriptionWhat attribute class this is: primitive, list, array, etcprotected List
<GeneratedBitField> List of bit fields.protected boolean
Some fields, such as Marking, could have arrays that are treated a C strings.protected String
If this is a variable list length field, when unmarshalling we need to know how many list items to unmarshal.protected String
The default value for this attribute if it is a primitive.protected GeneratedClassAttribute
If this is a dynamic length list field or primitive list, we also need the field that this tells the length for.protected String
Default enumeration size 9protected boolean
Whether or not attribute has fixed bit lengthprotected boolean
if it specifies a field which we want to have no getter or setterprotected String
if a class and we want to initialize a subtype:protected boolean
Some fields are really bit fields, with flags that constitute subranges.protected boolean
Whether or not list length is dynamicprotected boolean
Which of list or array is itprotected int
Used only if this is a list attributeprotected String
Name of this attribute, winds up as the ivar nameprotected boolean
Should we serialize this attribute to the message or not? By default yes, but this can be overridden by the attribute serialize="false" in the xmlprotected String
the type of the attribute: a short, class, etc.protected boolean
If this is a list of some sort, this is true if the list consists of class references, false if the list consists of primitivesprotected boolean
If this is a list of some sort, this is true if the list consists of class references, false if the list consists of primitivesprotected boolean
If this is a list of some sort, this is true if the list consists of primitives, false if the list consists of classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addBitField
(GeneratedBitField aBitField) Add a bit fieldget the kind of the attribute (primitive, list, array, etc.)get comment value (description)boolean
whether attribute could be stringTODOGet the default value for a primitive typeget special attributeget enumeration marshal sizeAccessor methodboolean
whether attribute is a bit fieldboolean
whether attribute has dynamic list lengthboolean
whether attribute has primitive list lengthint
Get list lengthgetName()
Get the name of the class attribute/inamegetType()
Get the type of the fieldboolean
returns true if this is a list and the underlying type is a primitiveboolean
returns true if this is a list and the underlying type is a primitiveboolean
get whether attribute has fixed length in bitsboolean
isHidden()
get whether attribute is hiddenboolean
Returns true if 1) this is a list, either fixed or variable, and 2) contains a classvoid
Set the kind of the class attribute/inamevoid
setComment
(String pComment) set comment value (description)void
setCouldBeString
(boolean couldBeString) set whether attribute could be stringvoid
setCountFieldName
(String pFieldName) TODOvoid
setDefaultValue
(String pValue) Set the default value for a primitive typevoid
set special attributevoid
setEnumMarshalSize
(String enumMarshalSize) set enumeration marshal sizevoid
setFixedLength
(boolean flag) Set whether attribute has fixed length in bitsvoid
setHidden
(boolean flag) set whether attribute is hiddenvoid
setInitialClass
(String initialClassName) Accessor methodvoid
setIsBitField
(boolean isBitField) set whether attribute is a bit fieldvoid
setIsDynamicListLengthField
(boolean flag) whether attribute has dynamic list lengthvoid
setIsPrimitiveListLengthField
(boolean flag) set whether attribute has primitive list lengthvoid
setListLength
(int pListLength) Set list lengthvoid
Set the name of the class attribute/inamevoid
Set the type of the class attribute/inamevoid
setUnderlyingTypeIsEnum
(boolean newValue) sets true if the underlying type of a list is a enumvoid
setUnderlyingTypeIsPrimitive
(boolean newValue) sets true if the underlying type of a list is a primitive, false if it is a class
-
Field Details
-
name
Name of this attribute, winds up as the ivar name -
attributeKind
What attribute class this is: primitive, list, array, etc -
type
the type of the attribute: a short, class, etc. -
initialClass
if a class and we want to initialize a subtype: -
listLength
protected int listLengthUsed only if this is a list attribute -
fixedLength
protected boolean fixedLengthWhether or not attribute has fixed bit length -
countFieldName
If this is a variable list length field, when unmarshalling we need to know how many list items to unmarshal. This is the name of the field that contains that count. -
isPrimitiveListLengthField
protected boolean isPrimitiveListLengthFieldWhich of list or array is it -
isDynamicListLengthField
protected boolean isDynamicListLengthFieldWhether or not list length is dynamic -
dynamicListClassAttribute
If this is a dynamic length list field or primitive list, we also need the field that this tells the length for. -
defaultValue
The default value for this attribute if it is a primitive. -
underlyingTypeIsPrimitive
protected boolean underlyingTypeIsPrimitiveIf this is a list of some sort, this is true if the list consists of primitives, false if the list consists of classes -
underlyingTypeIsClass
protected boolean underlyingTypeIsClassIf this is a list of some sort, this is true if the list consists of class references, false if the list consists of primitives -
underlyingTypeIsEnum
protected boolean underlyingTypeIsEnumIf this is a list of some sort, this is true if the list consists of class references, false if the list consists of primitives -
couldBeString
protected boolean couldBeStringSome fields, such as Marking, could have arrays that are treated a C strings. At least on the set method, if we pass in an array we can have an alternate method that treats the input string as a c-style string, with a terminating null character. This is not strictly compliant with the DIS standard, which makes no assumptions about null-terminated strings, but it happens often enough in the C world to special case it. -
isBitField
protected boolean isBitFieldSome fields are really bit fields, with flags that constitute subranges. -
bitFieldList
List of bit fields. -
shouldSerialize
protected boolean shouldSerializeShould we serialize this attribute to the message or not? By default yes, but this can be overridden by the attribute serialize="false" in the xml -
enumMarshalSize
Default enumeration size 9
-
-
Constructor Details
-
GeneratedClassAttribute
public GeneratedClassAttribute()default constructor
-
-
Method Details
-
getName
Get the name of the class attribute/iname- Returns:
- name
-
setName
Set the name of the class attribute/iname- Parameters:
pName
- new name
-
getAttributeKind
get the kind of the attribute (primitive, list, array, etc.)- Returns:
- attribute kind of interest
-
setAttributeKind
Set the kind of the class attribute/iname- Parameters:
pKind
- new kind
-
getType
Get the type of the field- Returns:
- type
-
setType
Set the type of the class attribute/iname- Parameters:
pType
- new type
-
getInitialClass
Accessor method- Returns:
- initialClass name
-
setInitialClass
Accessor method- Parameters:
initialClassName
- name
-
getComment
get comment value (description)- Returns:
- comment value
-
setComment
set comment value (description)- Parameters:
pComment
- comment value
-
setHidden
public void setHidden(boolean flag) set whether attribute is hidden- Parameters:
flag
- whether attribute is hidden
-
isHidden
public boolean isHidden()get whether attribute is hidden- Returns:
- whether attribute is hidden
-
setListLength
public void setListLength(int pListLength) Set list length- Parameters:
pListLength
- list length
-
getListLength
public int getListLength()Get list length- Returns:
- list length
-
isFixedLength
public boolean isFixedLength()get whether attribute has fixed length in bits- Returns:
- whether attribute has fixed length in bits
-
setFixedLength
public void setFixedLength(boolean flag) Set whether attribute has fixed length in bits- Parameters:
flag
- whether attribute has fixed length in bits
-
getCountFieldName
TODO- Returns:
- TODO
-
setCountFieldName
TODO- Parameters:
pFieldName
- TODO
-
listIsClass
public boolean listIsClass()Returns true if 1) this is a list, either fixed or variable, and 2) contains a class- Returns:
- whether list contains a class
-
getDefaultValue
Get the default value for a primitive type- Returns:
- default value
-
setDefaultValue
Set the default value for a primitive type- Parameters:
pValue
- value of interest
-
setUnderlyingTypeIsPrimitive
public void setUnderlyingTypeIsPrimitive(boolean newValue) sets true if the underlying type of a list is a primitive, false if it is a class- Parameters:
newValue
- of interest
-
getUnderlyingTypeIsPrimitive
public boolean getUnderlyingTypeIsPrimitive()returns true if this is a list and the underlying type is a primitive- Returns:
- value of interest
-
setUnderlyingTypeIsEnum
public void setUnderlyingTypeIsEnum(boolean newValue) sets true if the underlying type of a list is a enum- Parameters:
newValue
- of interest
-
getUnderlyingTypeIsEnum
public boolean getUnderlyingTypeIsEnum()returns true if this is a list and the underlying type is a primitive- Returns:
- value of interest
-
getCouldBeString
public boolean getCouldBeString()whether attribute could be string- Returns:
- whether attribute could be string
-
setCouldBeString
public void setCouldBeString(boolean couldBeString) set whether attribute could be string- Parameters:
couldBeString
- whether attribute could be string
-
setIsDynamicListLengthField
public void setIsDynamicListLengthField(boolean flag) whether attribute has dynamic list length- Parameters:
flag
- whether attribute has dynamic list length
-
getIsDynamicListLengthField
public boolean getIsDynamicListLengthField()whether attribute has dynamic list length- Returns:
- whether attribute has dynamic list length
-
setIsPrimitiveListLengthField
public void setIsPrimitiveListLengthField(boolean flag) set whether attribute has primitive list length- Parameters:
flag
- whether attribute has primitive list length
-
getIsPrimitiveListLengthField
public boolean getIsPrimitiveListLengthField()whether attribute has primitive list length- Returns:
- whether attribute has primitive list length
-
setDynamicListClassAttribute
set special attribute- Parameters:
attr
- special attribute
-
getDynamicListClassAttribute
get special attribute- Returns:
- special attribute
-
setIsBitField
public void setIsBitField(boolean isBitField) set whether attribute is a bit field- Parameters:
isBitField
- whether attribute is a bit field
-
getIsBitField
public boolean getIsBitField()whether attribute is a bit field- Returns:
- whether attribute is a bit field
-
addBitField
Add a bit field- Parameters:
aBitField
- BitField to add
-
getEnumMarshalSize
get enumeration marshal size- Returns:
- enumeration marshal size value (note String type)
-
setEnumMarshalSize
set enumeration marshal size- Parameters:
enumMarshalSize
- size value (note String type)
-