org.deidentifier.arx.aggregates

## Class HierarchyBuilderRedactionBased<T>

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

Type Parameters:
  `T` -

All Implemented Interfaces:
  java.io.Serializable

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

This class enables building hierarchies for categorical and non-categorical values using redaction. Data items are 1) aligned left-to-right or right-to-left, 2) differences in length are filled with a padding character, 3) then, equally long values are redacted character by character from left-to-right or right-to-left.

Author:
  Fabian Prasser
See Also:
  Serialized Form

### Nested Class Summary

Nested Classes
`static class` `HierarchyBuilderRedactionBased.Order` Order

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

`HierarchyBuilder.Type`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`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.
`static <T> HierarchyBuilderRedactionBased<T>` `create(char redactionCharacter)` Values are aligned left-to-right and redacted right-to-left.
`static <T> HierarchyBuilderRedactionBased<T>` `create(java.io.File file)` Loads a builder specification from the given file.
`static <T> HierarchyBuilderRedactionBased<T>` `create(HierarchyBuilderRedactionBased.Order alignmentOrder, HierarchyBuilderRedactionBased.Order redactionOrder, char redactionCharacter)` Values are aligned according to the alignmentOrder and redacted according to the redactionOrder.
`static <T> HierarchyBuilderRedactionBased<T>` `create(HierarchyBuilderRedactionBased.Order alignmentOrder, HierarchyBuilderRedactionBased.Order redactionOrder, char paddingCharacter, char redactionCharacter)` Values are aligned according to the alignmentOrder and redacted according to the redactionOrder.
`static <T> HierarchyBuilderRedactionBased<T>` `create(java.lang.String file)` Loads a builder specification from the given file.
`HierarchyBuilderRedactionBased.Order` `getAligmentOrder()` Returns the alignment order.
`java.lang.Double` `getAlphabetSize()` Returns properties about the attribute's domain.
`java.lang.Double` `getDomainSize()` Returns properties about the attribute's domain.
`java.lang.Double` `getMaxValueLength()` Returns properties about the attribute's domain.
`char` `getPaddingCharacter()` Returns the padding character.
`char` `getRedactionCharacter()` Returns the redaction character.
`HierarchyBuilderRedactionBased.Order` `getRedactionOrder()` Returns the redaction order.
`boolean` `isDomainPropertiesAvailable()` Returns whether domain-properties are available for this builder.
`int[]` `prepare(java.lang.String[] data)` Prepares the builder.
`void` `setAlphabetSize(int alphabetSize, int maxValueLength)` Sets properties about the attribute's domain.
`void` `setDomainAndAlphabetSize(int domainSize, int alphabetSize, int maxValueLength)` Sets properties about the attribute's domain.
`void` `setDomainMetadata(java.lang.String[] data)` Sets properties about the attribute's domain.
`void` `setDomainSize(int domainSize, int maxValueLength)` Sets properties about the attribute's domain.

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

`getType, save, save`

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

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

### Method Detail

#### create

    public static <T> HierarchyBuilderRedactionBased<T> create(char redactionCharacter)

Values are aligned left-to-right and redacted right-to-left. Redacted characters are replaced with the given character. The same character is used for padding.

Type Parameters:
  `T` -
Parameters:
  `redactionCharacter` -
Returns:

#### create

    public static <T> HierarchyBuilderRedactionBased<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> HierarchyBuilderRedactionBased<T> create(HierarchyBuilderRedactionBased.Order alignmentOrder,
                                                               HierarchyBuilderRedactionBased.Order redactionOrder,
                                                               char redactionCharacter)

Values are aligned according to the alignmentOrder and redacted according to the redactionOrder. Redacted characters are replaced with the given character. The same character is used for padding.

Type Parameters:
  `T` -
Parameters:
  `alignmentOrder` -
  `redactionOrder` -
  `redactionCharacter` -
Returns:

#### create

    public static <T> HierarchyBuilderRedactionBased<T> create(HierarchyBuilderRedactionBased.Order alignmentOrder,
                                                               HierarchyBuilderRedactionBased.Order redactionOrder,
                                                               char paddingCharacter,
                                                               char redactionCharacter)

Values are aligned according to the alignmentOrder and redacted according to the redactionOrder. Redacted characters are replaced with the given character. The padding character is used for padding.

Type Parameters:
  `T` -
Parameters:
  `alignmentOrder` -
  `redactionOrder` -
  `paddingCharacter` -
  `redactionCharacter` -
Returns:

#### create

    public static <T> HierarchyBuilderRedactionBased<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`

#### 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:

#### getAligmentOrder

    public HierarchyBuilderRedactionBased.Order getAligmentOrder()

Returns the alignment order.

Returns:

#### getAlphabetSize

    public java.lang.Double getAlphabetSize()

Returns properties about the attribute's domain. Currently, this information is only used for evaluating information loss with the generalized loss metric for attributes with functional redaction-based hierarchies. May return `null`.

Returns:
  Size of the alphabet: the possible number of elements per character of any value from the domain

#### getDomainSize

    public java.lang.Double getDomainSize()

Returns properties about the attribute's domain. Currently, this information is only used for evaluating information loss with the generalized loss metric for attributes with functional redaction-based hierarchies. May return `null`.

Returns:
  Size of the domain: the number of elements in the domain of the attribute

#### getMaxValueLength

    public java.lang.Double getMaxValueLength()

Returns properties about the attribute's domain. Currently, this information is only used for evaluating information loss with the generalized loss metric for attributes with functional redaction-based hierarchies. May return `null`.

Returns:
  Max. length of an element: the number of characters of the largest element in the domain

#### getPaddingCharacter

    public char getPaddingCharacter()

Returns the padding character.

Returns:

#### getRedactionCharacter

    public char getRedactionCharacter()

Returns the redaction character.

Returns:

#### getRedactionOrder

    public HierarchyBuilderRedactionBased.Order getRedactionOrder()

Returns the redaction order.

Returns:

#### isDomainPropertiesAvailable

    public boolean isDomainPropertiesAvailable()

Returns whether domain-properties are available for this builder. Currently, this information is only used for evaluating information loss with the generalized loss metric for attributes with functional redaction-based hierarchies.

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:

#### setAlphabetSize

    public void setAlphabetSize(int alphabetSize,
                                int maxValueLength)

Sets properties about the attribute's domain. Currently, this information is only used for evaluating information loss with the generalized loss metric for attributes with functional redaction-based hierarchies. Required properties are:

- Size of the domain: the number of elements in the domain of the attribute
- Size of the alphabet: the possible number of elements per character of any value from the domain
- Max. length of an element: the number of characters of the largest element in the domain

As a simplifying assumption, it is assumed that the domain values are distributed equally regarding their length and their characters from the alphabet.

This method will estimate the size of the domain as domainSize = alphabetSize^{maxValueLength}

Parameters:
  `alphabetSize` -
  `maxValueLength` -

#### setDomainAndAlphabetSize

    public void setDomainAndAlphabetSize(int domainSize,
                                         int alphabetSize,
                                         int maxValueLength)

Sets properties about the attribute's domain. Currently, this information is only used for evaluating information loss with the generalized loss metric for attributes with functional redaction-based hierarchies. Required properties are:

- Size of the domain: the number of elements in the domain of the attribute
- Size of the alphabet: the possible number of elements per character of any value from the domain
- Max. length of an element: the number of characters of the largest element in the domain

Parameters:
  `domainSize` -
  `alphabetSize` -
  `maxValueLength` -

#### setDomainMetadata

    public void setDomainMetadata(java.lang.String[] data)

Sets properties about the attribute's domain. Currently, this information is only used for evaluating information loss with the generalized loss metric for attributes with functional redaction-based hierarchies.

Parameters:
  `data` -

#### setDomainSize

    public void setDomainSize(int domainSize,
                              int maxValueLength)

Sets properties about the attribute's domain. Currently, this information is only used for evaluating information loss with the generalized loss metric for attributes with functional redaction-based hierarchies. Required properties are:

- Size of the domain: the number of elements in the domain of the attribute
- Size of the alphabet: the possible number of elements per character of any value from the domain
- Max. length of an element: the number of characters of the largest element in the domain

As a simplifying assumption, it is assumed that the domain values are distributed equally regarding their length and their characters from the alphabet.

This method will estimate the size of the alphabet as alphabetSize = pow(domainSize, 1.0d / maxValueLength)

Parameters:
  `domainSize` -
  `maxValueLength` -