drawables
Class DrawableObjectType

java.lang.Object
  |
  +--drawables.DrawableObjectType
All Implemented Interfaces:
EntryReadable

public class DrawableObjectType
extends java.lang.Object
implements EntryReadable

Class for handling object types.


Constructor Summary
DrawableObjectType()
          Constructor required for reading objects.
DrawableObjectType(java.lang.String name, int numOfAttributes, java.lang.String[] attrNames, java.lang.String[] attrTypes)
          Constructor.
 
Method Summary
static DrawableObjectType findObjectType(java.lang.String name)
          Search for the object type with the given name.
 int getAttributeAsInteger(int i, java.lang.String attributes)
          Returns a distinct attribute as an integer.
 java.lang.String getAttributeAsString(int i, java.lang.String attributes)
          Returns a distinct attribute as string.
 java.lang.String getAttributeName(int i)
          returns the i-th attribute name.
 java.lang.String getAttributeType(int i)
          returns the i-th attribute yype.
static DrawableObjectType getDefaultType()
          Returns a default type.
 java.lang.String getName()
          Returns the name of the type.
 int getNumOfAttributes()
          Returns the number of attributes.
static DrawableObjectType getObjectType(java.lang.String name)
          Search for the object type with the given name.
 EntryReadable read(EntryInput r)
          Reads the object type from an entry input.
static void setTerminatingChar(char c)
          Sets the terminating char.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DrawableObjectType

public DrawableObjectType()
Constructor required for reading objects.


DrawableObjectType

public DrawableObjectType(java.lang.String name,
                          int numOfAttributes,
                          java.lang.String[] attrNames,
                          java.lang.String[] attrTypes)
Constructor.

Parameters:
name - name of the type
numOfAttributes - the number of attributes
attrNames - the names of the attributes
attrTypes - the types of the attributes
Method Detail

findObjectType

public static DrawableObjectType findObjectType(java.lang.String name)
Search for the object type with the given name.

Parameters:
name - name of the type
Returns:
the found object type (or null)

getAttributeAsInteger

public int getAttributeAsInteger(int i,
                                 java.lang.String attributes)
                          throws java.lang.NumberFormatException
Returns a distinct attribute as an integer.

Parameters:
i - index (0 = first)
attributes - the complete attribute string
Returns:
the attribute
Throws:
java.lang.NumberFormatException

getAttributeAsString

public java.lang.String getAttributeAsString(int i,
                                             java.lang.String attributes)
Returns a distinct attribute as string.

Parameters:
i - index (0 = first)
attributes - the complete attribute string
Returns:
the attribute

getAttributeName

public java.lang.String getAttributeName(int i)
returns the i-th attribute name.

Parameters:
i - index (start=0)
Returns:
attribut name (or "")

getAttributeType

public java.lang.String getAttributeType(int i)
returns the i-th attribute yype.

Parameters:
i - index (start=0)
Returns:
attribut type (or "")

getDefaultType

public static DrawableObjectType getDefaultType()
Returns a default type.

Returns:
the default type

getName

public java.lang.String getName()
Returns the name of the type.

Returns:
name

getNumOfAttributes

public int getNumOfAttributes()
Returns the number of attributes.

Returns:
number of attributes

getObjectType

public static DrawableObjectType getObjectType(java.lang.String name)
Search for the object type with the given name. If it does not exist, a new type is created.

Parameters:
name - name of the type
Returns:
the found object yype (or null)

read

public EntryReadable read(EntryInput r)
Reads the object type from an entry input.

Specified by:
read in interface EntryReadable
Parameters:
r - entry input
Returns:
new or found object type

setTerminatingChar

public static void setTerminatingChar(char c)
Sets the terminating char.

Parameters:
c - char