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 Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
This RMGroup subclass/inner-class represents a subset of a group up to the given endGroup. -
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ConstructorsConstructorDescriptionRMGroup()
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 Summary
Modifier and TypeMethodDescriptionvoid
addStubGroupsAtLevel
(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.boolean
Returns whether children of this group are leafs.boolean
List[]
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 String
Returns 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.int
Returns the number of parents that this group has.Returns the parent or master for this group.getTable()
Returns the table associated with this group.int
index()
Returns the index of this group in its parent.boolean
isLeaf()
Returns whether this group is a leaf group.static boolean
Returns whether the given List is an RMGroup instance that also isLeaf.boolean
Returns whether this group is made up of the remainders from a TopN sort.void
Sets the master for this group.void
Sets the table associated with this group.void
setTopNOthers
(boolean aFlag) Sets whether this group is made up of the remainders from a TopN sort.void
sortBySortsInGrouper
(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.void
Performs top N sort on group for an individual sort.void
topNWithGrouper
(RMGrouper aGrouper) Performs Top N sort on group for a grouper.void
Turns 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.ArrayList
add, 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
Methods inherited from class java.util.AbstractCollection
containsAll, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods inherited from interface java.util.List
containsAll
-
Constructor Details
-
RMGroup
public RMGroup()Creates an empty group. -
RMGroup
Creates a group with the (assumed) list of groups. -
RMGroup
Creates a leaf group for the given object and parent group. -
RMGroup
Creates a group by grouping the objects in the given list by the groupings in the given grouper.
-
-
Method Details
-
getKey
Returns the key associated with this group. -
getKey
Returns the key for the given List if it is an RMGroup instance. -
getParent
Returns the parent for this group. -
getParentCount
public int getParentCount()Returns the number of parents that this group has. -
getMaster
Returns the master for this group (generally a leaf from another RMGroup hierarchy). -
setMaster
Sets the master for this group. -
getParentOrMaster
Returns the parent or master for this group. -
getTable
Returns the table associated with this group. -
setTable
Sets the table associated with this group. -
isLeaf
public boolean isLeaf()Returns whether this group is a leaf group. -
isLeaf
Returns whether the given List is an RMGroup instance that also isLeaf. -
isTopNOthers
public boolean isTopNOthers()Returns whether this group is made up of the remainders from a TopN sort. -
setTopNOthers
public void setTopNOthers(boolean aFlag) Sets whether this group is made up of the remainders from a TopN sort. -
index
public int index()Returns the index of this group in its parent. -
getGroup
Returns the sub-group at the given index. -
getGroupLast
Returns the last sub-group. -
getNextPeer
Returns the next group which is a peer to this one. -
childrenAreLeafs
public boolean childrenAreLeafs()Returns whether children of this group are leafs. -
subgroup
Returns a subset of this group from start index, inclusive, to end index, exclusive. -
subgroup
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. -
topNWithGrouper
Performs Top N sort on group for a grouper. -
topN
Performs top N sort on group for an individual sort. -
sortBySortsInGrouper
Sorts the group byte the sorts listed in the grouper (recursively). -
addStubGroupsAtLevel
Make sure allValues are represented at aLevel (add empty value-group for missing values) Currently assumes that children are sorted by allValues. -
getAllDistinctValuesAtLevel
Returns two lists - (1) all distinct values at a given group level and (2) a sample group for each value. -
turnObjectsIntoLeafs
public void turnObjectsIntoLeafs()Turns all list objects into leaf groups. -
valueForKey
Custom implementation of valueForKey to handle group heritage keys.- Specified by:
valueForKey
in interfaceRMKey.ValueForKey
-
valueForKeyChain
Custom implementation of valueForKeyChain to handle top N groups.- Specified by:
valueForKeyChain
in interfaceRMKey.ValueForKeyChain
-
equals
-