Class RMGroup

All Implemented Interfaces:
RMKey.Get, RMKeyChain.Get, Serializable, Cloneable, Iterable, Collection, List, RandomAccess
Direct Known Subclasses:
RMGroup.Running

public class RMGroup extends 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:
  • Constructor Details

    • RMGroup

      public RMGroup()
      Creates an empty group.
    • RMGroup

      public RMGroup(List aList)
      Creates a group with the (assumed) list of groups.
  • Method Details

    • getKey

      public String getKey()
      Returns the key associated with this group.
    • getValue

      public 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, List aValuesList)
      Groups this group by given grouping.
    • groupByKey

      public void groupByKey(String aKey, List aValuesList)
      Groups a new group by given keys list.
    • groupByLeafKey

      public void groupByLeafKey(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(List aSortList)
      Sorts the group by the sorts in the given list.
    • getAllValues

      public List getAllValues(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 String getKey(List aList)
      Returns the key for the given List if it is an RMGroup instance.
    • isLeaf

      public static boolean isLeaf(List aList)
      Returns whether the given List is an RMGroup instance that also isLeaf.
    • getKeyValue

      public Object getKeyValue(String aKey)
      Custom implementation of valueForKey to handle group heritage keys.
      Specified by:
      getKeyValue in interface RMKey.Get
    • getKeyChainValue

      public Object getKeyChainValue(Object aRoot, RMKeyChain aKeyChain)
      Custom implementation of valueForKeyChain to handle top N groups.
      Specified by:
      getKeyChainValue in interface RMKeyChain.Get
    • getNextPeer

      public RMGroup getNextPeer()
      Returns the next group which is a peer to this one.
    • equals

      public boolean equals(Object anObj)
      Standard equals. Just check identity because leaf objects might be interconnected (and can stack overflow).
      Specified by:
      equals in interface Collection
      Specified by:
      equals in interface List
      Overrides:
      equals in class ArrayList
    • clone

      public RMGroup clone()
      Standard clone implementation.
      Overrides:
      clone in class 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 String toString()
      Returns a string representation of this group.
      Overrides:
      toString in class AbstractCollection