public class AnchorAllocator<V extends IsIndexedVertex<E>,E extends Graph.IGraphEdge<V>>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<V,Triple<java.lang.Integer,java.lang.Integer,java.util.Map<E,java.lang.Integer>>> |
anchors
Cache of allocated anchors
|
| Constructor and Description |
|---|
AnchorAllocator()
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
allocate(java.util.Collection<V> nodes,
java.util.Comparator<E> leftComparator,
java.util.Comparator<E> rightComparator)
Allocate node slots
|
static float |
center(int i,
int left,
int right)
Center
|
float |
getAnchor(V node,
E edge)
Get anchor
|
float |
getLeftAnchor(E edge)
Get edge's left anchor
|
private V |
getLeftNode(Graph.IGraphEdge<V> edge)
Get left node
|
float |
getRightAnchor(E edge)
Get edge's right anchor
|
private V |
getRightNode(Graph.IGraphEdge<V> edge)
Get right node
|
private boolean |
isBackwards(Graph.IGraphEdge<V> edge)
Is backwards
|
private boolean |
isLeftIncident(Graph.IGraphEdge<V> edge,
V node)
Is left incident
|
private boolean |
isRightIncident(Graph.IGraphEdge<V> edge,
V node)
Is right incident
|
java.lang.String |
toString() |
private final java.util.Map<V extends IsIndexedVertex<E>,Triple<java.lang.Integer,java.lang.Integer,java.util.Map<E extends Graph.IGraphEdge<V>,java.lang.Integer>>> anchors
public void allocate(java.util.Collection<V> nodes, java.util.Comparator<E> leftComparator, java.util.Comparator<E> rightComparator)
nodes - collection of nodesleftComparator - anchor allocation orderrightComparator - anchor allocation orderpublic float getAnchor(V node, E edge)
node - nodeedge - oncoming or outgoing edgepublic float getLeftAnchor(E edge)
edge - edgepublic float getRightAnchor(E edge)
edge - edgepublic static float center(int i,
int left,
int right)
i - indexleft - leftmost indexright - rightmost indexpublic java.lang.String toString()
toString in class java.lang.Objectprivate boolean isBackwards(Graph.IGraphEdge<V> edge)
edge - edgeprivate boolean isRightIncident(Graph.IGraphEdge<V> edge, V node)
edge - edgenode - nodeprivate boolean isLeftIncident(Graph.IGraphEdge<V> edge, V node)
edge - edgenode - nodeprivate V getLeftNode(Graph.IGraphEdge<V> edge)
edge - edgeprivate V getRightNode(Graph.IGraphEdge<V> edge)
edge - edge