org.zmpp.vm
Class DefaultZObject

java.lang.Object
  extended by org.zmpp.vm.DefaultZObject
All Implemented Interfaces:
ZObject

public class DefaultZObject
extends Object
implements ZObject

This is the default implementation of a ZObject.

Version:
1.0
Author:
Wei-ju Wu

Constructor Summary
DefaultZObject(MemoryAccess memaccess, int address)
          Constructor.
 
Method Summary
 void clearAttribute(int attributeNum)
          Clears the specified attribute.
 int getChild()
          Returns the object number of this object's child object.
 int getNextProperty(int property)
          Returns the next property in the list.
 int getNumProperties()
          Returns the number of properties.
 int getParent()
          Returns the number of this object's parent object.
 int getPropertiesDescriptionAddress()
          Returns the properties description address.
 int getPropertyAddress(int property)
          Returns the address of the specified property.
 byte getPropertyByte(int property, int bytenum)
          Returns the the specified property byte.
 int getPropertySize(int property)
          The number of bytes in the specified property.
 int getPropertyTableAddress()
          Returns this object's property table address.
 int getSibling()
          Returns the object number of this object's sibling object.
 boolean isAttributeSet(int attributeNum)
          Tests if the specified attribute is set.
 boolean isPropertyAvailable(int property)
          Returns true if the specified property is available.
 void setAttribute(int attributeNum)
          Sets the specified attribute.
 void setChild(int child)
          Assigns a new child to this object.
 void setParent(int parent)
          Assigns a new parent object.
 void setPropertyByte(int property, int bytenum, byte value)
          Sets the specified property byte to the given value.
 void setSibling(int sibling)
          Assigns a new sibling to this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultZObject

public DefaultZObject(MemoryAccess memaccess,
                      int address)
Constructor.

Parameters:
address - the start address of the object
Method Detail

isAttributeSet

public boolean isAttributeSet(int attributeNum)
Tests if the specified attribute is set.

Specified by:
isAttributeSet in interface ZObject
Parameters:
attributeNum - the attribute number, starting with 0
Returns:
true if the attribute is set

setAttribute

public void setAttribute(int attributeNum)
Sets the specified attribute.

Specified by:
setAttribute in interface ZObject
Parameters:
attributeNum - the attribute number, starting with 0

clearAttribute

public void clearAttribute(int attributeNum)
Clears the specified attribute.

Specified by:
clearAttribute in interface ZObject
Parameters:
attributeNum - the attribute number, starting with 0

getParent

public int getParent()
Returns the number of this object's parent object.

Specified by:
getParent in interface ZObject
Returns:
the parent object's number

setParent

public void setParent(int parent)
Assigns a new parent object.

Specified by:
setParent in interface ZObject
Parameters:
parent - the new parent object

getSibling

public int getSibling()
Returns the object number of this object's sibling object.

Specified by:
getSibling in interface ZObject
Returns:
the sibling object's object number

setSibling

public void setSibling(int sibling)
Assigns a new sibling to this object.

Specified by:
setSibling in interface ZObject
Parameters:
sibling - the new sibling's object number

getChild

public int getChild()
Returns the object number of this object's child object.

Specified by:
getChild in interface ZObject
Returns:
the child object's object number

setChild

public void setChild(int child)
Assigns a new child to this object.

Specified by:
setChild in interface ZObject
Parameters:
child - the new child

getPropertyTableAddress

public int getPropertyTableAddress()
Returns this object's property table address. Might be made private in the future.

Specified by:
getPropertyTableAddress in interface ZObject
Returns:
the address of this object's property table

getPropertiesDescriptionAddress

public int getPropertiesDescriptionAddress()
Returns the properties description address.

Specified by:
getPropertiesDescriptionAddress in interface ZObject
Returns:
the description address

getNumProperties

public int getNumProperties()
Returns the number of properties.

Specified by:
getNumProperties in interface ZObject
Returns:
the number of properties

getPropertySize

public int getPropertySize(int property)
The number of bytes in the specified property.

Specified by:
getPropertySize in interface ZObject
Parameters:
property - the property number
Returns:
the specified property's number of bytes

getPropertyByte

public byte getPropertyByte(int property,
                            int bytenum)
Returns the the specified property byte.

Specified by:
getPropertyByte in interface ZObject
Parameters:
property - the property number
bytenum - the byte number
Returns:
the value of the specified property byte

getPropertyAddress

public int getPropertyAddress(int property)
Returns the address of the specified property. Note that this will not include the length byte.

Specified by:
getPropertyAddress in interface ZObject
Parameters:
property - the property
Returns:
the specified property's address

isPropertyAvailable

public boolean isPropertyAvailable(int property)
Returns true if the specified property is available.

Specified by:
isPropertyAvailable in interface ZObject
Parameters:
property - the property number
Returns:
true if the property is available, false otherwise

getNextProperty

public int getNextProperty(int property)
Returns the next property in the list. If property is 0, this will return the first propery number, if propery is the last element in the list, it will return 0.

Specified by:
getNextProperty in interface ZObject
Parameters:
property - the property number
Returns:
the next property in the list or 0

setPropertyByte

public void setPropertyByte(int property,
                            int bytenum,
                            byte value)
Sets the specified property byte to the given value.

Specified by:
setPropertyByte in interface ZObject
Parameters:
property - the property
bytenum - the byte number
value - the value


Copyright © 2005 . All Rights Reserved.