java.lang.Object
org.objectstyle.ashwood.graph.layout.LayerVertex
- All Implemented Interfaces:
- java.lang.Comparable, NestingTreeNode
- Direct Known Subclasses:
- BorderVertex
- public class LayerVertex
- extends java.lang.Object
- implements java.lang.Comparable, NestingTreeNode
LAYER_INDEX_COMPARATOR
public static final java.util.Comparator LAYER_INDEX_COMPARATOR
POSITION_IN_LAYER
public static final org.objectstyle.ashwood.function.DoubleFunction POSITION_IN_LAYER
rank
private int rank
indexInLayer
private int indexInLayer
weight
private double weight
centerX
private double centerX
centerY
private double centerY
width
private double width
height
private double height
predecessors
private java.util.ArrayList predecessors
successors
private java.util.ArrayList successors
userVertex
private java.lang.Object userVertex
parentSubgraph
private NestedSubgraph parentSubgraph
leftX
private double leftX
rightX
private double rightX
classIndex
private int classIndex
LayerVertex
public LayerVertex(java.lang.Object userVertex,
int predCapacity,
int succCapacity)
getSuccessorIndices
public int[] getSuccessorIndices()
compareTo
public int compareTo(java.lang.Object o)
- Description copied from interface:
java.lang.Comparable
- Compares this object with another, and returns a numerical result based
on the comparison. If the result is negative, this object sorts less
than the other; if 0, the two are equal, and if positive, this object
sorts greater than the other. To translate this into boolean, simply
perform
o1.compareTo(o2) <op> 0, where op
is one of <, <=, =, !=, >, or >=.
You must make sure that the comparison is mutual, ie.
sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) (where sgn() is
defined as -1, 0, or 1 based on the sign). This includes throwing an
exception in either direction if the two are not comparable; hence,
compareTo(null) should always throw an Exception.
You should also ensure transitivity, in two forms:
x.compareTo(y) > 0 && y.compareTo(z) > 0 implies
x.compareTo(z) > 0; and x.compareTo(y) == 0
implies x.compareTo(z) == y.compareTo(z).
- Specified by:
compareTo in interface java.lang.Comparable
rubberForce
public double rubberForce()
predecessorPendulumForce
public double predecessorPendulumForce()
successorPendulumForce
public double successorPendulumForce()
predecessorDeflection
public double predecessorDeflection()
successorDeflection
public double successorDeflection()
deflection
public double deflection()
successorMedianValue
public double successorMedianValue()
predecessorMedianValue
public double predecessorMedianValue()
distanceToLeft
public double distanceToLeft(LayerVertex leftNeighbor)
isTouchingToLeft
public boolean isTouchingToLeft(LayerVertex leftNeighbor,
double minDistance)
minCenterDistance
public double minCenterDistance(LayerVertex vertex,
double spacing)
getMaxX
public double getMaxX()
getMinX
public double getMinX()
getMaxY
public double getMaxY()
getMinY
public double getMinY()
moveX
public double moveX(double distance)
getCenterX
public double getCenterX()
setCenterX
public void setCenterX(double centerX)
getCenterY
public double getCenterY()
setCenterY
public void setCenterY(double centerY)
getIndexInLayer
public int getIndexInLayer()
setIndexInLayer
public void setIndexInLayer(int indexInLayer)
getPredecessors
public java.util.ArrayList getPredecessors()
getRank
public int getRank()
getSuccessors
public java.util.ArrayList getSuccessors()
getUserVertex
public java.lang.Object getUserVertex()
getWeight
public double getWeight()
getWidth
public double getWidth()
setUserVertex
public void setUserVertex(java.lang.Object userVertex)
setWeight
public void setWeight(double weight)
setWidth
public void setWidth(double width)
setRank
public void setRank(int rank)
setSuccessors
public void setSuccessors(java.util.ArrayList successors)
setPredecessors
public void setPredecessors(java.util.ArrayList predecessors)
pendulumForce
private double pendulumForce(java.util.ArrayList adjacent)
deflection
private double deflection(java.util.ArrayList adjacent)
medianValue
private double medianValue(java.util.ArrayList adjacent)
inDegree
public int inDegree()
outDegree
public int outDegree()
degree
public int degree()
getPredecessor
public LayerVertex getPredecessor(int index)
getSuccessor
public LayerVertex getSuccessor(int index)
countLeftCrossings
public int countLeftCrossings(int[] leftNeighborSuccIndices)
getHeight
public double getHeight()
setHeight
public void setHeight(double height)
setGeometry
public void setGeometry(org.objectstyle.ashwood.util.Attribute shapeAttribute)
updateGeometry
public void updateGeometry(org.objectstyle.ashwood.util.Attribute shapeAttribute)
isDummy
public boolean isDummy()
setParentSubgraph
public void setParentSubgraph(NestedSubgraph parentSubgraph)
getParentSubgraph
public NestedSubgraph getParentSubgraph()
- Specified by:
getParentSubgraph in interface NestingTreeNode
setLeftX
public void setLeftX(double leftX)
getLeftX
public double getLeftX()
setRightX
public void setRightX(double rightX)
getRightX
public double getRightX()
setClassIndex
public void setClassIndex(int classIndex)
getClassIndex
public int getClassIndex()
getPosition
public double getPosition()
- Specified by:
getPosition in interface NestingTreeNode
countVertices
public int countVertices(int rank)
- Specified by:
countVertices in interface NestingTreeNode
getVertexCount
public int getVertexCount(int rank)
- Specified by:
getVertexCount in interface NestingTreeNode
computePosition
public double computePosition(int rank)
- Specified by:
computePosition in interface NestingTreeNode
countVertices
public int countVertices()
- Specified by:
countVertices in interface NestingTreeNode
getPosition
public double getPosition(int rank)
- Specified by:
getPosition in interface NestingTreeNode
getVertexCount
public int getVertexCount()
- Specified by:
getVertexCount in interface NestingTreeNode
computePosition
public double computePosition()
- Specified by:
computePosition in interface NestingTreeNode
reindex
public int reindex(int rank,
int firstIndex,
java.util.Comparator comparator,
org.apache.commons.collections.Predicate predicate)
- Specified by:
reindex in interface NestingTreeNode
isDefinedLeftX
public boolean isDefinedLeftX()
isDefinedRightX
public boolean isDefinedRightX()
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object
- Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method
never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string
concatenation with this object. If the result is
null, string concatenation will instead
use "null".
The default implementation returns
getClass().getName() + "@" +
Integer.toHexString(hashCode()).
includesRank
public boolean includesRank(int rank)
- Specified by:
includesRank in interface NestingTreeNode