# HierarchyBuilderGroupingBased (ARX GUI Documentation)

org.deidentifier.arx.aggregates

## Class HierarchyBuilderGroupingBased<T>

- java.lang.Object
- - org.deidentifier.arx.aggregates.HierarchyBuilder<T>
  - - org.deidentifier.arx.aggregates.HierarchyBuilderGroupingBased<T>

- Type Parameters:
    `T` -
  All Implemented Interfaces:
    java.io.Serializable
  Direct Known Subclasses:
    HierarchyBuilderIntervalBased, HierarchyBuilderOrderBased

      public abstract class HierarchyBuilderGroupingBased<T>
      extends HierarchyBuilder<T>
      implements java.io.Serializable

  This abstract base class enables building hierarchies for categorical and non-categorical values.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static class` | `HierarchyBuilderGroupingBased.AbstractGroup` A group representation to be used by subclasses.
    `static class` | `HierarchyBuilderGroupingBased.Group<U>` This class represents a fanout parameter.
    `static class` | `HierarchyBuilderGroupingBased.Level<U>` This class represents a level in the hierarchy.

    - ### Nested classes/interfaces inherited from class org.deidentifier.arx.aggregates.HierarchyBuilder

      `HierarchyBuilder.Type`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected AggregateFunction<T>` | `function` The default aggregate function, might be null.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `HierarchyBuilderGroupingBased(HierarchyBuilder.Type type, DataType<T> datatype)` Creates a new instance for the given data type.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `AttributeType.Hierarchy` | `build()` Creates a new hierarchy, based on the predefined specification.
    `AttributeType.Hierarchy` | `build(java.lang.String[] data)` Creates a new hierarchy, based on the predefined specification.
    `protected java.lang.String[]` | `getData()` Returns the data array.
    `DataType<T>` | `getDataType()` Returns the data type.
    `AggregateFunction<T>` | `getDefaultFunction()` Returns the default aggregate function.
    `HierarchyBuilderGroupingBased.Level<T>` | `getLevel(int level)` Returns the given level.
    `java.util.List<HierarchyBuilderGroupingBased.Level<T>>` | `getLevels()` Returns all currently defined levels.
    `protected HierarchyBuilderGroupingBased.AbstractGroup[][]` | `getPreparedGroups()` Returns the prepared groups for recursion.
    `java.lang.String` | `isValid()` Returns whether the current configuration is valid.
    `int[]` | `prepare(java.lang.String[] data)` Prepares the builder.
    `protected abstract HierarchyBuilderGroupingBased.AbstractGroup[][]` | `prepareGroups()` Tells the implementing class to prepare the generalization process.
    `void` | `setAggregateFunction(AggregateFunction<T> function)` Sets the default aggregate function to be used by all fanouts.
    `protected void` | `setData(java.lang.String[] data)` Sets the data array.
    `protected void` | `setLevels(java.util.List<HierarchyBuilderGroupingBased.Level<T>> levels)` Sets the groups on higher levels of the hierarchy.
    `protected void` | `setPrepared(boolean prepared)` Is this builder prepared allready.

    - ### Methods inherited from class org.deidentifier.arx.aggregates.HierarchyBuilder

      `create, create, getType, save, save`

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

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

- - ### Field Detail

    - #### function

          protected AggregateFunction<T> function

      The default aggregate function, might be null.

  - ### Constructor Detail

    - #### HierarchyBuilderGroupingBased

          protected HierarchyBuilderGroupingBased(HierarchyBuilder.Type type,
                                       DataType<T> datatype)

      Creates a new instance for the given data type.
      Parameters:
        `type` -
        `datatype` -

  - ### Method Detail

    - #### build

          public AttributeType.Hierarchy build()

      Creates a new hierarchy, based on the predefined specification.
      Specified by:
        `build` in class `HierarchyBuilder<T>`
      Returns:

    - #### build

          public AttributeType.Hierarchy build(java.lang.String[] data)

      Creates a new hierarchy, based on the predefined specification.
      Specified by:
        `build` in class `HierarchyBuilder<T>`
      Parameters:
        `data` -
      Returns:

    - #### getDataType

          public DataType<T> getDataType()

      Returns the data type.
      Returns:

    - #### getDefaultFunction

          public AggregateFunction<T> getDefaultFunction()

      Returns the default aggregate function.
      Returns:

    - #### getLevel

          public HierarchyBuilderGroupingBased.Level<T> getLevel(int level)

      Returns the given level.
      Parameters:
        `level` -
      Returns:

    - #### getLevels

          public java.util.List<HierarchyBuilderGroupingBased.Level<T>> getLevels()

      Returns all currently defined levels.
      Returns:

    - #### isValid

          public java.lang.String isValid()

      Returns whether the current configuration is valid. Returns `null`, if so, an error message if not.
      Returns:

    - #### prepare

          public int[] prepare(java.lang.String[] data)

      Prepares the builder. Returns a list of the number of equivalence classes per level
      Specified by:
        `prepare` in class `HierarchyBuilder<T>`
      Parameters:
        `data` -
      Returns:

    - #### setAggregateFunction

          public void setAggregateFunction(AggregateFunction<T> function)

      Sets the default aggregate function to be used by all fanouts.
      Parameters:
        `function` -

    - #### getData

          protected java.lang.String[] getData()

      Returns the data array.
      Returns:

    - #### getPreparedGroups

          protected HierarchyBuilderGroupingBased.AbstractGroup[][] getPreparedGroups()

      Returns the prepared groups for recursion.
      Returns:

    - #### prepareGroups

          protected abstract HierarchyBuilderGroupingBased.AbstractGroup[][] prepareGroups()

      Tells the implementing class to prepare the generalization process.
      Returns:

    - #### setData

          protected void setData(java.lang.String[] data)

      Sets the data array.
      Parameters:
        `data` -

    - #### setLevels

          protected void setLevels(java.util.List<HierarchyBuilderGroupingBased.Level<T>> levels)

      Sets the groups on higher levels of the hierarchy.
      Parameters:
        `levels` -

    - #### setPrepared

          protected void setPrepared(boolean prepared)

      Is this builder prepared allready.
      Parameters:
        `prepared` -