private static boolean isBetween(Range range) { return !range.getLow().isLowerUnbounded() && range.getLow().getBound() == Marker.Bound.EXACTLY && !range.getHigh().isUpperUnbounded() && range.getHigh().getBound() == Marker.Bound.EXACTLY; }
public Domain subtract(Domain other) { checkCompatibility(other); return new Domain(values.subtract(other.getValues()), this.isNullAllowed() && !other.isNullAllowed()); }
public Domain intersect(Domain other) { checkCompatibility(other); return new Domain(values.intersect(other.getValues()), this.isNullAllowed() && other.isNullAllowed()); }
public Domain union(Domain other) { checkCompatibility(other); return new Domain(values.union(other.getValues()), this.isNullAllowed() || other.isNullAllowed()); }
@Override public SortedRangeSet union(Collection<ValueSet> valueSets) { Builder builder = new Builder(type); builder.addAll(this.getOrderedRanges()); for (ValueSet valueSet : valueSets) { builder.addAll(checkCompatibility(valueSet).getOrderedRanges()); } return builder.build(); }
public static Range range(Type type, Object low, boolean lowInclusive, Object high, boolean highInclusive) { Marker lowMarker = lowInclusive ? Marker.exactly(type, low) : Marker.above(type, low); Marker highMarker = highInclusive ? Marker.exactly(type, high) : Marker.below(type, high); return new Range(lowMarker, highMarker); }
public Domain complement() { return new Domain(values.complement(), !nullAllowed); }
public static Range greaterThanOrEqual(Type type, Object low) { return new Range(Marker.exactly(type, low), Marker.upperUnbounded(type)); }
public static Range lessThan(Type type, Object high) { return new Range(Marker.lowerUnbounded(type), Marker.below(type, high)); }
@Override public boolean containsValue(Object value) { return includesMarker(Marker.exactly(type, value)); }
public static ValueEntry create(Type type, Object value) { return new ValueEntry(type, Utils.nativeValueToBlock(type, value)); }
@Override public SortedRangeSet union(ValueSet other) { SortedRangeSet otherRangeSet = checkCompatibility(other); return new Builder(type) .addAll(this.getOrderedRanges()) .addAll(otherRangeSet.getOrderedRanges()) .build(); }