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 enumThe 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 booleanSome fields, such as Marking, could have arrays that are treated a C strings.protected StringIf this is a variable list length field, when unmarshalling we need to know how many list items to unmarshal.protected StringThe default value for this attribute if it is a primitive.protected GeneratedClassAttributeIf this is a dynamic length list field or primitive list, we also need the field that this tells the length for.protected StringDefault enumeration size 9protected booleanWhether or not attribute has fixed bit lengthprotected booleanif it specifies a field which we want to have no getter or setterprotected Stringif a class and we want to initialize a subtype:protected booleanSome fields are really bit fields, with flags that constitute subranges.protected booleanWhether or not list length is dynamicprotected booleanWhich of list or array is itprotected intUsed only if this is a list attributeprotected StringName of this attribute, winds up as the ivar nameprotected booleanShould 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 Stringthe type of the attribute: a short, class, etc.protected booleanIf this is a list of some sort, this is true if the list consists of class references, false if the list consists of primitivesprotected booleanIf this is a list of some sort, this is true if the list consists of class references, false if the list consists of primitivesprotected booleanIf 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 TypeMethodDescriptionvoidaddBitField(GeneratedBitField aBitField) Add a bit fieldget the kind of the attribute (primitive, list, array, etc.)get comment value (description)booleanwhether attribute could be stringTODOGet the default value for a primitive typeget special attributeget enumeration marshal sizeAccessor methodbooleanwhether attribute is a bit fieldbooleanwhether attribute has dynamic list lengthbooleanwhether attribute has primitive list lengthintGet list lengthgetName()Get the name of the class attribute/inamegetType()Get the type of the fieldbooleanreturns true if this is a list and the underlying type is a primitivebooleanreturns true if this is a list and the underlying type is a primitivebooleanget whether attribute has fixed length in bitsbooleanisHidden()get whether attribute is hiddenbooleanReturns true if 1) this is a list, either fixed or variable, and 2) contains a classvoidSet the kind of the class attribute/inamevoidsetComment(String pComment) set comment value (description)voidsetCouldBeString(boolean couldBeString) set whether attribute could be stringvoidsetCountFieldName(String pFieldName) TODOvoidsetDefaultValue(String pValue) Set the default value for a primitive typevoidset special attributevoidsetEnumMarshalSize(String enumMarshalSize) set enumeration marshal sizevoidsetFixedLength(boolean flag) Set whether attribute has fixed length in bitsvoidsetHidden(boolean flag) set whether attribute is hiddenvoidsetInitialClass(String initialClassName) Accessor methodvoidsetIsBitField(boolean isBitField) set whether attribute is a bit fieldvoidsetIsDynamicListLengthField(boolean flag) whether attribute has dynamic list lengthvoidsetIsPrimitiveListLengthField(boolean flag) set whether attribute has primitive list lengthvoidsetListLength(int pListLength) Set list lengthvoidSet the name of the class attribute/inamevoidSet the type of the class attribute/inamevoidsetUnderlyingTypeIsEnum(boolean newValue) sets true if the underlying type of a list is a enumvoidsetUnderlyingTypeIsPrimitive(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
-
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
-
setType
Set the type of the class attribute/iname- Parameters:
pType- new type
-
getInitialClass
-
setInitialClass
Accessor method- Parameters:
initialClassName- name
-
getComment
-
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
-
setCountFieldName
-
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
-
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)
-