public static OWLRealInterval interval(final Integer l, final Integer u, final boolean il, final boolean iu, final OWLRealInterval.LineType t) { return new OWLRealInterval(l, u, il, iu, t); }
private XSDLong() { name = ATermUtils.makeTermAppl(Namespaces.XSD + "long"); hashCode = name.hashCode(); final OWLRealInterval i = new OWLRealInterval(Long.MIN_VALUE, Long.MAX_VALUE, true, true, OWLRealInterval.LineType.INTEGER_ONLY); dataRange = new RestrictedRealDatatype(this, i); }
private XSDLong() { name = ATermUtils.makeTermAppl(Namespaces.XSD + "long"); hashCode = name.hashCode(); final OWLRealInterval i = new OWLRealInterval(Long.MIN_VALUE, Long.MAX_VALUE, true, true, OWLRealInterval.LineType.INTEGER_ONLY); dataRange = new RestrictedRealDatatype(this, i); }
public static OWLRealInterval interval(final Double l, final Double u, final boolean il, final boolean iu, final OWLRealInterval.LineType t) { return new OWLRealInterval(l == null ? null : BigDecimal.valueOf(l), u == null ? null : BigDecimal.valueOf(u), il, iu, t); }
throw new IllegalStateException(); final OWLRealInterval restriction = new OWLRealInterval(lower, upper, inclusiveLower, inclusiveUpper, OWLRealInterval.LineType.CONTINUOUS);
throw new IllegalStateException(); final OWLRealInterval restriction = new OWLRealInterval(lower, upper, inclusiveLower, inclusiveUpper, OWLRealInterval.LineType.CONTINUOUS);
before = new OWLRealInterval(getLower(), other.getLower(), inclusiveLower(), !other.inclusiveLower(), t1); if (t1.equals(t2) || LineType.CONTINUOUS.equals(t2)) during = null; else during = new OWLRealInterval(other.getLower(), other.getUpper(), false, false, LineType.INTEGER_EXCLUDED.equals(t2) ? LineType.INTEGER_ONLY : LineType.INTEGER_EXCLUDED); after = new OWLRealInterval(other.getUpper(), getUpper(), !other.inclusiveUpper(), inclusiveUpper(), t1); break; during = null; else during = new OWLRealInterval(getLower(), getUpper(), false, false, LineType.INTEGER_EXCLUDED.equals(t2) ? LineType.INTEGER_ONLY : LineType.INTEGER_EXCLUDED); after = null; break; before = new OWLRealInterval(getLower(), other.getLower(), inclusiveLower(), !other.inclusiveLower(), t1); if (t1.equals(t2) || LineType.CONTINUOUS.equals(t2)) during = null; else during = new OWLRealInterval(other.getLower(), getUpper(), false, false, LineType.INTEGER_EXCLUDED.equals(t2) ? LineType.INTEGER_ONLY : LineType.INTEGER_EXCLUDED); after = null; break; before = new OWLRealInterval(getLower(), getUpper(), inclusiveLower(), false, t1); during = null; after = null; before = null; during = null; after = new OWLRealInterval(getLower(), getUpper(), false, inclusiveUpper(), t1);
before = new OWLRealInterval(getLower(), other.getLower(), inclusiveLower(), !other.inclusiveLower(), t1); if (t1.equals(t2) || LineType.CONTINUOUS.equals(t2)) during = null; else during = new OWLRealInterval(other.getLower(), other.getUpper(), false, false, LineType.INTEGER_EXCLUDED.equals(t2) ? LineType.INTEGER_ONLY : LineType.INTEGER_EXCLUDED); after = new OWLRealInterval(other.getUpper(), getUpper(), !other.inclusiveUpper(), inclusiveUpper(), t1); break; during = null; else during = new OWLRealInterval(getLower(), getUpper(), false, false, LineType.INTEGER_EXCLUDED.equals(t2) ? LineType.INTEGER_ONLY : LineType.INTEGER_EXCLUDED); after = null; break; before = new OWLRealInterval(getLower(), other.getLower(), inclusiveLower(), !other.inclusiveLower(), t1); if (t1.equals(t2) || LineType.CONTINUOUS.equals(t2)) during = null; else during = new OWLRealInterval(other.getLower(), getUpper(), false, false, LineType.INTEGER_EXCLUDED.equals(t2) ? LineType.INTEGER_ONLY : LineType.INTEGER_EXCLUDED); after = null; break; before = new OWLRealInterval(getLower(), getUpper(), inclusiveLower(), false, t1); during = null; after = null; before = null; during = null; after = new OWLRealInterval(getLower(), getUpper(), false, inclusiveUpper(), t1);
before = new OWLRealInterval(getLower(), other.getLower(), inclusiveLower(), !other.inclusiveLower(), t1); if (LineType.CONTINUOUS.equals(t2)) during = other; else during = new OWLRealInterval(other.getLower(), other.getUpper(), other.inclusiveLower(), other.inclusiveUpper(), LineType.CONTINUOUS); after = new OWLRealInterval(other.getUpper(), getUpper(), !other.inclusiveUpper(), inclusiveUpper(), t1); break; before = new OWLRealInterval(other.getLower(), getLower(), other.inclusiveLower(), !inclusiveLower(), t2); if (LineType.CONTINUOUS.equals(t1)) during = this; else during = new OWLRealInterval(getLower(), getUpper(), inclusiveLower(), inclusiveUpper(), LineType.CONTINUOUS); after = new OWLRealInterval(getUpper(), other.getUpper(), !inclusiveUpper(), other.inclusiveUpper(), t2); break; during = new OWLRealInterval(getLower(), getUpper(), inclusiveLower(), inclusiveUpper(), LineType.CONTINUOUS); after = null; break; before = new OWLRealInterval(getLower(), other.getLower(), inclusiveLower(), !other.inclusiveLower(), t1); if (LineType.CONTINUOUS.equals(t2)) during = other; else during = new OWLRealInterval(other.getLower(), getUpper(), other.inclusiveLower(), inclusiveUpper(), LineType.CONTINUOUS); after = null; break; before = new OWLRealInterval(other.getLower(), getLower(), other.inclusiveLower(), !inclusiveLower(), t2);
before = new OWLRealInterval(getLower(), other.getLower(), inclusiveLower(), !other.inclusiveLower(), t1); if (LineType.CONTINUOUS.equals(t2)) during = other; else during = new OWLRealInterval(other.getLower(), other.getUpper(), other.inclusiveLower(), other.inclusiveUpper(), LineType.CONTINUOUS); after = new OWLRealInterval(other.getUpper(), getUpper(), !other.inclusiveUpper(), inclusiveUpper(), t1); break; before = new OWLRealInterval(other.getLower(), getLower(), other.inclusiveLower(), !inclusiveLower(), t2); if (LineType.CONTINUOUS.equals(t1)) during = this; else during = new OWLRealInterval(getLower(), getUpper(), inclusiveLower(), inclusiveUpper(), LineType.CONTINUOUS); after = new OWLRealInterval(getUpper(), other.getUpper(), !inclusiveUpper(), other.inclusiveUpper(), t2); break; during = new OWLRealInterval(getLower(), getUpper(), inclusiveLower(), inclusiveUpper(), LineType.CONTINUOUS); after = null; break; before = new OWLRealInterval(getLower(), other.getLower(), inclusiveLower(), !other.inclusiveLower(), t1); if (LineType.CONTINUOUS.equals(t2)) during = other; else during = new OWLRealInterval(other.getLower(), getUpper(), other.inclusiveLower(), inclusiveUpper(), LineType.CONTINUOUS); after = null; break; before = new OWLRealInterval(other.getLower(), getLower(), other.inclusiveLower(), !inclusiveLower(), t2);
/** * 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 OWLRealInterval 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 OWLRealInterval(getLower(), n, inclusiveLower(), false, getType()); }
/** * 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 OWLRealInterval 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 OWLRealInterval(getLower(), n, inclusiveLower(), false, getType()); }
/** * 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 OWLRealInterval 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 OWLRealInterval(n, getUpper(), false, inclusiveUpper(), getType()); }
/** * 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 OWLRealInterval 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 OWLRealInterval(n, getUpper(), false, inclusiveUpper(), getType()); }
/** * Verify that a continuous interval with equal bounds is a point. */ @Test public void isPointTrueCon() { final OWLRealInterval a = new OWLRealInterval(BigDecimal.valueOf(0.1d)); assertTrue(a.isPoint()); final OWLRealInterval b = interval(0.1, 0.1, true, true, LineType.CONTINUOUS); assertTrue(b.isPoint()); assertEquals(a, b); }
@Test public void unboundContainsAll() { final OWLRealInterval interval = new OWLRealInterval(null, null, false, false, LineType.CONTINUOUS); 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)))); }
/** * Verify that two continuous intervals overlapping just on an inclusive bound intersect to a point. */ @Test public void intersectionPointCon() { final OWLRealInterval a = interval(null, 2.1, false, true, LineType.CONTINUOUS); final OWLRealInterval b = interval(2.1, null, true, false, LineType.CONTINUOUS); final OWLRealInterval expected = new OWLRealInterval(BigDecimal.valueOf(2.1d)); assertEquals(expected, a.intersection(b)); assertEquals(expected, b.intersection(a)); assertTrue(a.intersection(b).isPoint()); assertTrue(b.intersection(a).isPoint()); assertTrue(a.intersection(b).contains(BigDecimal.valueOf(2.1d))); assertTrue(b.intersection(a).contains(BigDecimal.valueOf(2.1d))); assertEquals(IntervalRelations.OVERLAPS, a.compare(b)); assertEquals(IntervalRelations.OVERLAPPED_BY, b.compare(a)); }
/** * Verify that two integer intervals overlapping just on an inclusive bound intersect to a point. */ @Test public void intersectionPointOnly() { final OWLRealInterval a = interval(null, 2, false, true, LineType.INTEGER_ONLY); final OWLRealInterval b = interval(2, null, true, false, LineType.INTEGER_ONLY); final OWLRealInterval expected = new OWLRealInterval(Integer.valueOf(2)); assertEquals(expected, a.intersection(b)); assertEquals(expected, b.intersection(a)); assertTrue(a.intersection(b).isPoint()); assertTrue(b.intersection(a).isPoint()); assertTrue(a.intersection(b).contains(Integer.valueOf(2))); assertTrue(b.intersection(a).contains(Integer.valueOf(2))); assertEquals(IntervalRelations.OVERLAPS, a.compare(b)); assertEquals(IntervalRelations.OVERLAPPED_BY, b.compare(a)); }
return null; return new OWLRealInterval(lower, upper, inclusiveLower, inclusiveUpper, intersectionType);
return null; return new OWLRealInterval(lower, upper, inclusiveLower, inclusiveUpper, intersectionType);