|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.tinyos.sim.script.reflect.SimReflect | +--net.tinyos.sim.script.reflect.SimObject
The SimObject class provides internal access to simulator objects that are not motes.
New objects are obtained by calling the newSimObject() method on
the Sim
class.
Constructor Summary | |
---|---|
SimObject(net.tinyos.sim.script.ScriptInterpreter interp,
net.tinyos.sim.SimDriver driver,
int size,
double x,
double y)
Constructor that's called by sim.newSimObject() |
Method Summary | |
---|---|
void |
addAttribute(java.lang.String name,
net.tinyos.sim.Attribute attrib)
Add the given attribute to the object. |
void |
addAttributeChangedEvent(net.tinyos.sim.Attribute attrib)
Register an attribute changed event for the given attribute. |
net.tinyos.sim.Attribute |
getAttribute(java.lang.String name)
Return the attribute with the given name. |
java.lang.String |
getCoord()
Return the object's coordinates as a string "(x, y)". |
double |
getDistance(double x,
double y)
Return the distance from this mote to the given coordinates |
double |
getDistance(int moteID)
Return the distance from this mote to another. |
double |
getDistance(net.tinyos.sim.script.reflect.SimObject other)
Return the distance from this mote to another. |
double |
getXCoord()
Return the object's X coordinate. |
double |
getYCoord()
Return the object's Y coordinate. |
boolean |
isSelected()
Determine if the object is selected. |
void |
move(double dx,
double dy)
Move the mote in virtual space by a given amount. |
void |
moveTo(double x,
double y)
Move the mote in virtual space to the given location |
void |
removeAttribute(java.lang.String name)
Remove the given attribute from the object. |
void |
setCoord(double x,
double y)
Move the mote in virtual space to the given location. |
void |
setSelected()
Add the object to the selected set. |
void |
setUnselected()
Remove the object from the selected set. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SimObject(net.tinyos.sim.script.ScriptInterpreter interp, net.tinyos.sim.SimDriver driver, int size, double x, double y)
Method Detail |
public void addAttribute(java.lang.String name, net.tinyos.sim.Attribute attrib)
name
- the name of the attributeattrib
- the attributepublic net.tinyos.sim.Attribute getAttribute(java.lang.String name)
name
- the name of the attribute
public void removeAttribute(java.lang.String name)
name
- the name of the attributepublic void addAttributeChangedEvent(net.tinyos.sim.Attribute attrib)
attrib
- the attributepublic java.lang.String getCoord()
public double getXCoord()
public double getYCoord()
public double getDistance(net.tinyos.sim.script.reflect.SimObject other)
other
- the other Mote instancepublic double getDistance(int moteID)
moteID
- the other Mote idpublic double getDistance(double x, double y)
x
- the X coordinate of the target pointy
- the Y coordinate of the target pointpublic void move(double dx, double dy)
dx
- distance to move in the X directiondy
- distance to move in the Y directionpublic void moveTo(double x, double y)
x
- new X coordinatey
- new Y coordinatepublic void setCoord(double x, double y)
x
- new X coordinatey
- new Y coordinatepublic boolean isSelected()
public void setSelected()
public void setUnselected()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |