Package com.inductiveautomation.rm.base
Class RMGroup
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList
-
- com.inductiveautomation.rm.base.RMGroup
-
- All Implemented Interfaces:
RMKey.Get,RMKeyChain.Get,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.Get, RMKeyChain.Get
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 Summary
Nested Classes Modifier and Type Class Description static classRMGroup.RunningThis RMGroup subclass/inner-class represents a subset of a group up to the given endGroup.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RMGroupclone()Standard clone implementation.RMGroupcloneDeep()Clone deep implementation - clones this group and any child groups.RMGroupcloneEmpty()Clone deep implementation - clones this group and any child groups.booleanequals(java.lang.Object anObj)Standard equals.java.util.ListgetAllValues(java.lang.String aKey)Returns all values for a given grouping in this group hierarchy.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 aList)Returns the key for the given List if it is an RMGroup instance.java.lang.ObjectgetKeyChainValue(java.lang.Object aRoot, RMKeyChain aKeyChain)Custom implementation of valueForKeyChain to handle top N groups.java.lang.ObjectgetKeyValue(java.lang.String aKey)Custom implementation of valueForKey to handle group heritage keys.RMGroupgetNextPeer()Returns the next group which is a peer to this one.RMGroupgetPageEndGroup()Returns the child group for the most recent page end.RMGroupgetPageStartGroup()Returns the child group for the most recent page start.RMGroupgetParent()Returns the parent for this group.intgetParentCount()Returns the number of parents that this group has.java.lang.ObjectgetValue()Returns the value associated with this group.voidgroupBy(RMGrouper aGrouper, int start)Groups this group by the groupings in the given grouper.voidgroupBy(RMGrouping aGrouping)Groups this group by given grouping.voidgroupBy(RMGrouping aGrouping, java.util.List aValuesList)Groups this group by given grouping.voidgroupByKey(java.lang.String aKey, java.util.List aValuesList)Groups a new group by given keys list.voidgroupByLeafKey(java.lang.String aKey)Turns all list objects into leaf groups.intindex()Returns the index of this group in its parent.booleanisAncestor(RMGroup aGroup)Returns whether given group is an ancestor group.booleanisLeaf()Returns whether this group is a leaf group.static booleanisLeaf(java.util.List aList)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.voidsetPageEndGroup(RMGroup aGroup)Sets the child group for the most recent page end.voidsetPageStartGroup(RMGroup aGroup)Sets the child group for the most recent page start.voidsetParent(RMGroup aGroup)Sets the parent for this group.voidsetTopNOthers(boolean aFlag)Sets whether this group is made up of the remainders from a TopN sort.voidsortBy(RMGrouping aGrouping)Sorts by sorts in given grouping.voidsortBy(java.util.List aSortList)Sorts the group by the sorts in the given list.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.voidtopNSortBy(RMTopNSort aSort)Performs top N sort on group for an individual sort.java.lang.StringtoString()Returns a string representation of this group.-
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, 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
-
-
-
-
Method Detail
-
getKey
public java.lang.String getKey()
Returns the key associated with this group.
-
getValue
public java.lang.Object getValue()
Returns the value associated with this group.
-
getParent
public RMGroup getParent()
Returns the parent for this group.
-
setParent
public void setParent(RMGroup aGroup)
Sets the parent for this group.
-
getParentCount
public int getParentCount()
Returns the number of parents that this group has.
-
isAncestor
public boolean isAncestor(RMGroup aGroup)
Returns whether given group is an ancestor group.
-
isLeaf
public boolean isLeaf()
Returns whether this group is a leaf group.
-
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.
-
getPageStartGroup
public RMGroup getPageStartGroup()
Returns the child group for the most recent page start.
-
setPageStartGroup
public void setPageStartGroup(RMGroup aGroup)
Sets the child group for the most recent page start.
-
getPageEndGroup
public RMGroup getPageEndGroup()
Returns the child group for the most recent page end.
-
setPageEndGroup
public void setPageEndGroup(RMGroup aGroup)
Sets the child group for the most recent page end.
-
index
public int index()
Returns the index of this group in its parent.
-
getGroup
public RMGroup getGroup(int anIndex)
Returns the sub-group at the given index.
-
getGroupLast
public RMGroup getGroupLast()
Returns the last sub-group.
-
groupBy
public void groupBy(RMGrouper aGrouper, int start)
Groups this group by the groupings in the given grouper.
-
groupBy
public void groupBy(RMGrouping aGrouping)
Groups this group by given grouping.
-
groupBy
public void groupBy(RMGrouping aGrouping, java.util.List aValuesList)
Groups this group by given grouping.
-
groupByKey
public void groupByKey(java.lang.String aKey, java.util.List aValuesList)Groups a new group by given keys list.
-
groupByLeafKey
public void groupByLeafKey(java.lang.String aKey)
Turns all list objects into leaf groups.
-
topNSortBy
public void topNSortBy(RMTopNSort aSort)
Performs top N sort on group for an individual sort.
-
sortBy
public void sortBy(RMGrouping aGrouping)
Sorts by sorts in given grouping.
-
sortBy
public void sortBy(java.util.List aSortList)
Sorts the group by the sorts in the given list.
-
getAllValues
public java.util.List getAllValues(java.lang.String aKey)
Returns all values for a given grouping in this group hierarchy.
-
subgroup
public RMGroup subgroup(int start, int end)
Returns a subset of this group from start index, inclusive, to end index, exclusive.
-
subgroup
public 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.
-
getKey
public static java.lang.String getKey(java.util.List aList)
Returns the key for the given List if it is an RMGroup instance.
-
isLeaf
public static boolean isLeaf(java.util.List aList)
Returns whether the given List is an RMGroup instance that also isLeaf.
-
getKeyValue
public java.lang.Object getKeyValue(java.lang.String aKey)
Custom implementation of valueForKey to handle group heritage keys.- Specified by:
getKeyValuein interfaceRMKey.Get
-
getKeyChainValue
public java.lang.Object getKeyChainValue(java.lang.Object aRoot, RMKeyChain aKeyChain)Custom implementation of valueForKeyChain to handle top N groups.- Specified by:
getKeyChainValuein interfaceRMKeyChain.Get
-
getNextPeer
public RMGroup getNextPeer()
Returns the next group which is a peer to this one.
-
equals
public boolean equals(java.lang.Object anObj)
Standard equals. Just check identity because leaf objects might be interconnected (and can stack overflow).- Specified by:
equalsin interfacejava.util.Collection- Specified by:
equalsin interfacejava.util.List- Overrides:
equalsin classjava.util.ArrayList
-
clone
public RMGroup clone()
Standard clone implementation.- Overrides:
clonein classjava.util.ArrayList
-
cloneDeep
public RMGroup cloneDeep()
Clone deep implementation - clones this group and any child groups.
-
cloneEmpty
public RMGroup cloneEmpty()
Clone deep implementation - clones this group and any child groups.
-
toString
public java.lang.String toString()
Returns a string representation of this group.- Overrides:
toStringin classjava.util.AbstractCollection
-
-