Package org.gcube.common.health.api
Class Figure
java.lang.Object
org.gcube.common.health.api.Figure
One figure of a group of
Statistics, with the label a page shows and its kind, which tells
the page how to draw it:
- "number": one number, drawn as a tile;
- "distribution": the parts of a whole by name (e.g. the requests by outcome), drawn as a donut with percentages;
- "states": the parts of a whole by state (e.g. the Contexts by state), with what each
state means (
State), drawn like a distribution with the colour of each meaning; - "values": a number by name that is not a part of a whole (e.g. an average per depth), drawn as bars, without percentages.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe kind of a figure that gives the parts of a whole by name.static final StringThe kind of a figure that is one number.static final StringThe kind of a figure that gives the parts of a whole by state.static final StringThe kind of a figure that gives a number by name, not the parts of a whole. -
Method Summary
Modifier and TypeMethodDescriptionstatic FigureCreates a figure that gives the parts of a whole by name, in the order given.booleangetId()getKind()getLabel()Returns what each state of a figure of kind "states" means.getValue()inthashCode()static FigureCreates a figure that is a number.static FigureCreates a figure that gives the parts of a whole by state, in the order given, with what each state means.toString()static FigureCreates a figure that gives a number by name that is not a part of a whole (e.g. an average, a median or a maximum per depth), in the order given.
-
Field Details
-
NUMBER
The kind of a figure that is one number.- See Also:
-
DISTRIBUTION
The kind of a figure that gives the parts of a whole by name.- See Also:
-
STATES
The kind of a figure that gives the parts of a whole by state.- See Also:
-
VALUES
The kind of a figure that gives a number by name, not the parts of a whole.- See Also:
-
-
Method Details
-
number
Creates a figure that is a number.- Parameters:
id- the identifier of the figure in its group, lowerCamelCaselabel- what a page writes next to it, e.g. "Requests since start"value- the number- Returns:
- the figure
-
distribution
Creates a figure that gives the parts of a whole by name, in the order given.- Parameters:
id- the identifier of the figure in its group, lowerCamelCaselabel- what a page writes next to it, e.g. "Requests by outcome"parts- the number of each part, by its name- Returns:
- the figure
-
states
public static Figure states(String id, String label, Map<String, ? extends Number> parts, Map<String, State> meaning) Creates a figure that gives the parts of a whole by state, in the order given, with what each state means.- Parameters:
id- the identifier of the figure in its group, lowerCamelCaselabel- what a page writes next to it, e.g. "Contexts by state"parts- the number of each state, by its name (e.g.active,suspended)meaning- what each state means; every state ofpartsmust have one- Returns:
- the figure
- Throws:
IllegalArgumentException- when a state has no meaning
-
values
Creates a figure that gives a number by name that is not a part of a whole (e.g. an average, a median or a maximum per depth), in the order given.- Parameters:
id- the identifier of the figure in its group, lowerCamelCaselabel- what a page writes next to it, e.g. "Children per Context, average by depth"values- the number, by its name- Returns:
- the figure
-
getId
-
getLabel
-
getKind
- Returns:
- the kind
-
getValue
Returns the value: aNumberfor "number", an unmodifiableMapof numbers by name for the other kinds.- Returns:
- the value
-
getStates
Returns what each state of a figure of kind "states" means.- Returns:
- the meaning by state,
nullfor the other kinds
-
equals
-
hashCode
public int hashCode() -
toString
-