cad.simcad.objectserver.spec.sim
Interface SimEnvironment

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
SimWorldCAC
All Known Implementing Classes:
CaCWorld, MyWorld

public interface SimEnvironment
extends java.io.Serializable

The SimEnvironment is the container for all SimObjects. Interface towards a simulated World that may be simulated.

Author:
Charles-Philip Bentley

Method Summary
 SimObject createSimObject(java.lang.String name, Owner o)
          Adds a new Simulated Objects in the World
 SimObject createSimObject(java.lang.String name, Owner o, PathPlace pp)
          Adds a new Simulated Objects in the World
 AbstractMap getAbstractMap()
          Returns the Map making this world
 Owner getDefaultOwner()
          Return the default owner for this SimEnvironment
 Owner getGaiaOwner()
          Returns the Owner known as Gaia i.e Mother Nature
 Drawable2DObject[] getMiniMapDrawable2DObjects()
          Returns an Array of all the Drawable2DObject the SimWorld knows about
 java.util.Vector getMovingSimulatedObjects()
          Returns a Vector of the simulated units
 java.util.Vector getNotMovingSimulatedBuildings()
          Returns a Vector of the simulated structures
 SimObject[][] getObjects(int xcenter, int ycenter, int halfWidth, int halfHeight)
          Returns the SimObject that can been seen in the area defined by the parameters
 RandomGenerator getRandonGenerator()
          Returns a Random Generator for this world
 SimObjectServer getSimObjectServer()
          Returns the SimObjectServer of the SimEnvironment
 java.util.Vector getSimulatedObjects()
          Returns a Vector of all the simulated Objects
 SimViewer getSimViewer()
           
 StatServer getStatServer()
          Returns the StatServer of the SimEnvironment
 java.util.Vector getStructureTypesVector()
          Returns a Vector of all the different SimObject of type "structure"
 java.util.Vector getUnitTypesVector()
          Returns a Vector of all the different SimObject of type "unit"
 long nextSerial()
          Returns the next serial number for this SimEnvironment
 void removeSimulatedObject(SimObject so)
          Remove the given SimObject from the SimEnvironment
 void setSimViewer(SimViewer sv)
           
 void updateObjectPosition(SimObject so, PathPlace oldPathPlace, PathPlace newPathPlace)
          Update the position of the object given in parameters
 

Method Detail

getSimulatedObjects

public java.util.Vector getSimulatedObjects()
Returns a Vector of all the simulated Objects

Pre:
-
Post:
Every object is returned as a Vector. You will find units and structures objects you do not find objects belonging to another object : MDTSim and GPSSim are not in the Vector

getMovingSimulatedObjects

public java.util.Vector getMovingSimulatedObjects()
Returns a Vector of the simulated units

Pre:
-
Returns:
a Vector object
Post:
-

getNotMovingSimulatedBuildings

public java.util.Vector getNotMovingSimulatedBuildings()
Returns a Vector of the simulated structures

Pre:
-
Returns:
a Vector object
Post:
-

getAbstractMap

public AbstractMap getAbstractMap()
Returns the Map making this world

Pre:
-
Returns:
an AbstractMap object
Post:
The World is made of a map. This map is returned

getStructureTypesVector

public java.util.Vector getStructureTypesVector()
Returns a Vector of all the different SimObject of type "structure"

Pre:
Returns:
a Vector object
Post:
A Vector is built. In this vector we do not find duplicate objects We find every single SimObject of type "structure" the SimWorld knows about

getUnitTypesVector

public java.util.Vector getUnitTypesVector()
Returns a Vector of all the different SimObject of type "unit"

Pre:
Returns:
a Vector object
Post:
A Vector is built. In this vector we do not find duplicate objects We find every single SimObject the SimWorld knows about

updateObjectPosition

public void updateObjectPosition(SimObject so,
                                 PathPlace oldPathPlace,
                                 PathPlace newPathPlace)
Update the position of the object given in parameters

Parameters:
so - The SimObject to update
oldPathPlace - the old position of the SimObject. oldPathPlace belongs to Map
newPathPlace - the new position of the SimObject.
Pre:
A map. oldPathPlace and newPathPlace belongs to the map and are adjacent
Post:
The position of the SimObject has been updated on the Map

getObjects

public SimObject[][] getObjects(int xcenter,
                                int ycenter,
                                int halfWidth,
                                int halfHeight)
Returns the SimObject that can been seen in the area defined by the parameters

Parameters:
xcenter - the x coordinate
ycenter - the y coordinate
halfWidth - the number of coordinates we have to take into account right/left xcenter
halfHeight - the number of coordinates we have to take into account above/below ycenter
Pre:
Params defines a rectangle
Returns:
an Array of SimObjects.
Post:
All the object in the encompassing rectangle are returned size==0 if no SimObject

createSimObject

public SimObject createSimObject(java.lang.String name,
                                 Owner o)
Adds a new Simulated Objects in the World

Parameters:
name - the name of the Object to create
o - the Owner of this object to be made
Pre:
a World with a Map. World knows about object with name name
Returns:
a SimObject
Post:
The SimObject of name name is made and returned. It is not added to the map, nor to the world

createSimObject

public SimObject createSimObject(java.lang.String name,
                                 Owner o,
                                 PathPlace pp)
Adds a new Simulated Objects in the World

Parameters:
name - the name of the Object to create
o - the Owner of this object to be made
pp - the PathPlace where the new Object should be placed
Pre:
a World with a Map. World knows about object with name name
Returns:
a SimObject
Post:
The SimObject of name name is made and returned. It is added to the map at the corresponding PathPalce

getDefaultOwner

public Owner getDefaultOwner()
Return the default owner for this SimEnvironment

Pre:
A correctly initialized SimEnvironment
Returns:
an Owner object
Post:
Every SimEnvironment has a default owner for its SimObjects.

getGaiaOwner

public Owner getGaiaOwner()
Returns the Owner known as Gaia i.e Mother Nature

Pre:
always applicable
Returns:
an Owner object
Post:
the Gaia Owner of the World is returned. cannot be null;

getMiniMapDrawable2DObjects

public Drawable2DObject[] getMiniMapDrawable2DObjects()
Returns an Array of all the Drawable2DObject the SimWorld knows about

Pre:
-
Returns:
an Array of Drawable2DObject. Empty array if there is none
Post:
-

getSimObjectServer

public SimObjectServer getSimObjectServer()
Returns the SimObjectServer of the SimEnvironment

Pre:
-
Returns:
a SimObjectServer
Post:
-

getStatServer

public StatServer getStatServer()
Returns the StatServer of the SimEnvironment

Pre:
-
Returns:
a StatServer
Post:
-

nextSerial

public long nextSerial()
Returns the next serial number for this SimEnvironment

Pre:
-
Returns:
a long value
Post:
a unique long value, never returned before

getRandonGenerator

public RandomGenerator getRandonGenerator()
Returns a Random Generator for this world


getSimViewer

public SimViewer getSimViewer()

removeSimulatedObject

public void removeSimulatedObject(SimObject so)
Remove the given SimObject from the SimEnvironment

Parameters:
so - a SimObject
Pre:
The SimObject so is part of the SimEnvironment
Post:
The SimObject so is removed from the SimEnvironment

setSimViewer

public void setSimViewer(SimViewer sv)

Logo

With the help of www.sourceforge.net and www.info.ucl.ac.be