Every member of a group is either a count or a duration or a rate, and the members of one group always agree on which. That constraint is the whole point. Combining stats whose units differ produces a plot that looks meaningful and is not: a count against a byte count, or a per-second rate against a total, flattens the smaller series into the baseline and reads as "nothing happening". Members were therefore checked against their declaring code rather than their names.
Grouping is opt-in via PROP_COMBINE and only takes effect where at least two members are already enabled, so enabling a single stat of a group is never silently changed into a combined plot.
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMost series drawn on one plot.static final StringOpt-in property; when false every stat renders on its own as before.Method Summary
All MethodsModifier and TypeMethodDescriptionallGroupIds(Set<String> enabledStats) Every group id that may render for an enabled set: the registry, plus the In/Out pairs those stats form.static booleanWhether every group has a display name of its own.combinedRepresentatives(Set<String> enabledStats, boolean combine, boolean showEvents) Work out which stat, if any, stands for each group given the enabled set.static StringcounterpartOf(String statName) The other half of a bandwidth pair, spelled exactly as a stat name.static StringdisplayPrefixOf(String groupId) The sort prefix for a group, ready to prepend to a title.enabledMembers(String groupId, Set<String> enabledStats) The enabled members of a group, capped atMAX_SERIES.groupIds()List every known graph group id.static StringFind the group a stat belongs to.static booleanWhether an id names a generated In/Out pair rather than a registry group.static booleanisSuppressed(String statName, String combined) Whether an individual stat's own graph is replaced by its group.List the stat names making up a graph group.pairGroupIds(Set<String> enabledStats) The In/Out pairs the enabled stats form.static StringThe directionless name the two rates of a pair share.static booleanshouldCombine(List<String> enabledMembers, boolean combine, boolean showEvents) Whether a group should be drawn as one plot.static StringsubsystemOf(String groupId) The subsystem a group belongs to.suppressedStats(Set<String> enabledStats, boolean combine, boolean showEvents) Every stat drawn on its own after grouping: the enabled stats, minus the members that their group's plot already covers.static StringThe display name of a group, for use as a combined graph title.
Field Details
PROP_COMBINE
Opt-in property; when false every stat renders on its own as before.- See Also:
MAX_SERIES
public static final int MAX_SERIESMost series drawn on one plot.Every group is now at or under
MAX_SERIES: no frame combines more than two, because a tile is too small to read a third line and two hues are all the palette needs. This stays as a hard cap so a group added later cannot silently exceed it, andGraphGroupsTestasserts the current groups all comply.- See Also:
Method Details
displayPrefixOf
The sort prefix for a group, ready to prepend to a title.Untranslated by design, see
SUBSYSTEMS.- Parameters:
groupId- a group id, or null- Returns:
"[Peers] "including the trailing space, or the empty string when the group has no subsystem or the id is unknown
subsystemOf
The subsystem a group belongs to.A generated In/Out pair is not in
SUBSYSTEMS; it is a pool rate and answers "how much is this service carrying", so it sorts with the other service graphs under the pool subsystem.- Parameters:
groupId- a group id, or null- Returns:
- the subsystem name, or null when the group has none
titleOf
The display name of a group, for use as a combined graph title.A generated pair is named after the directionless half the two rates share, with the brackets a pool name carries dropped:
[skank.i2p]is already a name, and nesting it inside the title's own brackets reads as markup.- Parameters:
groupId- a group id- Returns:
- the title, never null; an unknown id yields the id itself
allGroupsTitled
public static boolean allGroupsTitled()Whether every group has a display name of its own.- Returns:
- true when the title map covers the registry exactly
members
groupIds
isPairId
Whether an id names a generated In/Out pair rather than a registry group.- Parameters:
groupId- a group id, or null- Returns:
- true for a generated pair id
pairKeyOf
counterpartOf
pairGroupIds
The In/Out pairs the enabled stats form.Only pairs the user has switched on both halves of are returned: a group id for a half-enabled pair would render as an empty tile, and pairing must never turn a single enabled stat into a combined plot. Stats the registry already claims are skipped, so a declared group and a generated one can never cover the same rate.
- Parameters:
enabledStats- stat names enabled by the user, without period suffixes; null yields no pairs- Returns:
- the pair ids, in name order; never null
allGroupIds
groupOf
enabledMembers
The enabled members of a group, capped atMAX_SERIES.Never null; an empty list means the group has too few enabled members to be worth combining.
- Parameters:
groupId- a group idenabledStats- stat names the user has switched on, without any period suffix- Returns:
- members that are enabled, in legend order
shouldCombine
public static boolean shouldCombine(List<String> enabledMembers, boolean combine, boolean showEvents) Whether a group should be drawn as one plot.Requires the opt-in, at least two enabled members, and no event-graph mode: events change what a datasource means, so they are not combined.
- Parameters:
enabledMembers- result ofenabledMembers(String, Set)combine- value ofPROP_COMBINEshowEvents- whether the graph page is in event mode- Returns:
- true when the members collapse into one graph
isSuppressed
Whether an individual stat's own graph is replaced by its group.- Parameters:
statName- the stat being rendered on its owncombined- the stat name that stands for its group, or null when not combining- Returns:
- true when this stat must be suppressed in favour of the group plot
combinedRepresentatives
public static Map<String,String> combinedRepresentatives(Set<String> enabledStats, boolean combine, boolean showEvents) Work out which stat, if any, stands for each group given the enabled set.- Parameters:
enabledStats- stat names enabled by the usercombine- value ofPROP_COMBINEshowEvents- whether the graph page is in event mode- Returns:
- group id to the member chosen to carry the group's graph; groups that do not qualify are absent
suppressedStats
public static Set<String> suppressedStats(Set<String> enabledStats, boolean combine, boolean showEvents) Every stat drawn on its own after grouping: the enabled stats, minus the members that their group's plot already covers.- Parameters:
enabledStats- stat names enabled by the usercombine- value ofPROP_COMBINEshowEvents- whether the graph page is in event mode- Returns:
- stats to render individually, order unspecified