org.specrunner.comparators.core
Class AbstractComparatorTime

java.lang.Object
  extended by org.specrunner.comparators.core.AbstractComparatorTime
All Implemented Interfaces:
Serializable, Comparator<Object>, IComparator, IResetable
Direct Known Subclasses:
ComparatorDate, ComparatorJodatime

public abstract class AbstractComparatorTime
extends Object
implements IComparator

Abstract comparator of time objects.

Author:
Thiago Santos
See Also:
Serialized Form

Field Summary
static String FEATURE_TOLERANCE
          Feature to set time tolerance.
 
Constructor Summary
AbstractComparatorTime()
           
 
Method Summary
protected  boolean compare(long left, long right)
          Compare the expected and received.
 Long getTolerance()
          Get the time tolerance.
 void initialize()
          Initialize the converter.
 void setTolerance(Long tolerance)
          Set time tolerance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.specrunner.comparators.IComparator
getType, match
 
Methods inherited from interface java.util.Comparator
compare, equals
 

Field Detail

FEATURE_TOLERANCE

public static final String FEATURE_TOLERANCE
Feature to set time tolerance.

Constructor Detail

AbstractComparatorTime

public AbstractComparatorTime()
Method Detail

initialize

public void initialize()
Description copied from interface: IResetable
Initialize the converter.

Specified by:
initialize in interface IResetable

getTolerance

public Long getTolerance()
Get the time tolerance.

Returns:
The time.

setTolerance

public void setTolerance(Long tolerance)
Set time tolerance.

Parameters:
tolerance - The tolerance.

compare

protected boolean compare(long left,
                          long right)
Compare the expected and received.

Parameters:
left - The expected time.
right - The received time.
Returns:
true, if acceptable, false, otherwise.


Copyright © 2014. All rights reserved.