cad.simcad.worldsimulator.objects.units
Class UnitControler

java.lang.Object
  |
  +--cad.simcad.worldsimulator.objects.units.UnitControler
All Implemented Interfaces:
java.io.Serializable

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

Version:
1.0
Author:
Charles-Philip Bentley
See Also:
Serialized Form

Field Summary
protected  java.util.Enumeration _currentPath
          The current enumeration of PathPlace to follow
protected  PathPlace _nextDest
          The very next destination
protected  MyUnit _unit
           
 
Constructor Summary
UnitControler(MyUnit u)
          Creates new UnitControler
 
Method Summary
 void addPathWayPoints(PathPlaceSet path)
          Append the given path to set of paths for the units.
 void adjacentReached()
           
 PathPlace getIntermediaryDest()
           
 PathPlace getLastPathPlaceToMoveTo()
           
 PathPlace getNextPlace()
          Returns the next place where the units has to move to
 void setFirstPathTo(PathPlaceSet path)
          Replace the current path taken by the unit by the given path
 void stopUnit()
          Remove all the waypoint for the unit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_unit

protected MyUnit _unit

_currentPath

protected java.util.Enumeration _currentPath
The current enumeration of PathPlace to follow


_nextDest

protected PathPlace _nextDest
The very next destination

Constructor Detail

UnitControler

public UnitControler(MyUnit u)
Creates new UnitControler

Method Detail

stopUnit

public void stopUnit()
Remove all the waypoint for the unit. Current path is null However, the next destination is not lost. You can get it with getIntermediaryDest()


getNextPlace

public PathPlace getNextPlace()
Returns the next place where the units has to move to

Post:
the PathPlace in the _currentPath. if _currentPath is empty, we take the next wayPoint

adjacentReached

public void adjacentReached()

getIntermediaryDest

public PathPlace getIntermediaryDest()

getLastPathPlaceToMoveTo

public PathPlace getLastPathPlaceToMoveTo()
Pre:
Returns:
a PathPlace object
Post:
the current last destination of the unit

setFirstPathTo

public void setFirstPathTo(PathPlaceSet path)
                    throws UnitException
Replace the current path taken by the unit by the given path

Pre:
The origin of the Path has to be the same PathPlace as the current PathPlace of the Unit
Throws:
UnitException - if the current PathPlace does not match the origin of path
Post:
if no exception/error is thrown the WayPoints are flushed the current Path for the Unit is set

addPathWayPoints

public void addPathWayPoints(PathPlaceSet path)
Append the given path to set of paths for the units. Used when queueing several move commands

Pre:
the origin must match the destination
Post:

Logo

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