org.wilmascope.forcelayout
Class RepulsionlessSpring

java.lang.Object
  extended by org.wilmascope.patterns.Prototype
      extended by org.wilmascope.forcelayout.Force
          extended by org.wilmascope.forcelayout.RepulsionlessSpring
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class RepulsionlessSpring
extends Force

A Force for use by nodes connected by an edge. Attempts to restore the distance between nodes to the natural length of that edge.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.wilmascope.forcelayout.Force
strengthConstant
 
Constructor Summary
RepulsionlessSpring(float strengthConstant)
          Creates a new Spring with the given strength
 
Method Summary
 void calculate()
          Calculate node deltas due to spring forces between all nodes connected by an edge
 void setCluster(Cluster root)
           
 void setRepulsionForce(RepulsionSpring repulsion)
          set the repulsion force object to use if we are to ignore the effects of repulsion accross edges connected by springs...
 
Methods inherited from class org.wilmascope.forcelayout.Force
getStrengthConstant, setStrengthConstant, toString
 
Methods inherited from class org.wilmascope.patterns.Prototype
clone, getTypeName, setTypeName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RepulsionlessSpring

public RepulsionlessSpring(float strengthConstant)
Creates a new Spring with the given strength

Parameters:
strengthConstant - k in Hooke's Law
Method Detail

setCluster

public void setCluster(Cluster root)
Specified by:
setCluster in class Force

setRepulsionForce

public void setRepulsionForce(RepulsionSpring repulsion)
set the repulsion force object to use if we are to ignore the effects of repulsion accross edges connected by springs... this can be done since the spring between edges can arguably be said to already separate the nodes enough. Note that we actually have to recalculate the repulsion accross the nodes so there is some minor cost to setting repulsion not null.


calculate

public void calculate()
Calculate node deltas due to spring forces between all nodes connected by an edge

Specified by:
calculate in class Force