Example usage for org.apache.commons.lang.math FloatRange equals

List of usage examples for org.apache.commons.lang.math FloatRange equals

Introduction

In this page you can find the example usage for org.apache.commons.lang.math FloatRange equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Compares this range to another object to test if they are equal.

.

Usage

From source file:au.org.ala.delta.model.DiffUtils.java

private static boolean doCompareRange(FloatRange attr1Range, FloatRange attr2Range, boolean attr1Unknown,
        boolean attr2Unknown, boolean attr1Inapplicable, boolean attr2Inapplicable, boolean matchUnknowns,
        boolean matchInapplicables, MatchType matchType) {

    // If both attributes are unknown or inapplicable this is considered a
    // match. Otherwise, the return value depends on setting for
    // matchInapplicable or matchUnknown.
    if ((attr1Unknown || attr1Inapplicable) && (attr2Unknown || attr2Inapplicable)) {
        return true;
    }//  www  .  j av a  2  s .c om

    if ((attr1Unknown && attr1Inapplicable) || (attr2Unknown && attr2Inapplicable)) {
        return matchInapplicables;
    }

    if ((attr1Unknown && !attr1Inapplicable) || (attr2Unknown && !attr2Inapplicable)) {
        return matchUnknowns;
    }

    boolean match = false;

    switch (matchType) {
    case EXACT:
        match = attr1Range.equals(attr2Range);
        break;
    case SUBSET:
        // is the first a subset of the second
        match = attr2Range.containsRange(attr1Range);
        break;
    case OVERLAP:
        match = attr1Range.overlapsRange(attr2Range);
        break;
    default:
        throw new RuntimeException(String.format("Unrecognized match type %s", matchType.toString()));
    }

    return match;
}