weka.core.neighboursearch.balltrees

## Class BallSplitter

- java.lang.Object
- - weka.core.neighboursearch.balltrees.BallSplitter

- All Implemented Interfaces:
    java.io.Serializable, OptionHandler, RevisionHandler
  Direct Known Subclasses:
    MedianDistanceFromArbitraryPoint, MedianOfWidestDimension, PointsClosestToFurthestChildren

      public abstract class BallSplitter
      extends java.lang.Object
      implements java.io.Serializable, OptionHandler, RevisionHandler

  Abstract class for splitting a ball tree's BallNode.
  Version:
    $Revision: 10203 $
  Author:
    Ashraf M. Kibriya (amk14[at-the-rate]cs[dot]waikato[dot]ac[dot]nz)
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BallSplitter()` default constructor.
    `BallSplitter(int[] instList, Instances insts, EuclideanDistance e)` Creates a new instance of BallSplitter.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String[]` | `getOptions()` Gets the current settings of the object.
    `java.lang.String` | `getRevision()` Returns the revision string.
    `java.util.Enumeration<Option>` | `listOptions()` Returns an enumeration describing the available options.
    `void` | `setEuclideanDistanceFunction(EuclideanDistance func)` Sets the distance function used to (or to be used to) build the tree.
    `void` | `setInstanceList(int[] instList)` Sets the master index array containing indices of the training instances.
    `void` | `setInstances(Instances inst)` Sets the training instances on which the tree is (or is to be) built.
    `void` | `setOptions(java.lang.String[] options)` Parses a given list of options.
    `abstract void` | `splitNode(BallNode node, int numNodesCreated)` Splits a node into two.

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### BallSplitter

          public BallSplitter()

      default constructor.

    - #### BallSplitter

          public BallSplitter(int[] instList,
                              Instances insts,
                              EuclideanDistance e)

      Creates a new instance of BallSplitter.
      Parameters:
        `instList` - The master index array.
        `insts` - The instances on which the tree is (or is to be) built.
        `e` - The Euclidean distance function to use for splitting.

  - ### Method Detail

    - #### listOptions

          public java.util.Enumeration<Option> listOptions()

      Returns an enumeration describing the available options.
      Specified by:
        `listOptions` in interface `OptionHandler`
      Returns:
        an enumeration of all the available options.

    - #### setOptions

          public void setOptions(java.lang.String[] options)
                          throws java.lang.Exception

      Parses a given list of options.
      Specified by:
        `setOptions` in interface `OptionHandler`
      Parameters:
        `options` - the list of options as an array of strings
      Throws:
        `java.lang.Exception` - if an option is not supported

    - #### getOptions

          public java.lang.String[] getOptions()

      Gets the current settings of the object.
      Specified by:
        `getOptions` in interface `OptionHandler`
      Returns:
        an array of strings suitable for passing to setOptions

    - #### splitNode

          public abstract void splitNode(BallNode node,
                                         int numNodesCreated)
                                  throws java.lang.Exception

      Splits a node into two.
      Parameters:
        `node` - The node to split.
        `numNodesCreated` - The number of nodes that so far have been created for the tree, so that the newly created nodes are assigned correct/meaningful node numbers/ids.
      Throws:
        `java.lang.Exception` - If there is some problem in splitting the given node.

    - #### setInstances

          public void setInstances(Instances inst)

      Sets the training instances on which the tree is (or is to be) built.
      Parameters:
        `inst` - The training instances.

    - #### setInstanceList

          public void setInstanceList(int[] instList)

      Sets the master index array containing indices of the training instances. This array will be rearranged as the tree is built (or a node is split_), so that each node is assigned a portion in this array which contain the instances insides the node's region.
      Parameters:
        `instList` - The master index array.

    - #### setEuclideanDistanceFunction

          public void setEuclideanDistanceFunction(EuclideanDistance func)

      Sets the distance function used to (or to be used to) build the tree.
      Parameters:
        `func` - The distance function.

    - #### getRevision

          public java.lang.String getRevision()

      Returns the revision string.
      Specified by:
        `getRevision` in interface `RevisionHandler`
      Returns:
        the revision