feud.testgame.model
Class ServerObjectManager

java.lang.Object
  extended byfeud.testgame.model.ServerObjectManager

public class ServerObjectManager
extends java.lang.Object

A manager class that handles local objects on the server identified by a combination of client- and objectID.


Constructor Summary
ServerObjectManager()
          Create a new manager.
 
Method Summary
 void fill(ExtendedDataContainer dc)
          Fills a data container with data from the all local objects on the server.
 LocalObjectList getLocalObjectList(ClientInfo ci)
          Returns a list of all local objects for a specific client.
 LocalObject getLocalObjectToIDs(int objID, int clientID)
          Gets a local object stored on the server identified by the clientID and the objectID.
 void remove(ClientInfo ci)
          Removes a client completely from the list, i.e.
 void removeObject(LocalObject lo, ClientInfo ci)
          Removes an object from the server's list, i.e. it doesn't exist on the client any longer.
 void setOrUpdate(ExtendedDataContainer ec)
          Takes the input transmitted by a client and creates or updates the local instances that represent the objects on the client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerObjectManager

public ServerObjectManager()
Create a new manager.

Method Detail

getLocalObjectToIDs

public LocalObject getLocalObjectToIDs(int objID,
                                       int clientID)
Gets a local object stored on the server identified by the clientID and the objectID. The actual client don't know thing about which local object ID their objects will get on the server which is why they can't transmit them. All they know is, how THEY identify their objects. This method maps between those two worlds.

Parameters:
objID - the objectID
clientID - the clientID
Returns:
LocalObject the corresponding local object

fill

public void fill(ExtendedDataContainer dc)
Fills a data container with data from the all local objects on the server.

Parameters:
dc - the container to fill

setOrUpdate

public void setOrUpdate(ExtendedDataContainer ec)
Takes the input transmitted by a client and creates or updates the local instances that represent the objects on the client.

Parameters:
ec - the container with the client's objects

removeObject

public void removeObject(LocalObject lo,
                         ClientInfo ci)
Removes an object from the server's list, i.e. it doesn't exist on the client any longer.

Parameters:
lo - the object to remove
ci - the client info

getLocalObjectList

public LocalObjectList getLocalObjectList(ClientInfo ci)
Returns a list of all local objects for a specific client.

Parameters:
ci - the client for the client in question
Returns:
LocalObjectList the list of local objects for this client that the server knows of

remove

public void remove(ClientInfo ci)
Removes a client completely from the list, i.e.-it kills all of its local objects on the server.

Parameters:
ci - the client