private static int compareLowerLower(final ContinuousRealInterval a, final ContinuousRealInterval other) { int ll; if (!a.boundLower()) { if (!other.boundLower()) ll = 0; else ll = -1; } else if (!other.boundLower()) ll = 1; else { ll = OWLRealUtils.compare(a.getLower(), other.getLower()); if (ll == 0) if (a.inclusiveLower()) { if (!other.inclusiveLower()) ll = -1; } else if (other.inclusiveLower()) ll = 1; } return ll; }
private static int compareLowerLower(final ContinuousRealInterval a, final ContinuousRealInterval other) { int ll; if (!a.boundLower()) { if (!other.boundLower()) ll = 0; else ll = -1; } else if (!other.boundLower()) ll = 1; else { ll = OWLRealUtils.compare(a.getLower(), other.getLower()); if (ll == 0) if (a.inclusiveLower()) { if (!other.inclusiveLower()) ll = -1; } else if (other.inclusiveLower()) ll = 1; } return ll; }
@Override public String toString() { return format("%s%s,%s%s", inclusiveLower() ? "[" : "(", boundLower() ? getLower() : "-Inf", boundUpper() ? getUpper() : "+Inf", inclusiveUpper() ? "]" : ")"); }
@Override public String toString() { return format("%s%s,%s%s", inclusiveLower() ? "[" : "(", boundLower() ? getLower() : "-Inf", boundUpper() ? getUpper() : "+Inf", inclusiveUpper() ? "]" : ")"); }
private static int compareUpperLower(final ContinuousRealInterval a, final ContinuousRealInterval b) { int ul; if (!a.boundUpper()) ul = 1; else if (!b.boundLower()) ul = 1; else ul = OWLRealUtils.compare(a.getUpper(), b.getLower()); return ul; }
private static int compareUpperLower(final ContinuousRealInterval a, final ContinuousRealInterval b) { int ul; if (!a.boundUpper()) ul = 1; else if (!b.boundLower()) ul = 1; else ul = OWLRealUtils.compare(a.getUpper(), b.getLower()); return ul; }
/** * Get the subinterval less than n * * @param n * @return a new interval, formed by intersecting this interval with (-inf,n) or <code>null</code> if that intersection is empty */ public ContinuousRealInterval less(final Number n) { if (boundUpper() && OWLRealUtils.compare(n, getUpper()) > 0) return this; else if (boundLower() && OWLRealUtils.compare(n, getLower()) <= 0) return null; return new ContinuousRealInterval(getLower(), n, inclusiveLower(), false); }
public boolean contains(final Number n) { int comp; if (boundLower()) { comp = OWLRealUtils.compare(getLower(), n); if (comp > 0) return false; if (comp == 0 && !inclusiveLower()) return false; } if (boundUpper()) { comp = OWLRealUtils.compare(getUpper(), n); if (comp < 0) return false; if (comp == 0 && !inclusiveUpper()) return false; } return true; }
public boolean contains(final Number n) { int comp; if (boundLower()) { comp = OWLRealUtils.compare(getLower(), n); if (comp > 0) return false; if (comp == 0 && !inclusiveLower()) return false; } if (boundUpper()) { comp = OWLRealUtils.compare(getUpper(), n); if (comp < 0) return false; if (comp == 0 && !inclusiveUpper()) return false; } return true; }
/** * Get the subinterval greater than n * * @param n * @return a new interval, formed by intersecting this interval with (n,+inf) or <code>null</code> if that intersection is empty */ public ContinuousRealInterval greater(final Number n) { if (boundLower() && OWLRealUtils.compare(n, getLower()) < 0) return this; else if (boundUpper() && OWLRealUtils.compare(n, getUpper()) >= 0) return null; return new ContinuousRealInterval(n, getUpper(), false, inclusiveUpper()); }
/** * Get the subinterval greater than n * * @param n * @return a new interval, formed by intersecting this interval with (n,+inf) or <code>null</code> if that intersection is empty */ public ContinuousRealInterval greater(final Number n) { if (boundLower() && OWLRealUtils.compare(n, getLower()) < 0) return this; else if (boundUpper() && OWLRealUtils.compare(n, getUpper()) >= 0) return null; return new ContinuousRealInterval(n, getUpper(), false, inclusiveUpper()); }
/** * Get the subinterval less than n * * @param n * @return a new interval, formed by intersecting this interval with (-inf,n) or <code>null</code> if that intersection is empty */ public ContinuousRealInterval less(final Number n) { if (boundUpper() && OWLRealUtils.compare(n, getUpper()) > 0) return this; else if (boundLower() && OWLRealUtils.compare(n, getLower()) <= 0) return null; return new ContinuousRealInterval(getLower(), n, inclusiveLower(), false); }
@Test public void unboundContainsAll() { final ContinuousRealInterval interval = new ContinuousRealInterval(null, null, false, false); assertFalse(interval.boundLower()); assertFalse(interval.boundUpper()); assertFalse(interval.isPoint()); assertTrue(interval.contains(-1)); assertTrue(interval.contains(0)); assertTrue(interval.contains(1)); assertTrue(interval.contains(BigDecimal.valueOf(-0.31d))); assertTrue(interval.contains(BigDecimal.valueOf(0.13d))); assertTrue(interval.contains(BigDecimal.valueOf(Long.MAX_VALUE).add(BigDecimal.valueOf(Long.MAX_VALUE)).add(BigDecimal.valueOf(0.123d)))); }
private static ContinuousRealInterval zoneShrink(final ContinuousRealInterval i) { final Number lower = i.boundLower() ? OWLRealUtils.sum(i.getLower(), TZ_SHIFT) : null; final Number upper = i.boundUpper() ? OWLRealUtils.sum(i.getUpper(), -TZ_SHIFT) : null; if (lower != null && upper != null) { final int cmp = OWLRealUtils.compare(lower, upper); if (cmp > 0) return null; else if (cmp == 0) if (!i.inclusiveLower() && !i.inclusiveUpper()) return null; else return new ContinuousRealInterval(lower); } return new ContinuousRealInterval(lower, upper, i.inclusiveLower(), i.inclusiveUpper()); }
private static ContinuousRealInterval zoneShrink(final ContinuousRealInterval i) { final Number lower = i.boundLower() ? OWLRealUtils.sum(i.getLower(), TZ_SHIFT) : null; final Number upper = i.boundUpper() ? OWLRealUtils.sum(i.getUpper(), -TZ_SHIFT) : null; if (lower != null && upper != null) { final int cmp = OWLRealUtils.compare(lower, upper); if (cmp > 0) return null; else if (cmp == 0) if (!i.inclusiveLower() && !i.inclusiveUpper()) return null; else return new ContinuousRealInterval(lower); } return new ContinuousRealInterval(lower, upper, i.inclusiveLower(), i.inclusiveUpper()); }
if (continuousRestriction.boundLower())
if (continuousRestriction.boundLower())