Class ResourceMapArrayBridge


public class ResourceMapArrayBridge extends Object
Provides translation between normalized resource maps and resource value arrays. Some operations use resource value arrays instead of the full normalized resource map as an optimization. See NormalizedResources.
  • Constructor Details

    • ResourceMapArrayBridge

      public ResourceMapArrayBridge()
  • Method Details

    • translateToResourceArray

      public double[] translateToResourceArray(Map<String,Double> normalizedResources)
      Translates a normalized resource map to an array of resource values. Each resource name will be assigned an index in the array, which is guaranteed to be consistent with subsequent invocations of this method. Note that CPU and memory resources are not translated by this method, as they are expected to be captured elsewhere.
      normalizedResources - The resources to translate to an array
      The array of resource values
    • empty

      public double[] empty()
      Create an array that has all values 0.
      the empty array.
    • translateFromResourceArray

      public Map<String,Double> translateFromResourceArray(double[] resources)
      Translates an array of resource values to a normalized resource map.
      resources - The resource array to translate
      The normalized resource map
    • getResourceNamesToArrayIndex

      public Map<String,Integer> getResourceNamesToArrayIndex()