Class GeneratedClassAttribute

java.lang.Object
edu.nps.moves.dis7.source.generator.pdus.GeneratedClassAttribute

public class GeneratedClassAttribute extends Object
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
  • Field Details

    • name

      protected String name
      Name of this attribute, winds up as the ivar name
    • attributeKind

      What attribute class this is: primitive, list, array, etc
    • type

      protected String type
      the type of the attribute: a short, class, etc.
    • initialClass

      protected String initialClass
      if a class and we want to initialize a subtype:
    • hidden

      protected boolean hidden
      if it specifies a field which we want to have no getter or setter
    • listLength

      protected int listLength
      Used only if this is a list attribute
    • fixedLength

      protected boolean fixedLength
      Whether or not attribute has fixed bit length
    • countFieldName

      protected String 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 isPrimitiveListLengthField
      Which of list or array is it
    • isDynamicListLengthField

      protected boolean isDynamicListLengthField
      Whether or not list length is dynamic
    • dynamicListClassAttribute

      protected GeneratedClassAttribute dynamicListClassAttribute
      If this is a dynamic length list field or primitive list, we also need the field that this tells the length for.
    • defaultValue

      protected String defaultValue
      The default value for this attribute if it is a primitive.
    • underlyingTypeIsPrimitive

      protected boolean underlyingTypeIsPrimitive
      If 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 underlyingTypeIsClass
      If 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 underlyingTypeIsEnum
      If 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 couldBeString
      Some 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 isBitField
      Some fields are really bit fields, with flags that constitute subranges.
    • bitFieldList

      protected List<GeneratedBitField> bitFieldList
      List of bit fields.
    • shouldSerialize

      protected boolean shouldSerialize
      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 xml
    • enumMarshalSize

      protected String enumMarshalSize
      Default enumeration size 9
  • Constructor Details

    • GeneratedClassAttribute

      public GeneratedClassAttribute()
      default constructor
  • Method Details

    • getName

      public String getName()
      Get the name of the class attribute/iname
      Returns:
      name
    • setName

      public void setName(String pName)
      Set the name of the class attribute/iname
      Parameters:
      pName - new name
    • getAttributeKind

      public GeneratedClassAttribute.ClassAttributeType getAttributeKind()
      get the kind of the attribute (primitive, list, array, etc.)
      Returns:
      attribute kind of interest
    • setAttributeKind

      public void setAttributeKind(GeneratedClassAttribute.ClassAttributeType pKind)
      Set the kind of the class attribute/iname
      Parameters:
      pKind - new kind
    • getType

      public String getType()
      Get the type of the field
      Returns:
      type
    • setType

      public void setType(String pType)
      Set the type of the class attribute/iname
      Parameters:
      pType - new type
    • getInitialClass

      public String getInitialClass()
      Accessor method
      Returns:
      initialClass name
    • setInitialClass

      public void setInitialClass(String initialClassName)
      Accessor method
      Parameters:
      initialClassName - name
    • getComment

      public String getComment()
      get comment value (description)
      Returns:
      comment value
    • setComment

      public void setComment(String pComment)
      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

      public String getCountFieldName()
      TODO
      Returns:
      TODO
    • setCountFieldName

      public void setCountFieldName(String pFieldName)
      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

      public String getDefaultValue()
      Get the default value for a primitive type
      Returns:
      default value
    • setDefaultValue

      public void setDefaultValue(String pValue)
      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

      public void setDynamicListClassAttribute(GeneratedClassAttribute attr)
      set special attribute
      Parameters:
      attr - special attribute
    • getDynamicListClassAttribute

      public GeneratedClassAttribute 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

      public void addBitField(GeneratedBitField aBitField)
      Add a bit field
      Parameters:
      aBitField - BitField to add
    • getEnumMarshalSize

      public String getEnumMarshalSize()
      get enumeration marshal size
      Returns:
      enumeration marshal size value (note String type)
    • setEnumMarshalSize

      public void setEnumMarshalSize(String enumMarshalSize)
      set enumeration marshal size
      Parameters:
      enumMarshalSize - size value (note String type)