Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.objectstyle.ashwood.graph.layout
Class LayerVertex  view LayerVertex download LayerVertex.java

java.lang.Object
  extended byorg.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


Nested Class Summary
static class LayerVertex.LayerIndexComparator
           
static class LayerVertex.PositionInLayer
           
 
Field Summary
private  double centerX
           
private  double centerY
           
private  int classIndex
           
private  double height
           
private  int indexInLayer
           
static java.util.Comparator LAYER_INDEX_COMPARATOR
           
private  double leftX
           
private  NestedSubgraph parentSubgraph
           
static org.objectstyle.ashwood.function.DoubleFunction POSITION_IN_LAYER
           
private  java.util.ArrayList predecessors
           
private  int rank
           
private  double rightX
           
private  java.util.ArrayList successors
           
private  java.lang.Object userVertex
           
private  double weight
           
private  double width
           
 
Constructor Summary
LayerVertex(java.lang.Object userVertex, int predCapacity, int succCapacity)
           
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this object with another, and returns a numerical result based on the comparison.
 double computePosition()
           
 double computePosition(int rank)
           
 int countLeftCrossings(int[] leftNeighborSuccIndices)
           
 int countVertices()
           
 int countVertices(int rank)
           
 double deflection()
           
private  double deflection(java.util.ArrayList adjacent)
           
 int degree()
           
 double distanceToLeft(LayerVertex leftNeighbor)
           
 double getCenterX()
           
 double getCenterY()
           
 int getClassIndex()
           
 double getHeight()
           
 int getIndexInLayer()
           
 double getLeftX()
           
 double getMaxX()
           
 double getMaxY()
           
 double getMinX()
           
 double getMinY()
           
 NestedSubgraph getParentSubgraph()
           
 double getPosition()
           
 double getPosition(int rank)
           
 LayerVertex getPredecessor(int index)
           
 java.util.ArrayList getPredecessors()
           
 int getRank()
           
 double getRightX()
           
 LayerVertex getSuccessor(int index)
           
 int[] getSuccessorIndices()
           
 java.util.ArrayList getSuccessors()
           
 java.lang.Object getUserVertex()
           
 int getVertexCount()
           
 int getVertexCount(int rank)
           
 double getWeight()
           
 double getWidth()
           
 boolean includesRank(int rank)
           
 int inDegree()
           
 boolean isDefinedLeftX()
           
 boolean isDefinedRightX()
           
 boolean isDummy()
           
 boolean isTouchingToLeft(LayerVertex leftNeighbor, double minDistance)
           
private  double medianValue(java.util.ArrayList adjacent)
           
 double minCenterDistance(LayerVertex vertex, double spacing)
           
 double moveX(double distance)
           
 int outDegree()
           
private  double pendulumForce(java.util.ArrayList adjacent)
           
 double predecessorDeflection()
           
 double predecessorMedianValue()
           
 double predecessorPendulumForce()
           
 int reindex(int rank, int firstIndex, java.util.Comparator comparator, org.apache.commons.collections.Predicate predicate)
           
 double rubberForce()
           
 void setCenterX(double centerX)
           
 void setCenterY(double centerY)
           
 void setClassIndex(int classIndex)
           
 void setGeometry(org.objectstyle.ashwood.util.Attribute shapeAttribute)
           
 void setHeight(double height)
           
 void setIndexInLayer(int indexInLayer)
           
 void setLeftX(double leftX)
           
 void setParentSubgraph(NestedSubgraph parentSubgraph)
           
 void setPredecessors(java.util.ArrayList predecessors)
           
 void setRank(int rank)
           
 void setRightX(double rightX)
           
 void setSuccessors(java.util.ArrayList successors)
           
 void setUserVertex(java.lang.Object userVertex)
           
 void setWeight(double weight)
           
 void setWidth(double width)
           
 double successorDeflection()
           
 double successorMedianValue()
           
 double successorPendulumForce()
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
 void updateGeometry(org.objectstyle.ashwood.util.Attribute shapeAttribute)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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
Constructor Detail

LayerVertex

public LayerVertex(java.lang.Object userVertex,
                   int predCapacity,
                   int succCapacity)
Method Detail

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