public LineType intersect(final LineType other) { if (other == null) throw new NullPointerException(); switch (this) { case CONTINUOUS: return other; case INTEGER_ONLY: if (other.equals(INTEGER_EXCLUDED)) return null; else return INTEGER_ONLY; case INTEGER_EXCLUDED: if (other.equals(INTEGER_ONLY)) return null; else return INTEGER_EXCLUDED; default: throw new IllegalArgumentException(); } } }
public LineType intersect(final LineType other) { if (other == null) throw new NullPointerException(); switch (this) { case CONTINUOUS: return other; case INTEGER_ONLY: if (other.equals(INTEGER_EXCLUDED)) return null; else return INTEGER_ONLY; case INTEGER_EXCLUDED: if (other.equals(INTEGER_ONLY)) return null; else return INTEGER_EXCLUDED; default: throw new IllegalArgumentException(); } } }
if (!_type.equals(other._type)) return false; if (_upper == null)
if (LineType.CONTINUOUS.equals(t1) || t1.equals(t2)) return Collections.singletonList(this); if (LineType.CONTINUOUS.equals(t2)) during = other; else if (LineType.CONTINUOUS.equals(t2) || t1.equals(t2)) return Collections.singletonList(other); if (LineType.CONTINUOUS.equals(t1)) during = this; else if (LineType.CONTINUOUS.equals(t1) || t1.equals(t2)) return Collections.singletonList(this); if (LineType.CONTINUOUS.equals(t2)) return Collections.singletonList(other); if (LineType.CONTINUOUS.equals(t1) || t1.equals(t2)) return Collections.singletonList(this); if (LineType.CONTINUOUS.equals(t2)) during = other; else if (LineType.CONTINUOUS.equals(t2) || t1.equals(t2)) return Collections.singletonList(other);
case STARTED_BY: if (intersectionType.equals(that._type)) return that; if (intersectionType.equals(_type)) return this; if (intersectionType.equals(_type)) return that; case STARTS: if (intersectionType.equals(_type)) return this; if (LineType.INTEGER_ONLY.equals(intersectionType)) if (LineType.INTEGER_EXCLUDED.equals(intersectionType)) if (lower != null && upper != null && lower.equals(upper) && OWLRealUtils.isInteger(lower)) return null;
case STARTED_BY: if (intersectionType.equals(that._type)) return that; if (intersectionType.equals(_type)) return this; if (intersectionType.equals(_type)) return that; case STARTS: if (intersectionType.equals(_type)) return this; if (LineType.INTEGER_ONLY.equals(intersectionType)) if (LineType.INTEGER_EXCLUDED.equals(intersectionType)) if (lower != null && upper != null && lower.equals(upper) && OWLRealUtils.isInteger(lower)) return null;
if (LineType.INTEGER_ONLY.equals(t1)) if (LineType.INTEGER_EXCLUDED.equals(t2)) return Collections.singletonList(this); if (LineType.INTEGER_EXCLUDED.equals(t1)) if (LineType.INTEGER_ONLY.equals(t2)) return Collections.singletonList(this); 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; case STARTS: before = null; if (t1.equals(t2) || LineType.CONTINUOUS.equals(t2)) during = null; else during = new OWLRealInterval(getLower(), getUpper(), false, false, LineType.INTEGER_EXCLUDED.equals(t2) ? LineType.INTEGER_ONLY : LineType.INTEGER_EXCLUDED); after = null; break; 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);
if (LineType.INTEGER_ONLY.equals(t1)) if (LineType.INTEGER_EXCLUDED.equals(t2)) return Collections.singletonList(this); if (LineType.INTEGER_EXCLUDED.equals(t1)) if (LineType.INTEGER_ONLY.equals(t2)) return Collections.singletonList(this); 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; case STARTS: before = null; if (t1.equals(t2) || LineType.CONTINUOUS.equals(t2)) during = null; else during = new OWLRealInterval(getLower(), getUpper(), false, false, LineType.INTEGER_EXCLUDED.equals(t2) ? LineType.INTEGER_ONLY : LineType.INTEGER_EXCLUDED); after = null; break; 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);
if (!_type.equals(other._type)) return false; if (_upper == null)
if (!i.isPoint() && !i.getType().equals(OWLRealInterval.LineType.INTEGER_ONLY))
if (!i.isPoint() && !i.getType().equals(OWLRealInterval.LineType.INTEGER_ONLY))
return Collections.singletonList(getUpper()).iterator(); else if (LineType.INTEGER_ONLY.equals(getType()))
public boolean contains(final Number n) { if (_type.equals(LineType.INTEGER_ONLY)) { if (!isInteger(n)) return false; } else if (_type.equals(LineType.INTEGER_EXCLUDED)) if (isInteger(n)) return false; 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; }
return Collections.singletonList(getUpper()).iterator(); else if (LineType.INTEGER_ONLY.equals(getType()))
public boolean contains(final Number n) { if (_type.equals(LineType.INTEGER_ONLY)) { if (!isInteger(n)) return false; } else if (_type.equals(LineType.INTEGER_EXCLUDED)) if (isInteger(n)) return false; 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; }
@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); }
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 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}"); }