Slot and anchor allocator
- Author
- Bernard Bou
- See also
- SlotAllocator
-
AnchorAllocator
◆ Allocator()
◆ getLeftAnchor()
Get edge's left anchor
- Parameters
-
- Returns
- left anchor
◆ getRightAnchor()
Get edge's right anchor
- Parameters
-
- Returns
- right anchor
◆ getSlot()
Get edge's slot
- Parameters
-
- Returns
- slot
◆ toString()
◆ anchorAllocator
◆ leftComparator
Initial value:= (edge1, edge2) -> {
final int compare = Integer.compare(edge1.getLowIndex(), edge2.getLowIndex());
if (compare != 0)
return compare;
return -1 * Integer.compare(
Allocator.this.slotAllocator.getSlot(edge1),
Allocator.this.slotAllocator.getSlot(edge2));
}
Edge comparator based on edge's low index
◆ rightComparator
Initial value:= (edge1, edge2) -> {
final int compare = -1 * Integer.compare(edge1.getHighIndex(), edge2.getHighIndex());
if (compare != 0)
return compare;
return -1 * Integer.compare(
Allocator.this.slotAllocator.getSlot(edge1),
Allocator.this.slotAllocator.getSlot(edge2));
}
Edge comparator based on edge's high index
◆ slotAllocator
◆ slotComparator
Initial value:= new Comparator<E>()
{
@Override
public int compare(final E edge1, final E edge2)
{
final int span1 = getSpan(edge1);
final int span2 = getSpan(edge2);
if (span1 > span2)
return 1;
else if (span1 < span2)
return -1;
return 0;
}
private int getSpan(final IGraphEdge<V> edge)
{
return Math.abs(edge.getTarget().getIndex() - edge.getSource().getIndex());
}
}
Edge comparator based on edge's span
The documentation for this class was generated from the following file:
- grammarscope/library/src/main/java/grammarscope/allocator/Allocator.java