Package com.reportmill.base
Class RMGroup
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList
com.reportmill.base.RMGroup
- All Implemented Interfaces:
- RMKey.ValueForKey,- RMKey.ValueForKeyChain,- Serializable,- Cloneable,- Iterable,- Collection,- List,- RandomAccess
- Direct Known Subclasses:
- RMGroup.Running
This class is a smart List subclass used to hold objects from an original list broken down by grouping keys.
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classThis RMGroup subclass/inner-class represents a subset of a group up to the given endGroup.
- 
Field SummaryFields inherited from class java.util.AbstractListmodCount
- 
Constructor SummaryConstructorsConstructorDescriptionRMGroup()Creates an empty group.Creates a leaf group for the given object and parent group.Creates a group with the (assumed) list of groups.Creates a group by grouping the objects in the given list by the groupings in the given grouper.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddStubGroupsAtLevel(int aLevel, List[] allValues, boolean includeNulls) Make sure allValues are represented at aLevel (add empty value-group for missing values) Currently assumes that children are sorted by allValues.booleanReturns whether children of this group are leafs.booleanList[]getAllDistinctValuesAtLevel(int aLevel, Object nullValue, List[] allValues) Returns two lists - (1) all distinct values at a given group level and (2) a sample group for each value.getGroup(int anIndex) Returns the sub-group at the given index.Returns the last sub-group.getKey()Returns the key associated with this group.static StringReturns the key for the given List if it is an RMGroup instance.Returns the master for this group (generally a leaf from another RMGroup hierarchy).Returns the next group which is a peer to this one.Returns the parent for this group.intReturns the number of parents that this group has.Returns the parent or master for this group.getTable()Returns the table associated with this group.intindex()Returns the index of this group in its parent.booleanisLeaf()Returns whether this group is a leaf group.static booleanReturns whether the given List is an RMGroup instance that also isLeaf.booleanReturns whether this group is made up of the remainders from a TopN sort.voidSets the master for this group.voidSets the table associated with this group.voidsetTopNOthers(boolean aFlag) Sets whether this group is made up of the remainders from a TopN sort.voidsortBySortsInGrouper(RMGrouper aGrouper) Sorts the group byte the sorts listed in the grouper (recursively).subgroup(int start, int end) Returns a subset of this group from start index, inclusive, to end index, exclusive.Returns a subset of this group, running deep, which only includes the subset of the tree starting at startGroup and ending at (but not including) endGroup.voidPerforms top N sort on group for an individual sort.voidtopNWithGrouper(RMGrouper aGrouper) Performs Top N sort on group for a grouper.voidTurns all list objects into leaf groups.valueForKey(String aKey) Custom implementation of valueForKey to handle group heritage keys.valueForKeyChain(Object aKeyChain) Custom implementation of valueForKeyChain to handle top N groups.Methods inherited from class java.util.ArrayListadd, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollectioncontainsAll, toStringMethods inherited from class java.lang.Objectfinalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.CollectionparallelStream, stream, toArrayMethods inherited from interface java.util.ListcontainsAll
- 
Constructor Details- 
RMGrouppublic RMGroup()Creates an empty group.
- 
RMGroupCreates a group with the (assumed) list of groups.
- 
RMGroupCreates a leaf group for the given object and parent group.
- 
RMGroupCreates a group by grouping the objects in the given list by the groupings in the given grouper.
 
- 
- 
Method Details- 
getKeyReturns the key associated with this group.
- 
getKeyReturns the key for the given List if it is an RMGroup instance.
- 
getParentReturns the parent for this group.
- 
getParentCountpublic int getParentCount()Returns the number of parents that this group has.
- 
getMasterReturns the master for this group (generally a leaf from another RMGroup hierarchy).
- 
setMasterSets the master for this group.
- 
getParentOrMasterReturns the parent or master for this group.
- 
getTableReturns the table associated with this group.
- 
setTableSets the table associated with this group.
- 
isLeafpublic boolean isLeaf()Returns whether this group is a leaf group.
- 
isLeafReturns whether the given List is an RMGroup instance that also isLeaf.
- 
isTopNOtherspublic boolean isTopNOthers()Returns whether this group is made up of the remainders from a TopN sort.
- 
setTopNOtherspublic void setTopNOthers(boolean aFlag) Sets whether this group is made up of the remainders from a TopN sort.
- 
indexpublic int index()Returns the index of this group in its parent.
- 
getGroupReturns the sub-group at the given index.
- 
getGroupLastReturns the last sub-group.
- 
getNextPeerReturns the next group which is a peer to this one.
- 
childrenAreLeafspublic boolean childrenAreLeafs()Returns whether children of this group are leafs.
- 
subgroupReturns a subset of this group from start index, inclusive, to end index, exclusive.
- 
subgroupReturns a subset of this group, running deep, which only includes the subset of the tree starting at startGroup and ending at (but not including) endGroup.
- 
topNWithGrouperPerforms Top N sort on group for a grouper.
- 
topNPerforms top N sort on group for an individual sort.
- 
sortBySortsInGrouperSorts the group byte the sorts listed in the grouper (recursively).
- 
addStubGroupsAtLevelMake sure allValues are represented at aLevel (add empty value-group for missing values) Currently assumes that children are sorted by allValues.
- 
getAllDistinctValuesAtLevelReturns two lists - (1) all distinct values at a given group level and (2) a sample group for each value.
- 
turnObjectsIntoLeafspublic void turnObjectsIntoLeafs()Turns all list objects into leaf groups.
- 
valueForKeyCustom implementation of valueForKey to handle group heritage keys.- Specified by:
- valueForKeyin interface- RMKey.ValueForKey
 
- 
valueForKeyChainCustom implementation of valueForKeyChain to handle top N groups.- Specified by:
- valueForKeyChainin interface- RMKey.ValueForKeyChain
 
- 
equals
 
-