Class NodeParticle
java.lang.Object
org.miv.pherd.Particle
org.graphstream.ui.layout.springbox.NodeParticle
- Direct Known Subclasses:
LinLogNodeParticle,SpringBoxNodeParticle
public abstract class NodeParticle
extends org.miv.pherd.Particle
Base implementation of a node particle to be used in the
BarnesHutLayout to represent nodes and choose their positions.
Several abstract methods have to be overrided to provide a computation of the layout (all the attraction/repulsion computation is done in this class):
attraction(Vector3)repulsionN2(Vector3)repulsionNLogN(Vector3)
-
Field Summary
Fields Modifier and Type Field Description doubleattEAttraction energy for this node only.Vector3dispDisplacement vector.booleanfrozenShould the node move?.doublelenLast computed displacement vector length.ArrayList<EdgeSpring>neighboursSet of edge connected to this node.PrintStreamoutIf non null, all this node statistics will be output to this stream.doublerepERepulsion energy for this node only. -
Constructor Summary
Constructors Constructor Description NodeParticle(BarnesHutLayout box, String id)New node.NodeParticle(BarnesHutLayout box, String id, double x, double y, double z)New node at a given position. -
Method Summary
Modifier and Type Method Description Collection<EdgeSpring>getEdges()All the edges connected to this node.voidinserted()voidmove(int time)voidmoveOf(double dx, double dy, double dz)Force a node to move from a given vector.voidmoveTo(double x, double y, double z)Force a node to move at a given position.voidnextStep(int time)voidregisterEdge(EdgeSpring e)The given edge is connected to this node.voidremoved()voidremoveNeighborEdges()Remove all edges connected to this node.voidunregisterEdge(EdgeSpring e)The given edge is no more connected to this node.Methods inherited from class org.miv.pherd.Particle
closeTo, closeTo, getAttribute, getAttributeKeyIterator, getCell, getId, getPosition, getWeight, removeAttribute, setAttribute, setCell, setWeight, suicide
-
Field Details
-
neighbours
Set of edge connected to this node. -
frozen
public boolean frozenShould the node move?. -
disp
Displacement vector. -
len
public double lenLast computed displacement vector length. -
attE
public double attEAttraction energy for this node only. -
repE
public double repERepulsion energy for this node only. -
out
If non null, all this node statistics will be output to this stream.
-
-
Constructor Details
-
NodeParticle
New node. The node is placed at random in the space of the simulation.- Parameters:
box- The spring box.id- The node identifier.
-
NodeParticle
New node at a given position.- Parameters:
box- The spring box.id- The node identifier.x- The abscissa.y- The ordinate.z- The depth.
-
-
Method Details
-
getEdges
All the edges connected to this node.- Returns:
- A set of edges.
-
move
public void move(int time)- Specified by:
movein classorg.miv.pherd.Particle
-
nextStep
public void nextStep(int time)- Overrides:
nextStepin classorg.miv.pherd.Particle
-
moveOf
public void moveOf(double dx, double dy, double dz)Force a node to move from a given vector.- Parameters:
dx- The x component.dy- The y component.dz- The z component.
-
moveTo
public void moveTo(double x, double y, double z)Force a node to move at a given position.- Parameters:
x- The new x.y- The new y.z- The new z.
-
registerEdge
The given edge is connected to this node.- Parameters:
e- The edge to connect.
-
unregisterEdge
The given edge is no more connected to this node.- Parameters:
e- THe edge to disconnect.
-
removeNeighborEdges
public void removeNeighborEdges()Remove all edges connected to this node. -
inserted
public void inserted()- Specified by:
insertedin classorg.miv.pherd.Particle
-
removed
public void removed()- Specified by:
removedin classorg.miv.pherd.Particle
-