gcspy.interpreter
Class Space

java.lang.Object
  extended by gcspy.interpreter.Space
Direct Known Subclasses:
ClientSpace, ServerSpace

public abstract class Space
extends java.lang.Object

Represents a space

Author:
Tony Printezis

Field Summary
protected  java.lang.String blockInfo
          The block information for a space
protected  byte[] control
          The controls for this space
static byte CONTROL_BACKGROUND
          Control value for a background tile
static byte CONTROL_LINK
          Control value for a control link the link goes after the tile
static byte CONTROL_SEPARATOR
          Control value for a separator the separator goes before the tile
static byte CONTROL_UNUSED
          Control value for an unused tile
static byte CONTROL_USED
          Control value for a used tile
protected static java.lang.String DEFAULT_UNUSED_STRING
          Default string for unused tiles
protected  java.lang.String driverName
          The name of the space's driver
protected  int id
          The space's ID
protected  boolean mainSpace
          Is this the main space?
protected  java.lang.String name
          The space's name
protected  java.lang.String spaceInfo
          The space information
protected  int streamNum
          The number of streams
protected  Stream[] streams
          The streams
protected  java.lang.String[] tileNames
          The names of the tiles
protected  int tileNum
          The number of tiles
protected  java.lang.String title
          The space's title
protected  java.lang.String unusedString
          The string to use for unused tiles
 
Constructor Summary
Space()
          Constructors
 
Method Summary
 void deserialise(BufferedInput input)
          Deserialise the space
 void dump()
          Debugging
 java.lang.String getBlockInfo()
          Get the space's block information
 byte[] getControl()
          Get the controls for this space
 java.lang.String getFullName()
          Get the space's full name
 int getID()
          Get the space's ID
 java.lang.String getName()
          Get the space's name
 java.lang.String getSpaceInfo()
          Get the space information for this space
 Stream getStream(int streamID)
          Return a stream
 int getStreamNum()
          Get teh number of streams in this space
 java.lang.String getTileName(int i)
          Return the name of a tile
 int getTileNum()
          Get the number of tiles in this space
 java.lang.String getTitle()
          Get the space's title
 java.lang.String getUnusedString()
          Get the string used for unused tiles
protected  void initControl()
          Initialise all the controls to unused
static boolean isControlBackground(byte val)
          Is this value a background control?
static boolean isControlLink(byte val)
          Is this value a link control?
static boolean isControlSeparator(byte val)
          Is this value a separator control?
static boolean isControlUnused(byte val)
          Is this value an unused control?
static boolean isControlUsed(byte val)
          Is this value a used control?
 boolean isMainSpace()
          Is this the main space in the visualiser?
 void serialise(BufferedOutput output)
          Serialise the space
 void setControl(byte[] control)
          Set the controls
 void setID(int id)
          Set this space's ID
 void setSpaceInfo(java.lang.String spaceInfo)
          Set the space information
protected  void setupControl()
          Setup ne controls an initialise them to unused
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTROL_USED

public static final byte CONTROL_USED
Control value for a used tile

See Also:
Constant Field Values

CONTROL_BACKGROUND

public static final byte CONTROL_BACKGROUND
Control value for a background tile

See Also:
Constant Field Values

CONTROL_UNUSED

public static final byte CONTROL_UNUSED
Control value for an unused tile

See Also:
Constant Field Values

CONTROL_SEPARATOR

public static final byte CONTROL_SEPARATOR
Control value for a separator the separator goes before the tile

See Also:
Constant Field Values

CONTROL_LINK

public static final byte CONTROL_LINK
Control value for a control link the link goes after the tile

See Also:
Constant Field Values

DEFAULT_UNUSED_STRING

protected static final java.lang.String DEFAULT_UNUSED_STRING
Default string for unused tiles

See Also:
Constant Field Values

id

protected int id
The space's ID


name

protected java.lang.String name
The space's name


driverName

protected java.lang.String driverName
The name of the space's driver


title

protected java.lang.String title
The space's title


blockInfo

protected java.lang.String blockInfo
The block information for a space


tileNum

protected int tileNum
The number of tiles


tileNames

protected java.lang.String[] tileNames
The names of the tiles


streamNum

protected int streamNum
The number of streams


streams

protected Stream[] streams
The streams


spaceInfo

protected java.lang.String spaceInfo
The space information


unusedString

protected java.lang.String unusedString
The string to use for unused tiles


mainSpace

protected boolean mainSpace
Is this the main space?


control

protected byte[] control
The controls for this space

Constructor Detail

Space

public Space()
Constructors

Method Detail

setID

public void setID(int id)
Set this space's ID

Parameters:
id - the ID

setControl

public void setControl(byte[] control)
Set the controls

Parameters:
control - the controls

setSpaceInfo

public void setSpaceInfo(java.lang.String spaceInfo)
Set the space information

Parameters:
spaceInfo - The space information

getID

public int getID()
Get the space's ID

Returns:
the space ID

getName

public java.lang.String getName()
Get the space's name

Returns:
the space's name

getFullName

public java.lang.String getFullName()
Get the space's full name

Returns:
the name of the space and its driver

getTitle

public java.lang.String getTitle()
Get the space's title

Returns:
the title

getBlockInfo

public java.lang.String getBlockInfo()
Get the space's block information

Returns:
the block information for this space

getStreamNum

public int getStreamNum()
Get teh number of streams in this space

Returns:
the number of streams

getTileNum

public int getTileNum()
Get the number of tiles in this space

Returns:
the number of tiles

getTileName

public java.lang.String getTileName(int i)
Return the name of a tile

Parameters:
i - the index of the tile
Returns:
its name

getStream

public Stream getStream(int streamID)
Return a stream

Parameters:
streamID - the ID of the stream
Returns:
the stream

getControl

public byte[] getControl()
Get the controls for this space

Returns:
the controls

getSpaceInfo

public java.lang.String getSpaceInfo()
Get the space information for this space

Returns:
the space information

getUnusedString

public java.lang.String getUnusedString()
Get the string used for unused tiles

Returns:
the string for unused tiles

isMainSpace

public boolean isMainSpace()
Is this the main space in the visualiser?

Returns:
true if this is the main space

setupControl

protected void setupControl()
Setup ne controls an initialise them to unused


initControl

protected void initControl()
Initialise all the controls to unused


isControlUsed

public static boolean isControlUsed(byte val)
Is this value a used control?

Parameters:
val - A control
Returns:
true if the tile is used

isControlBackground

public static boolean isControlBackground(byte val)
Is this value a background control?

Parameters:
val - A control
Returns:
true if the tile is a background tile

isControlUnused

public static boolean isControlUnused(byte val)
Is this value an unused control?

Parameters:
val - A control
Returns:
true if the tile is unused

isControlSeparator

public static boolean isControlSeparator(byte val)
Is this value a separator control?

Parameters:
val - A control
Returns:
true if the tile is a separator

isControlLink

public static boolean isControlLink(byte val)
Is this value a link control?

Parameters:
val - A control
Returns:
true if the tile is a control link

serialise

public void serialise(BufferedOutput output)
Serialise the space

Parameters:
output - The BufferedOutput to use

deserialise

public void deserialise(BufferedInput input)
Deserialise the space

Parameters:
input - The BufferedInput to use

dump

public void dump()
Debugging