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,- java.io.Serializable,- java.lang.Cloneable,- java.lang.Iterable,- java.util.Collection,- java.util.List,- java.util.RandomAccess
 - Direct Known Subclasses:
- RMGroup.Running
 
 public class RMGroup extends java.util.ArrayList implements RMKey.ValueForKey, RMKey.ValueForKeyChain This class is a smart List subclass used to hold objects from an original list broken down by grouping keys.- See Also:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classRMGroup.RunningThis RMGroup subclass/inner-class represents a subset of a group up to the given endGroup.
 - 
Constructor SummaryConstructors Constructor Description RMGroup()Creates an empty group.RMGroup(java.lang.Object obj, RMGroup aGroup)Creates a leaf group for the given object and parent group.RMGroup(java.util.List aList)Creates a group with the (assumed) list of groups.RMGroup(java.util.List aList, RMGrouper aGrouper)Creates a group by grouping the objects in the given list by the groupings in the given grouper.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddStubGroupsAtLevel(int aLevel, java.util.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.booleanchildrenAreLeafs()Returns whether children of this group are leafs.booleanequals(java.lang.Object o)java.util.List[]getAllDistinctValuesAtLevel(int aLevel, java.lang.Object nullValue, java.util.List[] allValues)Returns two lists - (1) all distinct values at a given group level and (2) a sample group for each value.RMGroupgetGroup(int anIndex)Returns the sub-group at the given index.RMGroupgetGroupLast()Returns the last sub-group.java.lang.StringgetKey()Returns the key associated with this group.static java.lang.StringgetKey(java.util.List l)Returns the key for the given List if it is an RMGroup instance.RMGroupgetMaster()Returns the master for this group (generally a leaf from another RMGroup hierarchy).RMGroupgetNextPeer()Returns the next group which is a peer to this one.RMGroupgetParent()Returns the parent for this group.intgetParentCount()Returns the number of parents that this group has.RMGroupgetParentOrMaster()Returns the parent or master for this group.RMTablegetTable()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 booleanisLeaf(java.util.List l)Returns whether the given List is an RMGroup instance that also isLeaf.booleanisTopNOthers()Returns whether this group is made up of the remainders from a TopN sort.voidsetMaster(RMGroup aGroup)Sets the master for this group.voidsetTable(RMTable aTable)Sets 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).RMGroupsubgroup(int start, int end)Returns a subset of this group from start index, inclusive, to end index, exclusive.RMGroupsubgroup(RMGroup startGroup, RMGroup endGroup)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.voidtopN(int count, RMSort aSort, boolean includeOthers)Performs top N sort on group for an individual sort.voidtopNWithGrouper(RMGrouper aGrouper)Performs Top N sort on group for a grouper.voidturnObjectsIntoLeafs()Turns all list objects into leaf groups.java.lang.ObjectvalueForKey(java.lang.String aKey)Custom implementation of valueForKey to handle group heritage keys.java.lang.ObjectvalueForKeyChain(java.lang.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, trimToSize
 
- 
 
- 
- 
- 
Constructor Detail- 
RMGrouppublic RMGroup() Creates an empty group.
 - 
RMGrouppublic RMGroup(java.util.List aList) Creates a group with the (assumed) list of groups.
 - 
RMGrouppublic RMGroup(java.lang.Object obj, RMGroup aGroup)Creates a leaf group for the given object and parent group.
 - 
RMGrouppublic RMGroup(java.util.List aList, RMGrouper aGrouper)Creates a group by grouping the objects in the given list by the groupings in the given grouper.
 
- 
 - 
Method Detail- 
getKeypublic java.lang.String getKey() Returns the key associated with this group.
 - 
getKeypublic static java.lang.String getKey(java.util.List l) Returns the key for the given List if it is an RMGroup instance.
 - 
getParentpublic RMGroup getParent() Returns the parent for this group.
 - 
getParentCountpublic int getParentCount() Returns the number of parents that this group has.
 - 
getMasterpublic RMGroup getMaster() Returns the master for this group (generally a leaf from another RMGroup hierarchy).
 - 
setMasterpublic void setMaster(RMGroup aGroup) Sets the master for this group.
 - 
getParentOrMasterpublic RMGroup getParentOrMaster() Returns the parent or master for this group.
 - 
getTablepublic RMTable getTable() Returns the table associated with this group.
 - 
setTablepublic void setTable(RMTable aTable) Sets the table associated with this group.
 - 
isLeafpublic boolean isLeaf() Returns whether this group is a leaf group.
 - 
isLeafpublic static boolean isLeaf(java.util.List l) Returns 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.
 - 
getGrouppublic RMGroup getGroup(int anIndex) Returns the sub-group at the given index.
 - 
getGroupLastpublic RMGroup getGroupLast() Returns the last sub-group.
 - 
getNextPeerpublic RMGroup getNextPeer() Returns the next group which is a peer to this one.
 - 
childrenAreLeafspublic boolean childrenAreLeafs() Returns whether children of this group are leafs.
 - 
subgrouppublic RMGroup subgroup(int start, int end) Returns a subset of this group from start index, inclusive, to end index, exclusive.
 - 
subgrouppublic RMGroup subgroup(RMGroup startGroup, RMGroup endGroup) 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.
 - 
topNWithGrouperpublic void topNWithGrouper(RMGrouper aGrouper) Performs Top N sort on group for a grouper.
 - 
topNpublic void topN(int count, RMSort aSort, boolean includeOthers)Performs top N sort on group for an individual sort.
 - 
sortBySortsInGrouperpublic void sortBySortsInGrouper(RMGrouper aGrouper) Sorts the group byte the sorts listed in the grouper (recursively).
 - 
addStubGroupsAtLevelpublic void addStubGroupsAtLevel(int aLevel, java.util.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.
 - 
getAllDistinctValuesAtLevelpublic java.util.List[] getAllDistinctValuesAtLevel(int aLevel, java.lang.Object nullValue, java.util.List[] allValues)Returns 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.
 - 
valueForKeypublic java.lang.Object valueForKey(java.lang.String aKey) Custom implementation of valueForKey to handle group heritage keys.- Specified by:
- valueForKeyin interface- RMKey.ValueForKey
 
 - 
valueForKeyChainpublic java.lang.Object valueForKeyChain(java.lang.Object aKeyChain) Custom implementation of valueForKeyChain to handle top N groups.- Specified by:
- valueForKeyChainin interface- RMKey.ValueForKeyChain
 
 - 
equalspublic boolean equals(java.lang.Object o) - Specified by:
- equalsin interface- java.util.Collection
- Specified by:
- equalsin interface- java.util.List
- Overrides:
- equalsin class- java.util.ArrayList
 
 
- 
 
-