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 and Description |
---|
ResourceMapArrayBridge() |
Modifier and Type | Method and Description |
---|---|
double[] |
empty()
Create an array that has all values 0.
|
Map<String,Integer> |
getResourceNamesToArrayIndex() |
Map<String,Double> |
translateFromResourceArray(double[] resources)
Translates an array of resource values to a normalized resource map.
|
double[] |
translateToResourceArray(Map<String,Double> normalizedResources)
Translates a normalized resource map to an array of resource values.
|
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 arraypublic double[] empty()
Create an array that has all values 0.
public Map<String,Double> translateFromResourceArray(double[] resources)
Translates an array of resource values to a normalized resource map.
resources
- The resource array to translateCopyright © 2019 The Apache Software Foundation. All rights reserved.