public Iterator<Number> valueIterator() { if (isPoint()) return Collections.singletonList(getUpper()).iterator(); else throw new IllegalStateException(); } }
public Iterator<Number> valueIterator() { if (isPoint()) return Collections.singletonList(getUpper()).iterator(); else throw new IllegalStateException(); } }
@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; }
public List<ContinuousRealInterval> union(final ContinuousRealInterval other) { switch (compare(other)) { case CONTAINS: case EQUALS: case FINISHED_BY: case STARTED_BY: return Collections.singletonList(this); case DURING: case FINISHES: case STARTS: return Collections.singletonList(other); case MEETS: return Collections.singletonList(new ContinuousRealInterval(getLower(), other.getUpper(), inclusiveLower(), other.inclusiveUpper())); case MET_BY: return Collections.singletonList(new ContinuousRealInterval(other.getLower(), getUpper(), other.inclusiveLower(), inclusiveUpper())); case OVERLAPPED_BY: return Collections.singletonList(new ContinuousRealInterval(other.getLower(), getUpper(), other.inclusiveLower(), inclusiveUpper())); case OVERLAPS: return Collections.singletonList(new ContinuousRealInterval(getLower(), other.getUpper(), inclusiveLower(), other.inclusiveUpper())); case PRECEDED_BY: case PRECEDES: return Arrays.asList(this, other); default: throw new IllegalStateException(); } }
/** * 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()); }
public List<ContinuousRealInterval> union(final ContinuousRealInterval other) { switch (compare(other)) { case CONTAINS: case EQUALS: case FINISHED_BY: case STARTED_BY: return Collections.singletonList(this); case DURING: case FINISHES: case STARTS: return Collections.singletonList(other); case MEETS: return Collections.singletonList(new ContinuousRealInterval(getLower(), other.getUpper(), inclusiveLower(), other.inclusiveUpper())); case MET_BY: return Collections.singletonList(new ContinuousRealInterval(other.getLower(), getUpper(), other.inclusiveLower(), inclusiveUpper())); case OVERLAPPED_BY: return Collections.singletonList(new ContinuousRealInterval(other.getLower(), getUpper(), other.inclusiveLower(), inclusiveUpper())); case OVERLAPS: return Collections.singletonList(new ContinuousRealInterval(getLower(), other.getUpper(), inclusiveLower(), other.inclusiveUpper())); case PRECEDED_BY: case PRECEDES: return Arrays.asList(this, other); default: throw new IllegalStateException(); } }
private static int compareUpperUpper(final ContinuousRealInterval a, final ContinuousRealInterval b) { int uu; if (!a.boundUpper()) { if (!b.boundUpper()) uu = 0; else uu = 1; } else if (!b.boundUpper()) uu = -1; else { uu = OWLRealUtils.compare(a.getUpper(), b.getUpper()); if (uu == 0) if (a.inclusiveUpper()) { if (!b.inclusiveUpper()) uu = 1; } else if (b.inclusiveUpper()) uu = -1; } return uu; }
private static int compareUpperUpper(final ContinuousRealInterval a, final ContinuousRealInterval b) { int uu; if (!a.boundUpper()) { if (!b.boundUpper()) uu = 0; else uu = 1; } else if (!b.boundUpper()) uu = -1; else { uu = OWLRealUtils.compare(a.getUpper(), b.getUpper()); if (uu == 0) if (a.inclusiveUpper()) { if (!b.inclusiveUpper()) uu = 1; } else if (b.inclusiveUpper()) uu = -1; } return uu; }
/** * 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 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); }
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()); }
final Number cu = continuousRestriction.getUpper(); if (OWLRealUtils.isInteger(cu))
final Number cu = continuousRestriction.getUpper(); if (OWLRealUtils.isInteger(cu))