Class PlacementConstraint.CardinalityConstraint
java.lang.Object
org.apache.hadoop.yarn.api.resource.PlacementConstraint.AbstractConstraint
org.apache.hadoop.yarn.api.resource.PlacementConstraint.CardinalityConstraint
- All Implemented Interfaces:
PlacementConstraint.Visitable
- Enclosing class:
- PlacementConstraint
public static class PlacementConstraint.CardinalityConstraint
extends PlacementConstraint.AbstractConstraint
Class that represents a cardinality constraint. Such a constraint allows
the number of allocations with a specific set of tags and within a given
scope to be between some minimum and maximum values.
It is a specialized version of the
PlacementConstraint.SingleConstraint, where the
target is a set of allocation tags.-
Constructor Summary
ConstructorsConstructorDescriptionCardinalityConstraint(String scope, int minCardinality, int maxCardinality, Set<String> allocationTags) -
Method Summary
Modifier and TypeMethodDescription<T> Taccept(PlacementConstraint.Visitor<T> visitor) Visitor pattern.booleanGet the allocation tags of the constraint.intGet the maximum cardinality of the constraint.intGet the minimum cardinality of the constraint.getScope()Get the scope of the constraint.inthashCode()toString()Methods inherited from class org.apache.hadoop.yarn.api.resource.PlacementConstraint.AbstractConstraint
build
-
Constructor Details
-
CardinalityConstraint
-
-
Method Details
-
getScope
Get the scope of the constraint.- Returns:
- the scope of the constraint
-
getMinCardinality
public int getMinCardinality()Get the minimum cardinality of the constraint.- Returns:
- the minimum cardinality of the constraint
-
getMaxCardinality
public int getMaxCardinality()Get the maximum cardinality of the constraint.- Returns:
- the maximum cardinality of the constraint
-
getAllocationTags
Get the allocation tags of the constraint.- Returns:
- the allocation tags of the constraint
-
accept
Description copied from interface:PlacementConstraint.VisitableVisitor pattern.- Type Parameters:
T- defines the type that the visitor will use and the return type of the accept.- Parameters:
visitor- visitor to be used- Returns:
- the result of visiting a given object.
-
equals
-
hashCode
public int hashCode() -
toString
- Overrides:
toStringin classPlacementConstraint.AbstractConstraint
-