private static int compareUpperLower(final OWLRealInterval a, final OWLRealInterval b) { int ul; if (!a.boundUpper()) ul = 1; else if (!b.boundLower()) ul = 1; else ul = OWLRealUtils.compare(a.getUpper(), b.getLower()); return ul; }
@Override public ATermAppl getCanonicalRepresentation(final ATermAppl input) throws InvalidLiteralException { return _range.getDatatype().getCanonicalRepresentation(input); }
@Override public Datatype<?> getPrimitiveDatatype() { return _range.getDatatype().getPrimitiveDatatype(); }
/** * 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()); }
@Override public String toString() { return format("%s%s,%s%s%s", inclusiveLower() ? "[" : "(", boundLower() ? getLower() : "-Inf", boundUpper() ? getUpper() : "+Inf", inclusiveUpper() ? "]" : ")", _type.equals(LineType.CONTINUOUS) ? "" : _type.equals(LineType.INTEGER_ONLY) ? "{int}" : "{noint}"); }
public RestrictedRealDatatype(final Datatype<? extends Number> datatype, final OWLRealInterval interval) { _datatype = datatype; _empty = new EmptyRestrictedDatatype<>(datatype); _intervals = Collections.singletonList(interval); _finite = interval.isFinite(); _enumerable = interval.isPoint() || interval.getType().equals(OWLRealInterval.LineType.INTEGER_ONLY); }
@Override public boolean containsAtLeast(final int n) { if (n <= 0) return true; Number sum = _containsNaN ? 1 : 0; for (final FloatingPointInterval<T> i : _intervals) { sum = OWLRealUtils.integerSum(sum, i.size()); if (OWLRealUtils.compare(sum, n) >= 0) return true; } return false; }
@Override public boolean containsAtLeast(final int n) { if (!_finite || n <= 0) return true; Number sum = 0; for (final OWLRealInterval i : _intervals) { sum = OWLRealUtils.integerSum(sum, i.size()); if (OWLRealUtils.compare(n, sum) <= 0) return true; } return false; }
public static <U extends Number & Comparable<U>> FloatingPointInterval<U> unconstrained(final FloatingPointType<U> type) { return new FloatingPointInterval<>(type, type.getNegativeInfinity(), type.getPositiveInfinity()); }
public RestrictedFloatingPointDatatype(final Datatype<? extends T> datatype, final FloatingPointType<T> type) { this._datatype = datatype; this._type = type; this._empty = new EmptyRestrictedDatatype<>(datatype); this._intervals = Collections.singletonList(FloatingPointInterval.unconstrained(type)); this._containsNaN = true; }
@Override public Number intervalSize(final Float lower, final Float upper) { return FloatingPointUtils.intervalSize(lower, upper); }
@Override public Double increment(final Double n) { return FloatingPointUtils.increment(n); }
@Override public Datatype<?> getPrimitiveDatatype() { return XSDDecimal.getInstance(); }
private static int compareUpperLower(final OWLRealInterval a, final OWLRealInterval 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 RestrictedRealDatatype(final Datatype<? extends Number> datatype, final OWLRealInterval interval) { _datatype = datatype; _empty = new EmptyRestrictedDatatype<>(datatype); _intervals = Collections.singletonList(interval); _finite = interval.isFinite(); _enumerable = interval.isPoint() || interval.getType().equals(OWLRealInterval.LineType.INTEGER_ONLY); }
@Override public boolean containsAtLeast(final int n) { if (n <= 0) return true; Number sum = _containsNaN ? 1 : 0; for (final FloatingPointInterval<T> i : _intervals) { sum = OWLRealUtils.integerSum(sum, i.size()); if (OWLRealUtils.compare(sum, n) >= 0) return true; } return false; }
@Override public boolean containsAtLeast(final int n) { if (!_finite || n <= 0) return true; Number sum = 0; for (final OWLRealInterval i : _intervals) { sum = OWLRealUtils.integerSum(sum, i.size()); if (OWLRealUtils.compare(n, sum) <= 0) return true; } return false; }
public static <U extends Number & Comparable<U>> FloatingPointInterval<U> unconstrained(final FloatingPointType<U> type) { return new FloatingPointInterval<>(type, type.getNegativeInfinity(), type.getPositiveInfinity()); }
@Override public ATermAppl getCanonicalRepresentation(final ATermAppl input) throws InvalidLiteralException { return _range.getDatatype().getCanonicalRepresentation(input); }
@Override public Datatype<?> getPrimitiveDatatype() { return _range.getDatatype().getPrimitiveDatatype(); }