Class RMKeyChainAggr

java.lang.Object
com.inductiveautomation.rm.base.RMKeyChainAggr
All Implemented Interfaces:
RMKey.Get, RMKeyChain.Get

public class RMKeyChainAggr extends Object implements RMKey.Get, RMKeyChain.Get
A class to evaluate keys on lists.
  • Constructor Details

    • RMKeyChainAggr

      public RMKeyChainAggr(List aList)
      Creates a new RMKeyChainAggregator.
  • Method Details

    • getKeyValue

      public Object getKeyValue(String aKey)
      Override to give list chance to implement this.
      Specified by:
      getKeyValue in interface RMKey.Get
    • getKeyChainValue

      public Object getKeyChainValue(Object aRoot, RMKeyChain aKeyChain)
      Override to give list chance to implement this.
      Specified by:
      getKeyChainValue in interface RMKeyChain.Get
    • getMethodName

      protected String getMethodName(RMKeyChain aKeyChain)
      Returns the method name for a KeyChain.
    • getMethodArgs

      protected RMKeyChain getMethodArgs(RMKeyChain aKeyChain)
      Returns the method args.
    • getAggrMethodImpl

      public static Method getAggrMethodImpl(String aName)
      Returns a method for a method name (assuming {List,KeyChain} args).
    • total

      public static double total(List aList, RMKeyChain aKeyChain)
      Returns the total resulting from evaluating given keychain on given list of objects (nulls are zero).
    • total2

      public static double total2(List aList, RMKeyChain aKeyChain)
      Returns the total resulting from evaluating given keychain on given list of objects (nulls are zero).
    • totalX

      public static Double totalX(List aList, RMKeyChain aKeyChain)
      Returns the total resulting from evaluating given keychain on given list of objects (nulls short circuit).
    • count

      public static int count(List aList, RMKeyChain aKeyChain)
      Returns the count of the given list or if keychain is present, all non-null values.
    • countDeep

      public static int countDeep(List aList, RMKeyChain aKeyChain)
      Returns the count of all non-null leaf nodes in given list.
    • countUnique

      public static int countUnique(List aList, RMKeyChain aKeyChain)
      Returns the count of the unique values for a given list and key chain.
    • average

      public static double average(List aList, RMKeyChain aKeyChain)
      Returns the average resulting by evaluating the keychain on given list objects.
    • averageX

      public static Double averageX(List aList, RMKeyChain aKeyChain)
      Returns the average resulting by evaluating the keychain on given list objects.
    • min

      public static Object min(List aList, RMKeyChain aKeyChain)
      Returns the minimum result of evaluating the keychain on given list objects.
    • max

      public static Object max(List aList, RMKeyChain aKeyChain)
      Returns the maximum result of evaluating the keychain on given list objects.
    • get

      public static Object get(List aList, RMKeyChain aKeyChain)
      Returns the specific object that meets the criteria.
    • filter

      public static List filter(List aList, RMKeyChain aKeyChain)
      Returns the original list with items that fail the given boolean key chain removed.
    • group

      public static List group(List aList, RMKeyChain aKeyChain)
      Returns the original list grouped by the given key chain.
    • join

      public static String join(List aList, RMKeyChain aKeyChain)
      Aggregator version of join. aKeyChain is an arglist with 2 args, as in join(getName, "\n") The first arg is the keychain to be evaluated for each object in list, and the second arg is the separator string.
    • listOf

      public static List listOf(List aList, RMKeyChain aKeyChain)
      Returns a list of objects by evaluating keychain on given list.
    • shouldRecurse

      public static boolean shouldRecurse(List aList, RMKeyChain aKeyChain)
      Returns whether given list should be recursed into for aggregate calculations.
    • getListValue

      public static Object getListValue(Object anObj, RMKeyChain aKeyChain)
      Silly method to support DatasetKeys like: List1Key.List2Key, which returns a flattened Master/Detail list.