|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.fest.util.AbstractComparisonStrategy
org.fest.util.ComparatorBasedComparisonStrategy
public class ComparatorBasedComparisonStrategy
Implements ComparisonStrategy contract with a comparison strategy based on a Comparator.
| Constructor Summary | |
|---|---|
ComparatorBasedComparisonStrategy(Comparator comparator)
Creates a new ComparatorBasedComparisonStrategy specifying the comparison strategy with given
comparator. |
|
| Method Summary | |
|---|---|
boolean |
areEqual(Object actual,
Object other)
Returns true if actual and other are equal according to comparator, false otherwise. |
Iterable<?> |
duplicatesFrom(Iterable<?> iterable)
Returns any duplicate elements from the given Iterable according to comparator. |
Comparator<?> |
getComparator()
|
boolean |
isGreaterThan(Object actual,
Object other)
Returns true if actual is greater than other, false otherwise. |
boolean |
iterableContains(Iterable<?> iterable,
Object value)
Returns true if given Iterable contains given value according to comparator, false otherwise. |
void |
iterableRemoves(Iterable<?> iterable,
Object value)
Look for given value in given Iterable according to the Comparator, if value is found it is removed
from it. |
boolean |
stringContains(String string,
String sequence)
Returns true if given string contains given sequence according to the implemented comparison strategy, false otherwise. |
boolean |
stringEndsWith(String string,
String suffix)
Returns true if sstring ends with suffix according to the implemented comparison strategy, false otherwise. |
boolean |
stringStartsWith(String string,
String prefix)
Returns true if string starts with prefix according to the implemented comparison strategy, false otherwise. |
String |
toString()
|
| Methods inherited from class org.fest.util.AbstractComparisonStrategy |
|---|
arrayContains, isGreaterThanOrEqualTo, isLessThan, isLessThanOrEqualTo |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ComparatorBasedComparisonStrategy(Comparator comparator)
ComparatorBasedComparisonStrategy specifying the comparison strategy with given
comparator.
comparator - the comparison strategy to use.| Method Detail |
|---|
public boolean iterableContains(Iterable<?> iterable,
Object value)
Iterable contains given value according to comparator, false otherwise.Iterable is null or empty, return false.
iterable - the Iterable to search value invalue - the object to look for in given Iterable
Iterable contains given value according to comparator, false otherwise.
public void iterableRemoves(Iterable<?> iterable,
Object value)
Iterable according to the Comparator, if value is found it is removed
from it.Iterable is null (meaning no exception thrown).
iterable - the Iterable we want remove value fromvalue - object to remove from given Iterable
public boolean areEqual(Object actual,
Object other)
comparator, false otherwise.comparator does not have too.
actual - the object to compare to otherother - the object to compare to actual
comparator, false otherwise.public Iterable<?> duplicatesFrom(Iterable<?> iterable)
Iterable according to comparator.
duplicatesFrom in interface ComparisonStrategyduplicatesFrom in class AbstractComparisonStrategyiterable - the given Iterable we want to extract duplicate elements.
Iterable containing the duplicate elements of the given one. If no duplicates are found, an
empty Iterable is returned.public String toString()
toString in class Objectpublic Comparator<?> getComparator()
public boolean stringStartsWith(String string,
String prefix)
ComparisonStrategy
string - the String we want to look starting prefixprefix - the prefix String to look for at string's start
public boolean stringEndsWith(String string,
String suffix)
ComparisonStrategy
string - the String we want to look starting suffixsuffix - the suffix String to look for at string's end
public boolean stringContains(String string,
String sequence)
ComparisonStrategy
string - the string to search sequence in (must not be null)sequence - the String to look for in given string
public boolean isGreaterThan(Object actual,
Object other)
ComparisonStrategy
actual - the object to compare to otherother - the object to compare to actual
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||