All Implemented Interfaces:
Cloneable, ResourceSelector

public class Compare extends DataType implements ResourceSelector
ResourceSelector that compares against "control" Resource(s) using ResourceComparators.
Since:
Ant 1.7
  • Constructor Details

    • Compare

      public Compare()
  • Method Details

    • add

      public void add(ResourceComparator c)
      Add a ResourceComparator to this Compare selector. If multiple ResourceComparators are added, they will be processed in LIFO order.
      Parameters:
      c - the ResourceComparator to add.
    • setAgainst

      public void setAgainst(Quantifier against)
      Set the quantifier to be used. Default "all".
      Parameters:
      against - the Quantifier EnumeratedAttribute to use.
    • setWhen

      public void setWhen(Comparison when)
      Set the comparison to be used. Default "equal".
      Parameters:
      when - the Comparison EnumeratedAttribute to use.
    • createControl

      public ResourceCollection createControl()
      Create the nested control element. These are the resources to compare against.
      Returns:
      ResourceCollection.
    • isSelected

      public boolean isSelected(Resource r)
      Return true if this Resource is selected.
      Specified by:
      isSelected in interface ResourceSelector
      Parameters:
      r - the Resource to check.
      Returns:
      whether the Resource was selected.
    • dieOnCircularReference

      protected void dieOnCircularReference(Stack<Object> stk, Project p) throws BuildException
      Overrides the version from DataType to recurse on nested ResourceComparators.
      Overrides:
      dieOnCircularReference in class DataType
      Parameters:
      stk - the stack of data types to use (recursively).
      p - the project to use to dereference the references.
      Throws:
      BuildException - on error.