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; }
@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() ? "]" : ")"); }
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(); } }
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(); } }
inclusiveLower = that.inclusiveLower(); upper = that.getUpper(); inclusiveUpper = that.inclusiveUpper(); break; inclusiveLower = inclusiveLower(); upper = getUpper(); inclusiveUpper = inclusiveUpper(); break; inclusiveLower = inclusiveLower(); upper = getUpper(); inclusiveUpper = inclusiveUpper(); break; inclusiveLower = that.inclusiveLower(); upper = that.getUpper(); inclusiveUpper = inclusiveUpper() && that.inclusiveUpper(); break; inclusiveLower = inclusiveLower(); upper = getUpper(); inclusiveUpper = inclusiveUpper() && that.inclusiveUpper(); break; inclusiveLower = inclusiveLower(); upper = that.getUpper(); inclusiveUpper = that.inclusiveUpper(); break;
inclusiveLower = that.inclusiveLower(); upper = that.getUpper(); inclusiveUpper = that.inclusiveUpper(); break; inclusiveLower = inclusiveLower(); upper = getUpper(); inclusiveUpper = inclusiveUpper(); break; inclusiveLower = inclusiveLower(); upper = getUpper(); inclusiveUpper = inclusiveUpper(); break; inclusiveLower = that.inclusiveLower(); upper = that.getUpper(); inclusiveUpper = inclusiveUpper() && that.inclusiveUpper(); break; inclusiveLower = inclusiveLower(); upper = getUpper(); inclusiveUpper = inclusiveUpper() && that.inclusiveUpper(); break; inclusiveLower = inclusiveLower(); upper = that.getUpper(); inclusiveUpper = that.inclusiveUpper(); break;
after = new ContinuousRealInterval(other.getUpper(), getUpper(), !other.inclusiveUpper(), inclusiveUpper()); break; after = new ContinuousRealInterval(getLower(), getUpper(), false, inclusiveUpper()); break; case STARTED_BY: before = null; after = new ContinuousRealInterval(other.getUpper(), getUpper(), !other.inclusiveUpper(), inclusiveUpper()); break;
after = new ContinuousRealInterval(other.getUpper(), getUpper(), !other.inclusiveUpper(), inclusiveUpper()); break; after = new ContinuousRealInterval(getLower(), getUpper(), false, inclusiveUpper()); break; case STARTED_BY: before = null; after = new ContinuousRealInterval(other.getUpper(), getUpper(), !other.inclusiveUpper(), inclusiveUpper()); break;
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()); }
/** * 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 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; }
if (ul == 0) if (a.inclusiveUpper()) if (lu == 0) if (b.inclusiveUpper())
if (ul == 0) if (a.inclusiveUpper()) if (lu == 0) if (b.inclusiveUpper())
if (OWLRealUtils.isInteger(cu)) if (continuousRestriction.inclusiveUpper()) upper = cu; else
if (OWLRealUtils.isInteger(cu)) if (continuousRestriction.inclusiveUpper()) upper = cu; else