|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectch.epfl.craft.maglib.magnet.DefaultMagnetNode
| Field Summary | |
protected int |
force
The force of the field generated by this node. |
protected java.awt.Point |
origin
The origin of the node |
protected java.awt.Point |
targetOrigin
The point where the node should be. |
protected java.lang.Object |
userObject
The core data of this node |
| Constructor Summary | |
DefaultMagnetNode()
Creates a new MagnetNode instance. |
|
DefaultMagnetNode(java.lang.Object userObject)
Creates a new MagnetNode instance with the given data. |
|
| Method Summary | |
int |
getForceField()
Returns the force of the field generated by this magnet. |
java.awt.Point |
getOrigin()
Returns the orgin of this MagnetNode instance. |
float |
getSimilarityWith(MagnetNode aMagnetNode)
Returns the similarity with aMagnetNode. |
java.lang.Object |
getUserObject()
Returns the user object of the receiver. |
void |
setForceField(int force)
Sets the force of the field generated by this magnet. |
void |
setOrigin(java.awt.Point newOrigin)
Sets the orgin of this MagnetNode instance. |
void |
setTargetOrigin(java.awt.Point newTargetOrigin)
Sets the target orgin of this MagnetNode instance. |
void |
setUserObject(java.lang.Object object)
Resets the user object of the receiver to object. |
java.lang.String |
toString()
Returns the result of sending toString() to this node's
user object, or null if this node has no user object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected java.awt.Point origin
protected java.awt.Point targetOrigin
protected java.lang.Object userObject
protected int force
| Constructor Detail |
public DefaultMagnetNode()
MagnetNode instance.
public DefaultMagnetNode(java.lang.Object userObject)
MagnetNode instance with the given data.
userObject - the object to be used by this node as internal data| Method Detail |
public java.awt.Point getOrigin()
MagnetNode instance.
getOrigin in interface MagnetNodeMagnetNode instance.public void setOrigin(java.awt.Point newOrigin)
MagnetNode instance. Using this method
will set the origin of the node immediately, while using setTargetOrigin(java.awt.Point)
would do it progressively at some given speed.
setOrigin in interface MagnetNodenewOrigin - the new origin of this MagnetNode instance.public void setTargetOrigin(java.awt.Point newTargetOrigin)
MagnetNode instance. Using this method
will set the origin of the node progressively, while using setOrigin(java.awt.Point)
would do it immediately. If the node was still moving to a previous target origin
when setting a new target, the previous one is "forgotten".
setTargetOrigin in interface MagnetNodenewTargetOrigin - the target origin of this MagnetNode instance.public void setForceField(int force)
setForceField in interface MagnetNodeforce - the force of the fieldpublic int getForceField()
getForceField in interface MagnetNodepublic float getSimilarityWith(MagnetNode aMagnetNode)
aMagnetNode.
getSimilarityWith in interface MagnetNodeaMagnetNode - a aMagnetNode.
MagnetNode instance and aMagnetNode.public void setUserObject(java.lang.Object object)
setUserObject in interface MagnetNodeobject - the object that represents the data of this node.public java.lang.Object getUserObject()
public java.lang.String toString()
toString() to this node's
user object, or null if this node has no user object.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||