ConditionBase (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.taskdefs.condition, class: ConditionBase

# Class ConditionBase

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.taskdefs.condition.ConditionBase

All Implemented Interfaces:
  `Cloneable`

Direct Known Subclasses:
  `And, ConditionTask, Not, Or, WaitFor, Xor`

public abstract class ConditionBase extends ProjectComponent
Baseclass for the <condition> task as well as several conditions - ensures that the types of conditions inside the task and the "container" conditions are in sync.

Since:
  Ant 1.4

- ## Field Summary

  ### Fields inherited from class ProjectComponent

  `description, location, project`
  Modifier and Type
  Field
  Description
  `protected String`
  `description`
  Deprecated.
  since 1.6.x.
  `protected Location`
  `location`
  Deprecated.
  since 1.6.x.
  `protected Project`
  `project`
  Deprecated.
  since 1.6.x.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `ConditionBase()`
  Simple constructor.
  `protected`
  `ConditionBase(String taskName)`
  Constructor that takes the name of the task in the task name.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `add(Condition c)`
  Add an arbitrary condition
  `void`
  `addAnd(And a)`
  Add an <and> condition "container".
  `void`
  `addAvailable(Available a)`
  Add an <available> condition.
  `void`
  `addChecksum(Checksum c)`
  Add an <checksum> condition.
  `void`
  `addContains(Contains test)`
  Add a <contains> condition.
  `void`
  `addEquals(Equals e)`
  Add an <equals> condition.
  `void`
  `addFilesMatch(FilesMatch test)`
  Add a <filesmatch> condition.
  `void`
  `addHttp(Http h)`
  Add an <http> condition.
  `void`
  `addIsFalse(IsFalse test)`
  Add a <isfalse> condition.
  `void`
  `addIsFileSelected(IsFileSelected test)`
  Add an <isfileselected> condition.
  `void`
  `addIsReference(IsReference i)`
  Add an <isreference> condition.
  `void`
  `addIsSet(IsSet i)`
  Add an <isset> condition.
  `void`
  `addIsTrue(IsTrue test)`
  Add a <istrue> condition.
  `void`
  `addNot(Not n)`
  Add an <not> condition "container".
  `void`
  `addOr(Or o)`
  Add an <or> condition "container".
  `void`
  `addOs(Os o)`
  Add an <os> condition.
  `void`
  `addSocket(Socket s)`
  Add a <socket> condition.
  `void`
  `addUptodate(UpToDate u)`
  Add an <uptodate> condition.
  `protected int`
  `countConditions()`
  Count the conditions.
  `protected final Enumeration<Condition>`
  `getConditions()`
  Iterate through all conditions.
  `String`
  `getTaskName()`
  Returns the name to use in logging messages.
  `void`
  `setTaskName(String name)`
  Sets the name to use in logging messages.

  ### Methods inherited from class ProjectComponent

  `clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject`
  Modifier and Type
  Method
  Description
  `Object`
  `clone()`
  `String`
  `getDescription()`
  Returns the description of the current action.
  `Location`
  `getLocation()`
  Returns the file/location where this task was defined.
  `Project`
  `getProject()`
  Returns the project to which this component belongs.
  `void`
  `log(String msg)`
  Logs a message with the default (INFO) priority.
  `void`
  `log(String msg, int msgLevel)`
  Logs a message with the given priority.
  `void`
  `setDescription(String desc)`
  Sets a description of the current action.
  `void`
  `setLocation(Location location)`
  Sets the file/location where this task was defined.
  `void`
  `setProject(Project project)`
  Sets the project object of this component.

  ### Methods inherited from class Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ConditionBase

    protected ConditionBase()
    Simple constructor.

  - ### ConditionBase

    protected ConditionBase(String taskName)
    Constructor that takes the name of the task in the task name.
    Parameters:
      `taskName` - the name of the task.
    Since:
      Ant 1.7

- ## Method Details

  - ### countConditions

    protected int countConditions()
    Count the conditions.
    Returns:
      the number of conditions in the container
    Since:
      1.1

  - ### getConditions

    protected final Enumeration<Condition> getConditions()
    Iterate through all conditions.
    Returns:
      an enumeration to use for iteration
    Since:
      1.1

  - ### setTaskName

    public void setTaskName(String name)
    Sets the name to use in logging messages.
    Parameters:
      `name` - The name to use in logging messages. Should not be `null`.
    Since:
      Ant 1.7

  - ### getTaskName

    public String getTaskName()
    Returns the name to use in logging messages.
    Returns:
      the name to use in logging messages.
    Since:
      Ant 1.7

  - ### addAvailable

    public void addAvailable(Available a)
    Add an <available> condition.
    Parameters:
      `a` - an available condition
    Since:
      1.1

  - ### addChecksum

    public void addChecksum(Checksum c)
    Add an <checksum> condition.
    Parameters:
      `c` - a Checksum condition
    Since:
      1.4, Ant 1.5

  - ### addUptodate

    public void addUptodate(UpToDate u)
    Add an <uptodate> condition.
    Parameters:
      `u` - an UpToDate condition
    Since:
      1.1

  - ### addNot

    public void addNot(Not n)
    Add an <not> condition "container".
    Parameters:
      `n` - a Not condition
    Since:
      1.1

  - ### addAnd

    public void addAnd(And a)
    Add an <and> condition "container".
    Parameters:
      `a` - an And condition
    Since:
      1.1

  - ### addOr

    public void addOr(Or o)
    Add an <or> condition "container".
    Parameters:
      `o` - an Or condition
    Since:
      1.1

  - ### addEquals

    public void addEquals(Equals e)
    Add an <equals> condition.
    Parameters:
      `e` - an Equals condition
    Since:
      1.1

  - ### addOs

    public void addOs(Os o)
    Add an <os> condition.
    Parameters:
      `o` - an Os condition
    Since:
      1.1

  - ### addIsSet

    public void addIsSet(IsSet i)
    Add an <isset> condition.
    Parameters:
      `i` - an IsSet condition
    Since:
      Ant 1.5

  - ### addHttp

    public void addHttp(Http h)
    Add an <http> condition.
    Parameters:
      `h` - an Http condition
    Since:
      Ant 1.5

  - ### addSocket

    public void addSocket(Socket s)
    Add a <socket> condition.
    Parameters:
      `s` - a Socket condition
    Since:
      Ant 1.5

  - ### addFilesMatch

    public void addFilesMatch(FilesMatch test)
    Add a <filesmatch> condition.
    Parameters:
      `test` - a FilesMatch condition
    Since:
      Ant 1.5

  - ### addContains

    public void addContains(Contains test)
    Add a <contains> condition.
    Parameters:
      `test` - a Contains condition
    Since:
      Ant 1.5

  - ### addIsTrue

    public void addIsTrue(IsTrue test)
    Add a <istrue> condition.
    Parameters:
      `test` - an IsTrue condition
    Since:
      Ant 1.5

  - ### addIsFalse

    public void addIsFalse(IsFalse test)
    Add a <isfalse> condition.
    Parameters:
      `test` - an IsFalse condition
    Since:
      Ant 1.5

  - ### addIsReference

    public void addIsReference(IsReference i)
    Add an <isreference> condition.
    Parameters:
      `i` - an IsReference condition
    Since:
      Ant 1.6

  - ### addIsFileSelected

    public void addIsFileSelected(IsFileSelected test)
    Add an <isfileselected> condition.
    Parameters:
      `test` - the condition

  - ### add

    public void add(Condition c)
    Add an arbitrary condition
    Parameters:
      `c` - a condition
    Since:
      Ant 1.6