Package org.apache.tools.ant.types
Class TimeComparison
java.lang.Object
org.apache.tools.ant.types.EnumeratedAttribute
org.apache.tools.ant.types.TimeComparison
- Direct Known Subclasses:
- DateSelector.TimeComparisons
EnumeratedAttribute for time comparisons.  Accepts values
 "before", "after", "equal".
- Since:
- Ant 1.7
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final TimeComparisonAfter Comparison.static final TimeComparisonBefore Comparison.static final TimeComparisonEqual Comparison.Fields inherited from class org.apache.tools.ant.types.EnumeratedAttributevalue
- 
Constructor SummaryConstructorsConstructorDescriptionDefault constructor.TimeComparison(String value) Construct a new TimeComparison with the specified value.
- 
Method SummaryModifier and TypeMethodDescriptionstatic intcompare(long t1, long t2) Compare two times.static intcompare(long t1, long t2, long g) Compare two times.booleanevaluate(long t1, long t2) Evaluate two times against this TimeComparison.booleanevaluate(long t1, long t2, long g) Evaluate two times against this TimeComparison.String[]Return the possible values.Methods inherited from class org.apache.tools.ant.types.EnumeratedAttributecontainsValue, getIndex, getInstance, getValue, indexOfValue, setValue, toString
- 
Field Details- 
BEFOREBefore Comparison.
- 
AFTERAfter Comparison.
- 
EQUALEqual Comparison.
 
- 
- 
Constructor Details- 
TimeComparisonpublic TimeComparison()Default constructor.
- 
TimeComparisonConstruct a new TimeComparison with the specified value.- Parameters:
- value- the EnumeratedAttribute value.
 
 
- 
- 
Method Details- 
getValuesReturn the possible values.- Specified by:
- getValuesin class- EnumeratedAttribute
- Returns:
- String[] of EnumeratedAttribute values.
 
- 
evaluatepublic boolean evaluate(long t1, long t2) Evaluate two times against this TimeComparison.- Parameters:
- t1- the first time to compare.
- t2- the second time to compare.
- Returns:
- true if the comparison result fell within the parameters of this TimeComparison.
 
- 
evaluatepublic boolean evaluate(long t1, long t2, long g) Evaluate two times against this TimeComparison.- Parameters:
- t1- the first time to compare.
- t2- the second time to compare.
- g- the timestamp granularity.
- Returns:
- true if the comparison result fell within the parameters of this TimeComparison.
 
- 
comparepublic static int compare(long t1, long t2) Compare two times.- Parameters:
- t1- the first time to compare.
- t2- the second time to compare.
- Returns:
- a negative integer, a positive integer, or zero as t1 is before, after, or equal to t2 accounting for the default granularity.
 
- 
comparepublic static int compare(long t1, long t2, long g) Compare two times.- Parameters:
- t1- the first time to compare.
- t2- the second time to compare.
- g- the timestamp granularity.
- Returns:
- a negative integer, a positive integer, or zero as t1 is before, after, or equal to t2 accounting for the specified granularity.
 
 
-