java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.Double>>public class ResourceVector
extends java.lang.Object
implements java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.Double>>
| Constructor | Description |
|---|---|
ResourceVector() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
decrement(java.lang.String resourceName,
double value) |
Decrements the given resource by the specified value.
|
void |
decrement(ResourceVector otherResourceVector) |
Decrements values for each resource defined in the given resource vector.
|
boolean |
equals(java.lang.Object o) |
|
java.util.Set<java.lang.String> |
getResourceNames() |
|
double |
getValue(java.lang.String resourceName) |
|
int |
hashCode() |
|
void |
increment(java.lang.String resourceName,
double value) |
Increments the given resource by the specified value.
|
boolean |
isEmpty() |
|
java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Double>> |
iterator() |
|
static ResourceVector |
newInstance() |
Creates a new
ResourceVector with all pre-defined resources set to
zero. |
static ResourceVector |
of(double value) |
Creates a new
ResourceVector with all pre-defined resources set to
the same value. |
static ResourceVector |
of(org.apache.hadoop.yarn.api.records.Resource resource) |
Creates a new
ResourceVector with the values set in a
Resource object. |
void |
setValue(java.lang.String resourceName,
double value) |
public static ResourceVector newInstance()
ResourceVector with all pre-defined resources set to
zero.public static ResourceVector of(double value)
ResourceVector with all pre-defined resources set to
the same value.value - the value to set all resources topublic static ResourceVector of(org.apache.hadoop.yarn.api.records.Resource resource)
ResourceVector with the values set in a
Resource object.resource - resource object the resource vector will be based onpublic void decrement(ResourceVector otherResourceVector)
otherResourceVector - rhs resource vector of the subtractionpublic void decrement(java.lang.String resourceName,
double value)
resourceName - name of the resourcevalue - value to be subtracted from the resource's current valuepublic void increment(java.lang.String resourceName,
double value)
resourceName - name of the resourcevalue - value to be added to the resource's current valuepublic double getValue(java.lang.String resourceName)
public void setValue(java.lang.String resourceName,
double value)
public boolean isEmpty()
public java.util.Set<java.lang.String> getResourceNames()
public java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Double>> iterator()
iterator in interface java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.Double>>public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.ObjectCopyright © 2008–2025 Apache Software Foundation. All rights reserved.