com.huguesjohnson.tiamat
Class Area

java.lang.Object
  extended by com.huguesjohnson.tiamat.Area
All Implemented Interfaces:
Storable

public class Area
extends java.lang.Object
implements Storable

Area - collection of layers and characters to represent an area

Author:
Hugues Johnson

Field Summary
protected  java.lang.String absoluteDir
           
 
Constructor Summary
Area()
          Creates a new instance of Area.
Area(Layer[] layers, java.lang.String[] characterPaths, Formatter formatter)
          Creates a new instance of Area.
 
Method Summary
 void addCharacter(java.lang.String characterPath, Formatter formatter)
          Adds a Character to this Area.
 void addLayer(Layer layer)
          Adds a Layer to this Area.
 Character getCharacter(int index)
          Get the character at the specified index.
 java.lang.String[] getCharacterPaths()
          Returns the paths to the serialized character files.
 Character[] getCharacters()
          Returns the Characters in this Area.
 Layer getLayer(int index)
           
 Layer[] getLayers()
          Returns the Layers for this Area.
 void onDeserialize(Formatter formatter, java.lang.String absoluteDir)
          The onDeserialize event should be fired after an object is de-serialized.
 void setAbsoluteDir(java.lang.String absoluteDir)
          Sets the absolute working directory for files.
 void setCharacters(java.lang.String[] characterPaths, Formatter formatter)
          Sets the Characters in this Area.
 void setLayers(Layer[] layers)
          Sets the Layers for this Area.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

absoluteDir

protected transient java.lang.String absoluteDir
Constructor Detail

Area

public Area()
Creates a new instance of Area.


Area

public Area(Layer[] layers,
            java.lang.String[] characterPaths,
            Formatter formatter)
Creates a new instance of Area.

Parameters:
layers - The Layers for this Area.
characterPaths - The relative paths to the serialized character files.
formatter - The formatter to use to deserialize the characters.
Method Detail

setLayers

public void setLayers(Layer[] layers)
Sets the Layers for this Area.

Parameters:
layers - The new Layers for this Area.

getLayers

public Layer[] getLayers()
Returns the Layers for this Area.

Returns:
The Layers for this Area.

addLayer

public void addLayer(Layer layer)
Adds a Layer to this Area.

Parameters:
layer - The Layer to add.

getCharacters

public Character[] getCharacters()
Returns the Characters in this Area.

Returns:
The Characters in this Area.

getCharacterPaths

public java.lang.String[] getCharacterPaths()
Returns the paths to the serialized character files.

Returns:
The paths to the serialized character files.

setCharacters

public void setCharacters(java.lang.String[] characterPaths,
                          Formatter formatter)
Sets the Characters in this Area.

Parameters:
characterPaths - The relative paths to the serialized character files.
formatter - The formatter to use to deserialize the characters.

addCharacter

public void addCharacter(java.lang.String characterPath,
                         Formatter formatter)
Adds a Character to this Area.

Parameters:
characterPath - The relative path to the serialized character files.
formatter - The formatter to use to deserialize the characters.

setAbsoluteDir

public void setAbsoluteDir(java.lang.String absoluteDir)
Sets the absolute working directory for files.

Parameters:
absoluteDir - The full path to the working directory.

getCharacter

public Character getCharacter(int index)
Get the character at the specified index.

Parameters:
index - The index of the Character to get.
Returns:
The character at the specified index.

getLayer

public Layer getLayer(int index)

onDeserialize

public void onDeserialize(Formatter formatter,
                          java.lang.String absoluteDir)
The onDeserialize event should be fired after an object is de-serialized. This allows objects to load transient members, set their working directory, and load Storable members if needed.

Specified by:
onDeserialize in interface Storable
Parameters:
formatter - the formatter to use to load any storable members
absoluteDir - the working directory since all paths stored in the object should be relative