Package com.macrofocus.treemap
Class AbstractAlgorithm<N,Row,Column,Color,Font>
- java.lang.Object
-
- com.macrofocus.treemap.AbstractAlgorithm<N,Row,Column,Color,Font>
-
- All Implemented Interfaces:
Algorithm<N,Row,Column,Color,Font>
- Direct Known Subclasses:
AbstractTagCloudAlgorithm,BarAlgorithm,FastVoronoiAlgorithm,IcicleAlgorithm,LegacySwingTagCloudAlgorithm,OriginalFastVoronoiAlgorithm,PieAlgorithm,PivotByAlgorithm,SliceAndDiceAlgorithm,SquarifiedAlgorithm,SquarifiedPlusAlgorithm,SunburstAlgorithm,VennAlgorithm,VoronoiAlgorithm
public abstract class AbstractAlgorithm<N,Row,Column,Color,Font> extends java.lang.Object implements Algorithm<N,Row,Column,Color,Font>
This class provides a skeletal implementation of the Algorithm interface to minimize the effort required to implement this interface.
-
-
Constructor Summary
Constructors Constructor Description AbstractAlgorithm()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandepthFirstLayout(java.awt.Shape shape, MutableTreeMapNode parent, MutableTreeMapNode[] children, double sumSizes, int horizontalVanishingPoint, int verticalVanishingPoint, TreeMapWorker worker)Arrange the items in the given array to fill the given shape.voidfinishLayout(java.awt.geom.Rectangle2D bounds, TreeMapModel<N,Row,Column,Color,Font> model, N root)Do nothing by default.MutablePropertiesgetProperties()Properties for storing layout algorithm specific options.booleanisChildContained()booleanisColorParent()booleanisRenderingLeafLabelsSupported()booleanisRenderingParentLabelSupported()booleanisSpaceFilling()java.lang.Iterable<N>iterator(TreeMapModel<N,Row,Column,Color,Font> model, N root)Breadth first traversal by default.voidstartLayout(java.awt.geom.Rectangle2D bounds, TreeMapModel<N,Row,Column,Color,Font> model, N root, TreeMapWorker worker)Do nothing by default.protected static doublesum(TreeMapNode[] children, int start, int end)Sums up the sizes of the given nodes according to the start and end indices.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.macrofocus.treemap.Algorithm
breadthFirstLayout, isCompatible
-
-
-
-
Method Detail
-
getProperties
public MutableProperties getProperties()
Description copied from interface:AlgorithmProperties for storing layout algorithm specific options.
-
iterator
public java.lang.Iterable<N> iterator(TreeMapModel<N,Row,Column,Color,Font> model, N root)
Breadth first traversal by default.
-
depthFirstLayout
public boolean depthFirstLayout(java.awt.Shape shape, MutableTreeMapNode parent, MutableTreeMapNode[] children, double sumSizes, int horizontalVanishingPoint, int verticalVanishingPoint, TreeMapWorker worker)Description copied from interface:AlgorithmArrange the items in the given array to fill the given shape. This is called during the first pass, while traversing the tree from the bottom up.- Specified by:
depthFirstLayoutin interfaceAlgorithm<N,Row,Column,Color,Font>- Parameters:
shape- the current rectangle being divided.parent- the parent node.children- the items to map.sumSizes- the size of the parent.worker- the worker thread- Returns:
- true if the layout has been cancelled, false otherwise
-
startLayout
public void startLayout(java.awt.geom.Rectangle2D bounds, TreeMapModel<N,Row,Column,Color,Font> model, N root, TreeMapWorker worker)Do nothing by default.
-
finishLayout
public void finishLayout(java.awt.geom.Rectangle2D bounds, TreeMapModel<N,Row,Column,Color,Font> model, N root)Do nothing by default.
-
sum
protected static final double sum(TreeMapNode[] children, int start, int end)
Sums up the sizes of the given nodes according to the start and end indices.- Parameters:
children- the nodesstart- start indexend- end index- Returns:
- the sum of the sizes
-
isRenderingLeafLabelsSupported
public boolean isRenderingLeafLabelsSupported()
-
isRenderingParentLabelSupported
public boolean isRenderingParentLabelSupported()
-
isColorParent
public boolean isColorParent()
-
isChildContained
public boolean isChildContained()
-
-