Package com.rpl.rama

Class Helpers

java.lang.Object
com.rpl.rama.Helpers

public class Helpers extends Object
Collection of static utility methods
  • Constructor Details

    • Helpers

      public Helpers()
  • Method Details

    • genVar

      public static String genVar(String prefix)
      Generates a unique var with the given prefix
      Parameters:
      prefix - Prefix string
      Returns:
      Generated var
      See Also:
    • genVar

      public static String genVar()
      Generates a unique var
      Returns:
      Generated var
      See Also:
    • genPStateVar

      public static String genPStateVar(String prefix)
      Generates a unique PState var with the given prefix
      Parameters:
      prefix - Prefix string
      Returns:
      Generated var
      See Also:
    • genPStateVar

      public static String genPStateVar()
      Generates a unique PState var
      Returns:
      Generated var
      See Also:
    • isGeneratedVar

      public static boolean isGeneratedVar(String s)
      Tests if a string has the format of a regular var or PState var
      Parameters:
      s - String to test
      See Also:
    • getGeneratedVarPrefix

      public static String getGeneratedVarPrefix(String var)
      Gets prefix string used to generate a var
      Parameters:
      var - Var
      See Also:
    • genHashingIndexKeys

      public static List<String> genHashingIndexKeys(int numTasks)
      Generates a key that hashes to each task in a range of tasks. The nth element in the returned list partitions to the nth task. This function is deterministic and will always produce the same keys.
      Parameters:
      numTasks - Number of tasks
    • genHashingIndexKeys

      public static List<String> genHashingIndexKeys(String prefix, int numTasks)
      Generates a key starting with the given prefix that hashes to each task in a range of tasks. The nth element in the returned list partitions to the nth task. This function is deterministic and will always produce the same keys. Calling this function with different prefixes will produce unique keys.
      Parameters:
      prefix - Prefix for each generated key
      numTasks - Number of tasks