NWNFiles
Class GFFFile.Field

java.lang.Object
  |
  +--NWNFiles.GFFFile.Field
All Implemented Interfaces:
Cloneable
Enclosing class:
GFFFile

public final class GFFFile.Field
extends Object
implements Cloneable

Author:
Alexandre Brunel This class represents a field rom a GFF file structure.

Constructor Summary
protected GFFFile.Field(long _type, GFFFile.Structure _owner, String _label)
          Constructs a Field object and adds it to the _owner structure.
protected GFFFile.Field(long _type, GFFFile.Structure _owner, String _label, Object _data)
          Constructs a Field object and adds it to the _owner structure.
  GFFFile.Field(long _type, String _label, Object _data)
          Constructs a Field object.
 
Method Summary
 Object clone()
           
 GFFFile.Field clone(GFFFile target)
          Clones the field, the return object should be used in a specific GFFFile object.
 Object getData()
          Returns the data contained by the field.
 String getLabel()
          Returns the label of the field
 GFFFile.Structure getOwner()
          Returns the Structure containing the field.
 long getType()
          Returns the type of the field.
 void setData(Object data)
          Sets the data of the field.
 void setLabel(String label)
          Sets the label of the field.
protected  void setOwner(GFFFile.Structure _owner)
          Sets the structure cotaining the field.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GFFFile.Field

public GFFFile.Field(long _type,
                     String _label,
                     Object _data)
              throws NameTooLong
Constructs a Field object. _data can be null.

Parameters:
_type - Type of the field. See the FieldType class for a list of types.
_label - The label of the field
_data - An object representing the data of the field. See the FieldType sub-classes for further information
Throws:
NameTooLong - If the label is longer than 16 characters.

GFFFile.Field

protected GFFFile.Field(long _type,
                        GFFFile.Structure _owner,
                        String _label)
                 throws NameTooLong
Constructs a Field object and adds it to the _owner structure.

Parameters:
_type - Type of the field. See the FieldType class for a list of types.
_owner - The structure containing the field.
_label - The label of the field
Throws:
NameTooLong - If the label is longer than 16 characters.

GFFFile.Field

protected GFFFile.Field(long _type,
                        GFFFile.Structure _owner,
                        String _label,
                        Object _data)
                 throws NameTooLong
Constructs a Field object and adds it to the _owner structure. _data can be null.

Parameters:
_type - Type of the field. See the FieldType class for a list of types.
_owner - The structure containing the field.
_label - The label of the field
_data - An object representing the data of the field. See the FieldType sub-classes for further information
Throws:
NameTooLong - If the label is longer than 16 characters.
Method Detail

getData

public Object getData()
Returns the data contained by the field.

Returns:
See the FieldType class for more details on returned object.

getLabel

public String getLabel()
Returns the label of the field

Returns:
A String containing the label.

getOwner

public GFFFile.Structure getOwner()
Returns the Structure containing the field.

Returns:
The GFFFile.Structure Structure object containing the field.

getType

public long getType()
Returns the type of the field.

Returns:
A long containing the field type value. See the FieldType class for more deatails.

setData

public void setData(Object data)
Sets the data of the field. Changes are propagated to the GFFFile object containing the field.

Parameters:
data - The new data.

setLabel

public void setLabel(String label)
              throws NameTooLong
Sets the label of the field. Changes are propagated to the GFFFile object containing the field.

Parameters:
label - New label.
Throws:
NameTooLong - If the label is longer than 16 characters.

setOwner

protected void setOwner(GFFFile.Structure _owner)
Sets the structure cotaining the field. If the field was in an other structure before the call of that methode, no change is made to that structure.

Parameters:
_owner -

toString

public String toString()
Overrides:
toString in class Object

clone

public Object clone()
Overrides:
clone in class Object

clone

public GFFFile.Field clone(GFFFile target)
Clones the field, the return object should be used in a specific GFFFile object.

Parameters:
target - Target GFFFile object
Returns:
a copy of this object.