|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--generator2.MovingObject
Class representing a moving object.
| Constructor Summary | |
MovingObject(int id,
int objClass,
Node start,
Node dest,
int time)
Constructor. |
|
| Method Summary | |
void |
addToContainer(MovingObjects container)
Adds the moving object to the container. |
static double |
computeDistance(double x1,
double y1,
double x2,
double y2)
Computes the distance between two points. |
boolean |
computeRoute()
Computes a new route from the current position of the object to its destination. |
protected void |
decreaseUsage(PathEdge actPathEdge)
Decreases the usage in the path until one path edge is reached. |
protected PathEdge |
getActPathEdge()
Return the current path edge where the object is. |
protected Node |
getDestinationNode()
Return the destination node. |
int |
getId()
Returns the identifier of the object. |
int |
getObjectClass()
Returns the object class. |
int |
getRepNum()
Returns the report number of the object. |
protected Node |
getStartingNode()
Return the starting node. |
boolean |
move(int newTime,
Reporter reporter)
Moves the object to the position at the new time. |
void |
reportEnd(Reporter reporter)
Reports that the moving object has reached its destination. |
void |
reportNewObject(Reporter reporter)
Reports a new moving object. |
void |
setDestination(Node dest)
Sets the destination node. |
void |
setRepNum(int num)
Sets the report number of the object. |
void |
setStart(Node start)
Sets the starting node. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public MovingObject(int id,
int objClass,
Node start,
Node dest,
int time)
id - object identifierobjClass - object classstart - starting nodedest - destination nodetime - starting time| Method Detail |
public void addToContainer(MovingObjects container)
container - container
public static double computeDistance(double x1,
double y1,
double x2,
double y2)
x1 - x-coordinate of the 1st pointy1 - y-coordinate of the 1st pointx2 - x-coordinate of the 2nd pointy2 - y-coordinate of the 2nd point
public boolean computeRoute()
protected void decreaseUsage(PathEdge actPathEdge)
actPathEdge - the path edge which stops the operationprotected PathEdge getActPathEdge()
protected Node getDestinationNode()
public int getId()
public int getObjectClass()
public int getRepNum()
protected Node getStartingNode()
public boolean move(int newTime,
Reporter reporter)
newTime - new timereporter - reporter
public void reportEnd(Reporter reporter)
reporter - reporterpublic void reportNewObject(Reporter reporter)
reporter - the reporter objectpublic void setDestination(Node dest)
public void setRepNum(int num)
num - the new report numberpublic void setStart(Node start)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||