Interface Partition


  • public interface Partition
    Partition configuration for categorical attributes.

    This interface has access to the underlying index so it can return the complete collection of different values, as well as the number of elements with this value.

    Note that null can be a valid value.

    Colors can be associated with values.

    • Field Detail

      • DEFAULT_COLOR

        static final Color DEFAULT_COLOR
    • Method Detail

      • getValues

        Collection getValues​(Graph graph)
        Returns the collection of values this partition represents. Each value has at least one element.
        Parameters:
        graph - graph this partition applies to
        Returns:
        values
      • getSortedValues

        Collection getSortedValues​(Graph graph)
        Returns the same collection as getValues(Graph graph) but sorted descendant in counts.
        Parameters:
        graph - graph this partition applies to
        Returns:
        sorted values
      • getElementCount

        int getElementCount​(Graph graph)
        Returns the number of elements that have a value in this partition.
        Parameters:
        graph - graph this partition applies to
        Returns:
        element count
      • count

        int count​(Object value,
                  Graph graph)
        Returns the number of elements for the given value.
        Parameters:
        value - value
        graph - graph this partition applies to
        Returns:
        value count
      • getValue

        Object getValue​(Element element,
                        Graph graph)
        Returns the element's value for this partition.
        Parameters:
        element - element to get the value for
        graph - graph this element belongs to
        Returns:
        the value for this partition
      • getColor

        Color getColor​(Object value)
        Returns the color for the given value.
        Parameters:
        value - value to get the color for
        Returns:
        color or null if not defined
      • setColor

        void setColor​(Object value,
                      Color color)
        Sets the color for the given value.
        Parameters:
        value - value to set the color for
        color - color
      • setColors

        void setColors​(Graph graph,
                       Color[] colors)
        Sets the colors for all values. It uses the descending value count as order from getSortedValues().
        Parameters:
        graph - graph this partition applies to
        colors - colors to set
      • percentage

        float percentage​(Object value,
                         Graph graph)
        Returns the percentage of elements with the given value.
        Parameters:
        value - value
        Returns:
        percentage, between zero and 100
      • size

        int size​(Graph graph)
        Returns the number of values this partition represents.
        Parameters:
        graph - this element belongs to
        Returns:
        value count
      • getColumn

        Column getColumn()
        Returns the column associated with this partition.
        Returns:
        column or null if partition not based on a column