|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.globalse.arena.frag.objects.ObjectManager
The ObjectManager handles all object associated events, such as state updates or controller changes. It is also responsible for checking which objects are in focus and therefore candidates to be controlled. It stores the objects in a HashTable with the object names as keys to speed up object lookup.
Constructor Summary | |
ObjectManager(java.lang.String gameName,
java.lang.String playerName)
Consturctor of the class. |
Method Summary | |
boolean |
addObject(FRAGObject object)
Stores the data of an object in a {@ Hashtable}. |
MathVector |
checkMove(java.lang.String objName,
MathVector newPosition,
MathVector oldPosition)
Called whenever an object changes its position. |
EventDistributor |
eventDistributor()
Returns the eventDistributor for the class. |
java.lang.String |
getFocusCenter()
Returns the focus center of the local peer. |
GameManager |
getGameManager()
Returns the GameManager of the current game. |
java.lang.String |
getGameName()
|
java.lang.String |
getPlayerName()
|
void |
importObjects(java.util.Hashtable extern)
Imports Hashtable with already created objects. |
boolean |
killObject(java.lang.String objName)
deletets a object from the ObjectManager's table. |
FRAGObject |
lookupObject(java.lang.String objName)
Returns the data of an object, which is stored in the class FRAGObject . |
void |
makeOwner(java.lang.String objName)
makes the local peer the owner (and the controller) of the FRAGObject (keyname = objName), sends a ObjectUpdateEvent |
java.util.Hashtable |
objects()
Returns a copy of the Hashtable with all objects (object data and object names as keys). |
void |
processEvent(Event event)
Handles all types of incoming events: ObjectUpdateEvent , ObjectControllerEvent , ObjectActionEvent -
looks for the data, matching the event. |
void |
releaseAndKillObjects(java.lang.String owner)
Remove all objects, owned by a player, from the Hashtable , where the objects data is stored. |
void |
setFocusCenter(java.lang.String focusCenter)
sets the focusCenter of the local peer |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public ObjectManager(java.lang.String gameName, java.lang.String playerName)
gameName
- the name of the gameplayerName
- the name of the playerMethod Detail |
public FRAGObject lookupObject(java.lang.String objName)
FRAGObject
.objName
- the name of the object, which is used for resolving the data of the object, using a hash tableFRAGObject
public boolean addObject(FRAGObject object)
object
- the data of the objectFRAGObject
public void processEvent(Event event)
ObjectUpdateEvent
, ObjectControllerEvent
, ObjectActionEvent
-
looks for the data, matching the event. If the data already exists in the
Hashtable and the version number of the data in the Hashtable is older, then the data is being updated.
ObjectKilledEvent
- in this case the object is deleted from the Hashtable
event
- an event, bound to an object.public void makeOwner(java.lang.String objName)
objName
- name of the objectpublic boolean killObject(java.lang.String objName)
objName
- the name of the object to be deleted
returns boolean true, if succesful; false, if not succesfulpublic MathVector checkMove(java.lang.String objName, MathVector newPosition, MathVector oldPosition)
objName
- name of moved objectnewPosition
- position, the objName would like to move tooldPosition
- old position of objNamepublic void releaseAndKillObjects(java.lang.String owner)
Hashtable
, where the objects data is stored.owner
- Sring the owner of the objectowner != ""
public java.util.Hashtable objects()
Hashtable
with all objects (object data and object names as keys).public void importObjects(java.util.Hashtable extern)
Hashtable
with already created objects.extern
- a Hashtable with objectspublic EventDistributor eventDistributor()
public java.lang.String getGameName()
public java.lang.String getPlayerName()
public java.lang.String getFocusCenter()
public void setFocusCenter(java.lang.String focusCenter)
focusCenter
- String sets the focus centerpublic GameManager getGameManager()
GameManager
of the current game.GameManager
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |