# Class AbstractAlgorithm<N,Row,Column,Color,Font>

java.lang.Object
com.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 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

  Modifier and Type
  Method
  Description
  `boolean`
  `depthFirstLayout(com.macrofocus.geom.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.
  `void`
  `finishLayout(com.macrofocus.geom.Rectangle2D bounds, TreeMapModel<N,Row,Column,Color,Font> model, N root)`
  Do nothing by default.
  `MutableProperties`
  `getProperties()`
  Properties for storing layout algorithm specific options.
  `boolean`
  `isChildContained()`
  `boolean`
  `isColorParent()`
  `boolean`
  `isRenderingLeafLabelsSupported()`
  `boolean`
  `isRenderingParentLabelSupported()`
  `boolean`
  `isSpaceFilling()`
  `Iterable<N>`
  `iterator(TreeMapModel<N,Row,Column,Color,Font> model, N root)`
  Breadth first traversal by default.
  `void`
  `startLayout(com.macrofocus.geom.Rectangle2D bounds, TreeMapModel<N,Row,Column,Color,Font> model, N root, TreeMapWorker worker)`
  Do nothing by default.
  `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.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface Algorithm

  `breadthFirstLayout, isCompatible`

- ## Constructor Details

  - ### AbstractAlgorithm

    public AbstractAlgorithm()

- ## Method Details

  - ### getProperties

    public MutableProperties getProperties()
    Description copied from interface: `Algorithm`
    Properties for storing layout algorithm specific options.
    Specified by:
      `getProperties` in interface `Algorithm<N,Row,Column,Color,Font>`
    Returns:
      the specific properties of this algorithm

  - ### iterator

    public Iterable<N> iterator(TreeMapModel<N,Row,Column,Color,Font> model, N root)
    Breadth first traversal by default.
    Specified by:
      `iterator` in interface `Algorithm<N,Row,Column,Color,Font>`
    Parameters:
      `model` - the model
      `root` - the root node
    Returns:
      an iterator to traverse the tree in the specified order

  - ### depthFirstLayout

    public boolean depthFirstLayout(com.macrofocus.geom.Shape shape, MutableTreeMapNode parent, MutableTreeMapNode[] children, double sumSizes, int horizontalVanishingPoint, int verticalVanishingPoint, TreeMapWorker worker)
    Description copied from interface: `Algorithm`
    Arrange 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:
      `depthFirstLayout` in interface `Algorithm<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.
      `horizontalVanishingPoint` -
      `verticalVanishingPoint` - @return true if the layout has been cancelled, false otherwise
      `worker` - the worker thread

  - ### startLayout

    public void startLayout(com.macrofocus.geom.Rectangle2D bounds, TreeMapModel<N,Row,Column,Color,Font> model, N root, TreeMapWorker worker)
    Do nothing by default.
    Specified by:
      `startLayout` in interface `Algorithm<N,Row,Column,Color,Font>`
    Parameters:
      `bounds` - the bounds of the view
      `model` - the model
      `root` - the root node
      `worker` -

  - ### finishLayout

    public void finishLayout(com.macrofocus.geom.Rectangle2D bounds, TreeMapModel<N,Row,Column,Color,Font> model, N root)
    Do nothing by default.
    Specified by:
      `finishLayout` in interface `Algorithm<N,Row,Column,Color,Font>`
    Parameters:
      `bounds` - the bounds of the view
      `model` - the model
      `root` - the root node

  - ### 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 nodes
      `start` - start index
      `end` - end index
    Returns:
      the sum of the sizes

  - ### isRenderingLeafLabelsSupported

    public boolean isRenderingLeafLabelsSupported()
    Specified by:
      `isRenderingLeafLabelsSupported` in interface `Algorithm<N,Row,Column,Color,Font>`

  - ### isRenderingParentLabelSupported

    public boolean isRenderingParentLabelSupported()
    Specified by:
      `isRenderingParentLabelSupported` in interface `Algorithm<N,Row,Column,Color,Font>`

  - ### isColorParent

    public boolean isColorParent()
    Specified by:
      `isColorParent` in interface `Algorithm<N,Row,Column,Color,Font>`

  - ### isChildContained

    public boolean isChildContained()
    Specified by:
      `isChildContained` in interface `Algorithm<N,Row,Column,Color,Font>`

  - ### isSpaceFilling

    public boolean isSpaceFilling()
    Specified by:
      `isSpaceFilling` in interface `Algorithm<N,Row,Column,Color,Font>`