# Interface Algorithm<N,Row,Column,Color,Font>

All Known Subinterfaces:
  `TagCloudAlgorithm<Font>`

All Known Implementing Classes:
  `AbstractAlgorithm, AbstractTagCloudAlgorithm, BarAlgorithm, FastVoronoiAlgorithm, IcicleAlgorithm, LegacySwingTagCloudAlgorithm, OriginalFastVoronoiAlgorithm, PieAlgorithm, PivotByAlgorithm, SliceAndDiceAlgorithm, SquarifiedAlgorithm, SquarifiedPlusAlgorithm, SunburstAlgorithm, SwingTagCloudAlgorithm, VennAlgorithm, VoronoiAlgorithm`

@JsType public interface Algorithm<N,Row,Column,Color,Font>
The interface for all treemap layout algorithms. If you write your own algorithm, it should conform to this interface.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `breadthFirstLayout(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.
  `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)`
  Finish the layout after breadthFirstLayout has completed.
  `MutableProperties`
  `getProperties()`
  Properties for storing layout algorithm specific options.
  `boolean`
  `isChildContained()`
  `boolean`
  `isColorParent()`
  `boolean`
  `isCompatible(com.macrofocus.geom.Shape shape)`
  Indicates whether the layout algorithm can handle the given geometry of its parent
  `boolean`
  `isRenderingLeafLabelsSupported()`
  `boolean`
  `isRenderingParentLabelSupported()`
  `boolean`
  `isSpaceFilling()`
  `Iterable`
  `iterator(TreeMapModel<N,Row,Column,Color,Font> model, N root)`
  Controls the order by which the tree should be traversed.
  `void`
  `startLayout(com.macrofocus.geom.Rectangle2D bounds, TreeMapModel<N,Row,Column,Color,Font> model, N root, TreeMapWorker worker)`
  Start the layout before breadthFirstLayout is initiated.

- ## Method Details

  - ### getProperties

    MutableProperties getProperties()
    Properties for storing layout algorithm specific options.
    Returns:
      the specific properties of this algorithm

  - ### iterator

    Iterable iterator(TreeMapModel<N,Row,Column,Color,Font> model, N root)
    Controls the order by which the tree should be traversed.
    Parameters:
      `model` - the model
      `root` - the root node
    Returns:
      an iterator to traverse the tree in the specified order

  - ### startLayout

    void startLayout(com.macrofocus.geom.Rectangle2D bounds, TreeMapModel<N,Row,Column,Color,Font> model, N root, TreeMapWorker worker)
    Start the layout before breadthFirstLayout is initiated.
    Parameters:
      `bounds` - the bounds of the view
      `model` - the model
      `root` - the root node
      `worker` -

  - ### depthFirstLayout

    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. This is called during the first pass, while traversing the tree from the bottom up.
    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

  - ### breadthFirstLayout

    boolean breadthFirstLayout(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. This is called during the first pass, while traversing the tree top down.
    Parameters:
      `shape` - the current rectangle being divided.
      `parent` - the parent node.
      `children` - the items to map.
      `sumSizes` - the size of the parent.
      `horizontalVanishingPoint` -
      `verticalVanishingPoint` -
      `worker` - the worker thread
    Returns:
      true if the layout has been cancelled, false otherwise

  - ### finishLayout

    void finishLayout(com.macrofocus.geom.Rectangle2D bounds, TreeMapModel<N,Row,Column,Color,Font> model, N root)
    Finish the layout after breadthFirstLayout has completed.
    Parameters:
      `bounds` - the bounds of the view
      `model` - the model
      `root` - the root node

  - ### isCompatible

    boolean isCompatible(com.macrofocus.geom.Shape shape)
    Indicates whether the layout algorithm can handle the given geometry of its parent
    Parameters:
      `shape` - the geometry of its parent
    Returns:
      true if it can lay out the children using the specified geometrical shape

  - ### isRenderingLeafLabelsSupported

    boolean isRenderingLeafLabelsSupported()

  - ### isRenderingParentLabelSupported

    boolean isRenderingParentLabelSupported()

  - ### isColorParent

    boolean isColorParent()

  - ### isChildContained

    boolean isChildContained()

  - ### isSpaceFilling

    boolean isSpaceFilling()