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 Details

    • CardinalityConstraint

      public CardinalityConstraint(String scope, int minCardinality, int maxCardinality, Set<String> allocationTags)
  • Method Details

    • getScope

      public String 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

      public Set<String> getAllocationTags()
      Get the allocation tags of the constraint.
      Returns:
      the allocation tags of the constraint
    • accept

      public <T> T accept(PlacementConstraint.Visitor<T> visitor)
      Description copied from interface: PlacementConstraint.Visitable
      Visitor 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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class PlacementConstraint.AbstractConstraint