# HierarchyBuilderIntervalBased (ARX GUI Documentation)

org.deidentifier.arx.aggregates

## Class HierarchyBuilderIntervalBased<T>

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

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

      public class HierarchyBuilderIntervalBased<T>
      extends HierarchyBuilderGroupingBased<T>

  This class enables building hierarchies for non-categorical values by mapping them into given intervals.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `HierarchyBuilderIntervalBased.IndexNode` This class represents an node.
    `static class` | `HierarchyBuilderIntervalBased.Interval<T>` This class represents an interval.
    `static class` | `HierarchyBuilderIntervalBased.Range<U>` For each direction, this class encapsulates three bounds.

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

      `HierarchyBuilderGroupingBased.AbstractGroup, HierarchyBuilderGroupingBased.Group<U>, HierarchyBuilderGroupingBased.Level<U>`

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

      `HierarchyBuilder.Type`

  - ### Field Summary

    - ### Fields inherited from class org.deidentifier.arx.aggregates.HierarchyBuilderGroupingBased

      `function`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `HierarchyBuilderIntervalBased(DataType<T> type)` Creates a new instance.
    `protected` | `HierarchyBuilderIntervalBased(DataType<T> type, HierarchyBuilderIntervalBased.Range<T> lowerRange, HierarchyBuilderIntervalBased.Range<T> upperRange)` Creates a new instance.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addInterval(HierarchyBuilderIntervalBased.Interval<T> interval)` Adds an interval.
    `HierarchyBuilderIntervalBased<T>` | `addInterval(T min, T max)` Adds an interval.
    `HierarchyBuilderIntervalBased<T>` | `addInterval(T min, T max, AggregateFunction<T> function)` Adds an interval.
    `HierarchyBuilderIntervalBased<T>` | `addInterval(T min, T max, java.lang.String label)` Adds an interval.
    `HierarchyBuilderIntervalBased<T>` | `clearIntervals()` Adds an interval.
    `static <T> HierarchyBuilderIntervalBased<T>` | `create(DataType<T> type)` Creates a new instance.
    `static <T> HierarchyBuilderIntervalBased<T>` | `create(DataType<T> type, HierarchyBuilderIntervalBased.Range<T> lowerRange, HierarchyBuilderIntervalBased.Range<T> upperRange)` Creates a new instance.
    `static <T> HierarchyBuilderIntervalBased<T>` | `create(java.io.File file)` Loads a builder specification from the given file.
    `static <T> HierarchyBuilderIntervalBased<T>` | `create(java.lang.String file)` Loads a builder specification from the given file.
    `protected HierarchyBuilderIntervalBased.Range<T>[]` | `getAdjustedRanges()` Returns adjusted ranges.
    `java.util.List<HierarchyBuilderIntervalBased.Interval<T>>` | `getIntervals()` Returns all currently defined intervals.
    `HierarchyBuilderIntervalBased.Range<T>` | `getLowerRange()` Returns the lower range.
    `HierarchyBuilderIntervalBased.Range<T>` | `getUpperRange()` Returns the upper range.
    `java.lang.String` | `isValid()` Returns whether the current configuration is valid.
    `protected HierarchyBuilderGroupingBased.AbstractGroup[][]` | `prepareGroups()` Tells the implementing class to prepare the generalization process.
    `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.

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

      `build, build, getData, getDataType, getDefaultFunction, getLevel, getLevels, getPreparedGroups, prepare, setAggregateFunction, setPrepared`

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

      `getType, save, save`

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

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

- - ### Constructor Detail

    - #### HierarchyBuilderIntervalBased

          protected HierarchyBuilderIntervalBased(DataType<T> type)

      Creates a new instance. Snapping is disabled. Repetition is disabled. Bound is determined dynamically.
      Parameters:
        `type` -

    - #### HierarchyBuilderIntervalBased

          protected HierarchyBuilderIntervalBased(DataType<T> type,
                                       HierarchyBuilderIntervalBased.Range<T> lowerRange,
                                       HierarchyBuilderIntervalBased.Range<T> upperRange)

      Creates a new instance. Data points that are out of range are handled according to the given settings.
      Parameters:
        `type` -
        `lowerRange` -
        `upperRange` -

  - ### Method Detail

    - #### create

          public static <T> HierarchyBuilderIntervalBased<T> create(DataType<T> type)

      Creates a new instance. Snapping is disabled. Repetition is disabled. Bound is determined dynamically.
      Type Parameters:
        `T` -
      Parameters:
        `type` -
      Returns:

    - #### create

          public static <T> HierarchyBuilderIntervalBased<T> create(DataType<T> type,
                                                    HierarchyBuilderIntervalBased.Range<T> lowerRange,
                                                    HierarchyBuilderIntervalBased.Range<T> upperRange)

      Creates a new instance. Data points that are out of range are handled according to the given settings.
      Type Parameters:
        `T` -
      Parameters:
        `type` -
        `lowerRange` -
        `upperRange` -
      Returns:

    - #### create

          public static <T> HierarchyBuilderIntervalBased<T> create(java.io.File file)
                                                         throws java.io.IOException

      Loads a builder specification from the given file.
      Type Parameters:
        `T` -
      Parameters:
        `file` -
      Returns:
      Throws:
        `java.io.IOException`

    - #### create

          public static <T> HierarchyBuilderIntervalBased<T> create(java.lang.String file)
                                                         throws java.io.IOException

      Loads a builder specification from the given file.
      Type Parameters:
        `T` -
      Parameters:
        `file` -
      Returns:
      Throws:
        `java.io.IOException`

    - #### addInterval

          public HierarchyBuilderIntervalBased<T> addInterval(T min,
                                                     T max)

      Adds an interval. Min is inclusive, max is exclusive. Uses the predefined default aggregate function
      Parameters:
        `min` -
        `max` -
      Returns:

    - #### addInterval

          public HierarchyBuilderIntervalBased<T> addInterval(T min,
                                                     T max,
                                                     AggregateFunction<T> function)

      Adds an interval. Min is inclusive, max is exclusive
      Parameters:
        `min` -
        `max` -
        `function` -
      Returns:

    - #### addInterval

          public HierarchyBuilderIntervalBased<T> addInterval(T min,
                                                     T max,
                                                     java.lang.String label)

      Adds an interval. Min is inclusive, max is exclusive. Interval is labeled with the given string
      Parameters:
        `min` -
        `max` -
        `label` -
      Returns:

    - #### clearIntervals

          public HierarchyBuilderIntervalBased<T> clearIntervals()

      Adds an interval. Min is inclusive, max is exclusive. Uses the predefined default aggregate function
      Returns:

    - #### getIntervals

          public java.util.List<HierarchyBuilderIntervalBased.Interval<T>> getIntervals()

      Returns all currently defined intervals.
      Returns:

    - #### getLowerRange

          public HierarchyBuilderIntervalBased.Range<T> getLowerRange()

      Returns the lower range.
      Returns:

    - #### getUpperRange

          public HierarchyBuilderIntervalBased.Range<T> getUpperRange()

      Returns the upper range.
      Returns:

    - #### isValid

          public java.lang.String isValid()

      Description copied from class: `HierarchyBuilderGroupingBased`
      Returns whether the current configuration is valid. Returns `null`, if so, an error message if not.
      Overrides:
        `isValid` in class `HierarchyBuilderGroupingBased<T>`
      Returns:

    - #### addInterval

          protected void addInterval(HierarchyBuilderIntervalBased.Interval<T> interval)

      Adds an interval.
      Parameters:
        `interval` -

    - #### getAdjustedRanges

          protected HierarchyBuilderIntervalBased.Range<T>[] getAdjustedRanges()

      Returns adjusted ranges.
      Returns:
        Array containing {lower, upper}

    - #### prepareGroups

          protected HierarchyBuilderGroupingBased.AbstractGroup[][] prepareGroups()

      Description copied from class: `HierarchyBuilderGroupingBased`
      Tells the implementing class to prepare the generalization process.
      Specified by:
        `prepareGroups` in class `HierarchyBuilderGroupingBased<T>`
      Returns:

    - #### setData

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

      Sets the data array.
      Overrides:
        `setData` in class `HierarchyBuilderGroupingBased<T>`
      Parameters:
        `data` -

    - #### setLevels

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

      Sets the groups on higher levels of the hierarchy.
      Overrides:
        `setLevels` in class `HierarchyBuilderGroupingBased<T>`
      Parameters:
        `levels` -