Class ResourceVector
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.ResourceVector
Represents a simple resource floating point value grouped by resource names.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDecrements the given resource by the specified value.voiddecrement(ResourceVector otherResourceVector) Decrements values for each resource defined in the given resource vector.booleandoubleinthashCode()voidIncrements the given resource by the specified value.booleanisEmpty()iterator()static ResourceVectorCreates a newResourceVectorwith all pre-defined resources set to zero.static ResourceVectorof(double value) Creates a newResourceVectorwith all pre-defined resources set to the same value.static ResourceVectorof(org.apache.hadoop.yarn.api.records.Resource resource) Creates a newResourceVectorwith the values set in aResourceobject.voidMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ResourceVector
public ResourceVector()
-
-
Method Details
-
newInstance
Creates a newResourceVectorwith all pre-defined resources set to zero.- Returns:
- zero resource vector
-
of
Creates a newResourceVectorwith all pre-defined resources set to the same value.- Parameters:
value- the value to set all resources to- Returns:
- uniform resource vector
-
of
Creates a newResourceVectorwith the values set in aResourceobject.- Parameters:
resource- resource object the resource vector will be based on- Returns:
- uniform resource vector
-
decrement
Decrements values for each resource defined in the given resource vector.- Parameters:
otherResourceVector- rhs resource vector of the subtraction
-
decrement
Decrements the given resource by the specified value.- Parameters:
resourceName- name of the resourcevalue- value to be subtracted from the resource's current value
-
increment
Increments the given resource by the specified value.- Parameters:
resourceName- name of the resourcevalue- value to be added to the resource's current value
-
getValue
-
setValue
-
isEmpty
public boolean isEmpty() -
getResourceNames
-
iterator
-
equals
-
hashCode
public int hashCode()
-