Package org.gephi.appearance.api
Interface Partition
-
public interface PartitionPartition 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
nullcan be a valid value.Colors can be associated with values.
-
-
Field Summary
Fields Modifier and Type Field Description static ColorDEFAULT_COLOR
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intcount(Object value, Graph graph)Returns the number of elements for the given value.ColorgetColor(Object value)Returns the color for the given value.ColumngetColumn()Returns the column associated with this partition.intgetElementCount(Graph graph)Returns the number of elements that have a value in this partition.CollectiongetSortedValues(Graph graph)Returns the same collection asgetValues(Graph graph)but sorted descendant in counts.ObjectgetValue(Element element, Graph graph)Returns the element's value for this partition.CollectiongetValues(Graph graph)Returns the collection of values this partition represents.floatpercentage(Object value, Graph graph)Returns the percentage of elements with the given value.voidsetColor(Object value, Color color)Sets the color for the given value.voidsetColors(Graph graph, Color[] colors)Sets the colors for all values.intsize(Graph graph)Returns the number of values this partition represents.
-
-
-
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 asgetValues(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- valuegraph- 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 forgraph- 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 forcolor- color
-
setColors
void setColors(Graph graph, Color[] colors)
Sets the colors for all values. It uses the descending value count as order fromgetSortedValues().- Parameters:
graph- graph this partition applies tocolors- 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
-
-