com.huguesjohnson.hapsby
Class SaveGameProperty

java.lang.Object
  extended by com.huguesjohnson.hapsby.SaveGameProperty
All Implemented Interfaces:
java.io.Serializable

public class SaveGameProperty
extends java.lang.Object
implements java.io.Serializable

Class to describe a property (value) of a save game.

Author:
Hugues Johnson
See Also:
Serialized Form

Nested Class Summary
static class SaveGameProperty.ByteOrder
          public enum ByteOrder { LOW_BYTE_FIRST, HIGH_BYTE_FIRST }
Whether values are stored high byte first (Big-Endian) or low byte first (Little-Endian).
static class SaveGameProperty.DataType
          public enum DataType { TYPE_INTEGER, TYPE_STRING }
Data type for the property.
 
Constructor Summary
SaveGameProperty()
          Default constructor.
SaveGameProperty(java.lang.String name, java.lang.String description, SaveGameProperty.ByteOrder byteOrder, SaveGameProperty.DataType dataType, int address, int length, int maxValue, int minValue)
          Creates a new property.
 
Method Summary
 int getAddress()
          Returns the address of the property in decimal.
 SaveGameProperty.ByteOrder getByteOrder()
          Returns the byte order of the property.
 SaveGameProperty.DataType getDataType()
          Returns the data type of the property.
 java.lang.String getDescription()
          Returns the description of the property.
 int getLength()
          Returns the length (number of bytes) of the property.
 int getMaxValue()
          Returns the maximum value of the property, in decimal.
 int getMinValue()
          Returns the minimum value of the property, in decimal.
 java.lang.String getName()
          Returns the name of the property.
 void setAddress(int address)
          Sets the address & checks if it's valid.
 void setByteOrder(SaveGameProperty.ByteOrder byteOrder)
          Sets the byte order of this property.
 void setDataType(SaveGameProperty.DataType dataType)
          Sets the data type of this property.
 void setDescription(java.lang.String description)
          Sets the description of the property.
 void setLength(int length)
          Sets the length property, in decimal format, must be > 0.
 void setMaxValue(int maxValue)
          Sets the maximum value of the property, in decimal format.
 void setMinValue(int minValue)
          Sets the minimum value of the property, in decimal format.
 void setName(java.lang.String name)
          Sets the name of the property.
 java.lang.String toString()
          Returns the property name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SaveGameProperty

public SaveGameProperty()
Default constructor.


SaveGameProperty

public SaveGameProperty(java.lang.String name,
                        java.lang.String description,
                        SaveGameProperty.ByteOrder byteOrder,
                        SaveGameProperty.DataType dataType,
                        int address,
                        int length,
                        int maxValue,
                        int minValue)
Creates a new property.

Parameters:
name - Name of the property.
description - Description of the property.
byteOrder - Byte order of the property.
dataType - Data type of the the property.
address - Address of new property, in decimal.
length - Length (number of bytes) of the property.
maxValue - Maximum value of the property, in decimal.
minValue - Minimum value of the property, in decimal.
Method Detail

setName

public final void setName(java.lang.String name)
Sets the name of the property.

Parameters:
name - The new name of the property.

setDescription

public final void setDescription(java.lang.String description)
Sets the description of the property.

Parameters:
description - The new description of the property.

setAddress

public final void setAddress(int address)
                      throws java.lang.Exception
Sets the address & checks if it's valid.

Parameters:
address - The new address in decimal form, must be >= 0.
Throws:
java.lang.Exception - Exception thrown if address is <=0.

setLength

public final void setLength(int length)
                     throws java.lang.Exception
Sets the length property, in decimal format, must be > 0.

Parameters:
length - The new length of the property.
Throws:
java.lang.Exception - Exception thrown if length is <=0.

setMaxValue

public final void setMaxValue(int maxValue)
Sets the maximum value of the property, in decimal format.

Parameters:
maxValue - The new maximum value of the property.

setMinValue

public final void setMinValue(int minValue)
Sets the minimum value of the property, in decimal format.

Parameters:
minValue - The new minimum value of the property.

getName

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

Returns:
The name of the property.

getDescription

public final java.lang.String getDescription()
Returns the description of the property.

Returns:
The description of the property.

getDataType

public final SaveGameProperty.DataType getDataType()
Returns the data type of the property.

Returns:
The data type of the property.

getAddress

public final int getAddress()
Returns the address of the property in decimal.

Returns:
The address of the property.

getLength

public final int getLength()
Returns the length (number of bytes) of the property.

Returns:
The length (number of bytes) of the property.

getMaxValue

public final int getMaxValue()
Returns the maximum value of the property, in decimal.

Returns:
The maximum value of the property.

getMinValue

public final int getMinValue()
Returns the minimum value of the property, in decimal.

Returns:
The minimum value of the property.

getByteOrder

public SaveGameProperty.ByteOrder getByteOrder()
Returns the byte order of the property.

Returns:
Byte order of the property.

setByteOrder

public void setByteOrder(SaveGameProperty.ByteOrder byteOrder)
Sets the byte order of this property.

Parameters:
byteOrder - The new byte order of this property.

setDataType

public void setDataType(SaveGameProperty.DataType dataType)
Sets the data type of this property.

Parameters:
dataType - The new data type of this property.

toString

public java.lang.String toString()
Returns the property name. toString() is implicitly called by JList and JTable components when complex objects are added. This needs to return the text that should be displayed in these controls. In this case, it's the property name.

Overrides:
toString in class java.lang.Object
Returns:
The game title.


Copyright © 2000-2009 Hugues Johnson