Class AbstractIterativeLayoutAlgorithm<V>
- java.lang.Object
-
- org.jungrapht.visualization.layout.algorithms.AbstractLayoutAlgorithm<V>
-
- org.jungrapht.visualization.layout.algorithms.AbstractIterativeLayoutAlgorithm<V>
-
- All Implemented Interfaces:
IterativeLayoutAlgorithm<V>
,LayoutAlgorithm<V>
,AfterRunnable
,ExecutorConsumer
,IterativeContext
,Threaded
- Direct Known Subclasses:
AnimationLayoutAlgorithm
,ForceAtlas2LayoutAlgorithm
,FRLayoutAlgorithm
,GEMLayoutAlgorithm
,ISOMLayoutAlgorithm
,KKLayoutAlgorithm
,SpringLayoutAlgorithm
public abstract class AbstractIterativeLayoutAlgorithm<V> extends AbstractLayoutAlgorithm<V> implements IterativeLayoutAlgorithm<V>, AfterRunnable, Threaded
For Iterative algorithms that perform delayed operations on a Thread, save off the layoutModel so that it can be accessed by the threaded code. The layoutModel could be removed and instead passed via all of the iterative methods (for example step(layoutModel) instead of step() )- Author:
- Tom Nelson
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractIterativeLayoutAlgorithm.Builder<V,T extends AbstractIterativeLayoutAlgorithm<V>,B extends AbstractIterativeLayoutAlgorithm.Builder<V,T,B>>
-
Nested classes/interfaces inherited from interface org.jungrapht.visualization.layout.algorithms.LayoutAlgorithm
LayoutAlgorithm.NoOp<V>
-
Nested classes/interfaces inherited from interface org.jungrapht.visualization.layout.algorithms.util.Threaded
Threaded.NoOp
-
-
Field Summary
Fields Modifier and Type Field Description protected Runnable
afterRunnable
protected boolean
cancelled
protected Executor
executor
protected LayoutModel<V>
layoutModel
because the IterativeLayoutAlgorithms use multithreading to continuously update vertex positions, the layoutModel state is saved (during the visit method) so that it can be used continuouslyprotected int
preRelaxDurationMs
protected Random
random
protected boolean
shouldPreRelax
protected boolean
threaded
-
Fields inherited from class org.jungrapht.visualization.layout.algorithms.AbstractLayoutAlgorithm
after
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractIterativeLayoutAlgorithm(AbstractIterativeLayoutAlgorithm.Builder builder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancel()
Executor
getExecutor()
boolean
isThreaded()
boolean
preRelax()
may be a no-op depending on how the algorithm instance is createdvoid
setExecutor(Executor executor)
void
setRandomSeed(long randomSeed)
void
setThreaded(boolean threaded)
void
visit(LayoutModel<V> layoutModel)
because the IterativeLayoutAlgorithms use multithreading to continuously update vertex positions, the layoutModel state is saved (during the visit method) so that it can be used continuously-
Methods inherited from class org.jungrapht.visualization.layout.algorithms.AbstractLayoutAlgorithm
computeAverageVertexDimension, computeLayoutExtent, expandToFill, runAfter, setAfter
-
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.util.AfterRunnable
runAfter, setAfter
-
Methods inherited from interface org.jungrapht.visualization.layout.algorithms.util.IterativeContext
done, step
-
Methods inherited from interface org.jungrapht.visualization.layout.algorithms.LayoutAlgorithm
constrained
-
-
-
-
Field Detail
-
layoutModel
protected LayoutModel<V> layoutModel
because the IterativeLayoutAlgorithms use multithreading to continuously update vertex positions, the layoutModel state is saved (during the visit method) so that it can be used continuously
-
executor
protected Executor executor
-
shouldPreRelax
protected boolean shouldPreRelax
-
preRelaxDurationMs
protected int preRelaxDurationMs
-
random
protected Random random
-
afterRunnable
protected Runnable afterRunnable
-
threaded
protected boolean threaded
-
cancelled
protected boolean cancelled
-
-
Constructor Detail
-
AbstractIterativeLayoutAlgorithm
protected AbstractIterativeLayoutAlgorithm(AbstractIterativeLayoutAlgorithm.Builder builder)
-
-
Method Detail
-
setRandomSeed
public void setRandomSeed(long randomSeed)
-
preRelax
public final boolean preRelax()
Description copied from interface:IterativeLayoutAlgorithm
may be a no-op depending on how the algorithm instance is created- Specified by:
preRelax
in interfaceIterativeLayoutAlgorithm<V>
- Returns:
- true if a prerelax was done, false otherwise
-
setExecutor
public void setExecutor(Executor executor)
- Specified by:
setExecutor
in interfaceExecutorConsumer
-
getExecutor
public Executor getExecutor()
- Specified by:
getExecutor
in interfaceExecutorConsumer
-
visit
public void visit(LayoutModel<V> layoutModel)
because the IterativeLayoutAlgorithms use multithreading to continuously update vertex positions, the layoutModel state is saved (during the visit method) so that it can be used continuously- Specified by:
visit
in interfaceLayoutAlgorithm<V>
- Parameters:
layoutModel
- the mediator between the container for vertices (the Graph) and the mapping from Vertex to Point
-
isThreaded
public boolean isThreaded()
- Specified by:
isThreaded
in interfaceThreaded
-
setThreaded
public void setThreaded(boolean threaded)
- Specified by:
setThreaded
in interfaceThreaded
-
cancel
public void cancel()
- Specified by:
cancel
in interfaceLayoutAlgorithm<V>
- Specified by:
cancel
in interfaceThreaded
-
-