Class AdTree<A,V>

java.lang.Object
edu.pitt.isp.sverchkov.data.AdTree<A,V>
Type Parameters:
A - Attribute type
V - Value type
All Implemented Interfaces:
Serializable

public class AdTree<A,V> extends Object
An implementation of a static AD tree based on Moore and Lee 1998 (mostly)

Indexing of the variables works backwards: (a_i can't have children a_i ... a_m) ... not that that difference is visible in the API.

Author:
jdramsey
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final int[]
    The airities of the attributes.
    protected final int
    The number of attributes.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an AD tree for the given data set.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected int
    count(int[] assignment, edu.pitt.isp.sverchkov.data.AdTreeHelper.CountNode ptr)
    Constructs an AD tree helper for the given data set.
    int
    count(Map<A,V> assignment)
    Returns the number of rows in the data set.
    counts(A attribute, Map<A,V> assignment)
    Returns the number of rows in the data set.
    Converts to XML.
    Converts to XML.
    values(A attribute)
    Returns the number of rows in the data set.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • m

      protected final int m
      The number of attributes.
    • airities

      protected final int[] airities
      The airities of the attributes. The i-th element of this array is the airity of the i-th attribute.
  • Constructor Details

    • AdTree

      public AdTree(DataTable<A,V> data)
      Constructs an AD tree for the given data set.
      Parameters:
      data - The data set.
  • Method Details

    • values

      public List<V> values(A attribute)
      Returns the number of rows in the data set.
      Parameters:
      attribute - The attribute to count.
      Returns:
      The number of rows in the data set.
    • count

      public int count(Map<A,V> assignment)
      Returns the number of rows in the data set.
      Parameters:
      assignment - The assignment to count.
      Returns:
      The number of rows in the data set.
    • counts

      public Map<V,Integer> counts(A attribute, Map<A,V> assignment)
      Returns the number of rows in the data set.
      Parameters:
      attribute - The attribute to count.
      assignment - The assignment to count.
      Returns:
      The number of rows in the data set.
    • toXML

      public Document toXML() throws ParserConfigurationException
      Converts to XML.
      Returns:
      The XML document.
      Throws:
      ParserConfigurationException - if something goes wrong
    • toXML

      public Document toXML(DocumentBuilder builder)
      Converts to XML.
      Parameters:
      builder - The builder.
      Returns:
      The XML document.
    • count

      protected int count(int[] assignment, edu.pitt.isp.sverchkov.data.AdTreeHelper.CountNode ptr)
      Constructs an AD tree helper for the given data set.
      Parameters:
      assignment - The assignment of values to attributes.
      ptr - The root of the AD tree.
      Returns:
      The number of instances in the data set that match the given assignment.