|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gecco.server.core.UnitType
This class represents a unit type. A unit type encapsulates information that is common to all units of the same type, such as the image of the unit used at the clients, the event handler for units of this type, the class that implements the unit.
Field Summary | |
(package private) HashMap |
actionDefs
All ActionDefinitions of this unit type, hashed on the action name. |
(package private) EventHandler |
eventHandler
Reference to the event handler for this unit type. |
(package private) byte[] |
imageData
The image used by all units of this type at the clients. |
(package private) String |
name
The name of the unit type. |
private TypedProperties |
properties
The user-defined properties of this unit type, with default values. |
(package private) int |
range
The visibility range of units of this type. |
(package private) double |
rangeSquare
The square of the visibility range. |
(package private) Class |
unitClass
The class that implements this unit type. |
(package private) int[] |
visionStart
??? |
(package private) int[] |
visionStop
Description of the Field |
Constructor Summary | |
UnitType(String _name)
Constructor for the UnitType object |
Method Summary | |
void |
addAction(String name,
String description,
String argumentType,
String actionHandlerClassName)
Adds an action to the unit type. |
String |
getActionArgumentType(String actionName)
Gets the argument type of an action associated with this unit type. |
Class |
getActionClass(String actionName)
Gets the class implementing a given class, associated with this unit type. |
ActionDefinition |
getActionDefinition(String actionName)
Gets the ActionDefinition associated with a given action. |
Collection |
getActionDefinitions()
Gets the definitions of all actions associated with this unit type. |
String |
getActionDescription(String actionName)
Gets the description of an action associated with this unit type. |
Set |
getActionNames()
Gets the names of all actions associated with this unit type. |
double |
getDoubleProperty(String name)
Gets the DoubleProperty attribute of the Unit object |
EventHandler |
getEventHandler()
Gets the EventHandler attribute of the UnitType object |
byte[] |
getImageData()
Gets the ImageData attribute of the UnitType object |
int |
getIntProperty(String name)
Gets the IntProperty attribute of the Unit object |
String |
getName()
Gets the Name attribute of the UnitType object |
TypedProperties |
getProperties()
Gets the Properties attribute of the Unit object |
Object |
getProperty(String name)
Gets the Property attribute of the Unit object |
String |
getPropertyType(String name)
Gets the PropertyType attribute of the UnitType object |
int |
getRange()
Gets the visibility range |
double |
getRangeSquare()
Gets the square of the visibility range. |
String |
getStringProperty(String name)
Gets the StringProperty attribute of the Unit object |
Class |
getUnitClass()
Gets the UnitClass attribute of the UnitType object |
int[] |
getVisionStart()
Gets the VisionStart attribute of the UnitType object |
int[] |
getVisionStop()
Gets the VisionStop attribute of the UnitType object |
boolean |
isActionInstantaneous(String actionName)
Determines if a given action associated with this unit type is instantaneous. |
void |
setEventHandler(String evtHandlerClassName)
Sets the EventHandler attribute of the UnitType object |
void |
setImageData(byte[] _imageData)
Sets the ImageData attribute of the UnitType object |
void |
setProperty(String name,
double value)
Sets the DoubleProperty attribute of the UnitType object |
void |
setProperty(String name,
int value)
Sets the IntProperty attribute of the UnitType object |
void |
setProperty(String name,
String value)
Sets the StringProperty attribute of the UnitType object |
void |
setRange(int _range)
Sets the visibility range of the unit type. |
private void |
setRow(int start,
int stop,
int y)
Sets the Row attribute of the UnitType object |
void |
setUnitClass(String unitClassName)
Sets the class that implements units of this type. |
Methods inherited from class java.lang.Object |
|
Field Detail |
String name
byte[] imageData
EventHandler eventHandler
Class unitClass
int range
double rangeSquare
int[] visionStart
int[] visionStop
HashMap actionDefs
private TypedProperties properties
Constructor Detail |
public UnitType(String _name)
_name
- The name of the unit type.Method Detail |
public void setImageData(byte[] _imageData)
_imageData
- The new ImageData valuepublic void setRange(int _range)
_range
- The new rangepublic void setEventHandler(String evtHandlerClassName)
evtHandlerClassName
- The new EventHandler class name.public void setUnitClass(String unitClassName)
unitClassName
- The name of the class.public void setProperty(String name, double value)
name
- The new DoubleProperty namevalue
- The new DoubleProperty valuepublic void setProperty(String name, int value)
name
- The new IntProperty namevalue
- The new IntProperty valuepublic void setProperty(String name, String value)
name
- The new IntProperty namevalue
- The new IntProperty valuepublic String getName()
public byte[] getImageData()
public int getRange()
public double getRangeSquare()
public int[] getVisionStart()
public int[] getVisionStop()
public EventHandler getEventHandler()
public Class getUnitClass()
public Set getActionNames()
public Collection getActionDefinitions()
public ActionDefinition getActionDefinition(String actionName)
actionName
- The name of the action.public boolean isActionInstantaneous(String actionName)
actionName
- The name of the action.public Class getActionClass(String actionName)
actionName
- The name of the action.public String getActionDescription(String actionName)
actionName
- The name of the action.public String getActionArgumentType(String actionName)
actionName
- The name of the action.public TypedProperties getProperties()
public Object getProperty(String name)
name
- Description of Parameterpublic String getPropertyType(String name)
name
- Description of Parameterpublic double getDoubleProperty(String name)
name
- Description of Parameterpublic int getIntProperty(String name)
name
- Description of Parameterpublic String getStringProperty(String name)
name
- Description of Parameterpublic void addAction(String name, String description, String argumentType, String actionHandlerClassName)
name
- The name of the action.description
- The description of the action.argumentType
- The argument type of the action.actionHandlerClassName
- The name of the class that implements the
action.private void setRow(int start, int stop, int y)
start
- The new Row valuestop
- The new Row valuey
- The new Row value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |