Class AbstractTreeLayoutAlgorithm.Builder<V,T extends AbstractTreeLayoutAlgorithm<V>,B extends AbstractTreeLayoutAlgorithm.Builder<V,T,B>>
- java.lang.Object
-
- org.jungrapht.visualization.layout.algorithms.AbstractLayoutAlgorithm.Builder<V,T,B>
-
- org.jungrapht.visualization.layout.algorithms.AbstractTreeLayoutAlgorithm.Builder<V,T,B>
-
- Type Parameters:
V- the vertex typeT- the type of TreeLayoutAlgorithm that is builtB- the builder type
- All Implemented Interfaces:
LayoutAlgorithm.Builder<V,T,B>
- Direct Known Subclasses:
TidierTreeLayoutAlgorithm.Builder,TreeLayoutAlgorithm.Builder
- Enclosing class:
- AbstractTreeLayoutAlgorithm<V>
public abstract static class AbstractTreeLayoutAlgorithm.Builder<V,T extends AbstractTreeLayoutAlgorithm<V>,B extends AbstractTreeLayoutAlgorithm.Builder<V,T,B>> extends AbstractLayoutAlgorithm.Builder<V,T,B> implements LayoutAlgorithm.Builder<V,T,B>
ABuilderto create instances ofAbstractTreeLayoutAlgorithm
-
-
Field Summary
Fields Modifier and Type Field Description protected booleancorrectOverlapprotected booleanexpandLayoutprotected inthorizontalVertexSpacingprotected Comparator<V>rootComparatorprotected Predicate<V>rootPredicateprotected Function<V,Rectangle>vertexBoundsFunctionprotected intverticalVertexSpacing-
Fields inherited from class org.jungrapht.visualization.layout.algorithms.AbstractLayoutAlgorithm.Builder
after
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BcorrectOverlap(boolean correctOverlap)BexpandLayout(boolean expandLayout)BhorizontalVertexSpacing(int horizontalVertexSpacing)BrootComparator(Comparator<V> rootComparator)BrootPredicate(Predicate<V> rootPredicate)protected Bself()BvertexBoundsFunction(Function<V,Rectangle> vertexBoundsFunction)if provided, the horizontal and vertical spacings will be replaced by the average width and height of the vertexShapes returned by thisFunctionBverticalVertexSpacing(int verticalVertexSpacing)-
Methods inherited from class org.jungrapht.visualization.layout.algorithms.AbstractLayoutAlgorithm.Builder
after, build
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jungrapht.visualization.layout.algorithms.LayoutAlgorithm.Builder
build
-
-
-
-
Field Detail
-
rootComparator
protected Comparator<V> rootComparator
-
horizontalVertexSpacing
protected int horizontalVertexSpacing
-
verticalVertexSpacing
protected int verticalVertexSpacing
-
expandLayout
protected boolean expandLayout
-
correctOverlap
protected boolean correctOverlap
-
-
Method Detail
-
self
protected B self()
- Overrides:
selfin classAbstractLayoutAlgorithm.Builder<V,T extends AbstractTreeLayoutAlgorithm<V>,B extends AbstractTreeLayoutAlgorithm.Builder<V,T,B>>- Returns:
- this builder cast to type B
-
rootPredicate
public B rootPredicate(Predicate<V> rootPredicate)
- Parameters:
rootPredicate- the predicate function to determine root vertices. Default is to consider all vertices with no incoming edges as root vertices- Returns:
- this Builder
-
rootComparator
public B rootComparator(Comparator<V> rootComparator)
- Parameters:
rootComparator- used to sort the roots if an order is desired- Returns:
- this Builder
-
horizontalVertexSpacing
public B horizontalVertexSpacing(int horizontalVertexSpacing)
- Parameters:
horizontalVertexSpacing- horizontal spacing between tree elements- Returns:
- this Builder
-
verticalVertexSpacing
public B verticalVertexSpacing(int verticalVertexSpacing)
- Parameters:
verticalVertexSpacing- vertical spacing between tree elements- Returns:
- this Builder
-
vertexBoundsFunction
public B vertexBoundsFunction(Function<V,Rectangle> vertexBoundsFunction)
if provided, the horizontal and vertical spacings will be replaced by the average width and height of the vertexShapes returned by thisFunction- Parameters:
vertexBoundsFunction- source of vertex shapes- Returns:
- this builder
-
expandLayout
public B expandLayout(boolean expandLayout)
- Parameters:
expandLayout- iftrueexpand the layout width and height to accomodate the entire tree- Returns:
- the Builder
-
correctOverlap
public B correctOverlap(boolean correctOverlap)
- Parameters:
correctOverlap- iftruemove vertices to correct overlap with non-incident edges.- Returns:
- the Builder
-
-