Java 类org.apache.commons.collections4.Equator 实例源码

项目:HCFCore    文件:EqualPredicate.java   
/**
 * Factory to create the identity predicate.
 *
 * @param <T> the type that the predicate queries
 * @param object  the object to compare to
 * @param equator  the equator to use for comparison
 * @return the predicate
 * @since 4.0
 */
public static <T> Predicate<T> equalPredicate(final T object, final Equator<T> equator) {
    if (object == null) {
        return NullPredicate.nullPredicate();
    }
    return new EqualPredicate<T>(object, equator);
}
项目:HCFCore    文件:SequencesComparator.java   
/**
 * Simple constructor.
 * <p>
 * Creates a new instance of SequencesComparator with a custom {@link Equator}.
 * <p>
 * It is <em>guaranteed</em> that the comparisons will always be done as
 * <code>Equator.equate(o1, o2)</code> where <code>o1</code> belongs to the first
 * sequence and <code>o2</code> belongs to the second sequence.
 *
 * @param sequence1  first sequence to be compared
 * @param sequence2  second sequence to be compared
 * @param equator  the equator to use for testing object equality
 */
public SequencesComparator(final List<T> sequence1, final List<T> sequence2, final Equator<? super T> equator) {
    this.sequence1 = sequence1;
    this.sequence2 = sequence2;
    this.equator = equator;

    final int size = sequence1.size() + sequence2.size() + 2;
    vDown = new int[size];
    vUp   = new int[size];
}
项目:HCFCore    文件:EqualPredicate.java   
/**
 * Factory to create the identity predicate.
 *
 * @param <T> the type that the predicate queries
 * @param object  the object to compare to
 * @param equator  the equator to use for comparison
 * @return the predicate
 * @since 4.0
 */
public static <T> Predicate<T> equalPredicate(final T object, final Equator<T> equator) {
    if (object == null) {
        return NullPredicate.nullPredicate();
    }
    return new EqualPredicate<T>(object, equator);
}
项目:HCFCore    文件:SequencesComparator.java   
/**
 * Simple constructor.
 * <p>
 * Creates a new instance of SequencesComparator with a custom {@link Equator}.
 * <p>
 * It is <em>guaranteed</em> that the comparisons will always be done as
 * <code>Equator.equate(o1, o2)</code> where <code>o1</code> belongs to the first
 * sequence and <code>o2</code> belongs to the second sequence.
 *
 * @param sequence1  first sequence to be compared
 * @param sequence2  second sequence to be compared
 * @param equator  the equator to use for testing object equality
 */
public SequencesComparator(final List<T> sequence1, final List<T> sequence2, final Equator<? super T> equator) {
    this.sequence1 = sequence1;
    this.sequence2 = sequence2;
    this.equator = equator;

    final int size = sequence1.size() + sequence2.size() + 2;
    vDown = new int[size];
    vUp   = new int[size];
}
项目:HCFCore    文件:EqualPredicate.java   
/**
 * Constructor that performs no validation.
 * Use <code>equalPredicate</code> if you want that.
 *
 * @param object  the object to compare to
 * @param equator  the equator to use for comparison
 * @since 4.0
 */
public EqualPredicate(final T object, final Equator<T> equator) {
    super();
    iValue = object;
    this.equator = equator;
}
项目:HCFCore    文件:EqualPredicate.java   
/**
 * Constructor that performs no validation.
 * Use <code>equalPredicate</code> if you want that.
 *
 * @param object  the object to compare to
 * @param equator  the equator to use for comparison
 * @since 4.0
 */
public EqualPredicate(final T object, final Equator<T> equator) {
    super();
    iValue = object;
    this.equator = equator;
}