/** Add a single element to the set. An isolated element is stored * as a range el..el. */ @Override public void add(int el) { add(el,el); }
/** Add a single element to the set. An isolated element is stored * as a range el..el. */ public void add(int el) { add(el,el); }
/** Add a single element to the set. An isolated element is stored * as a range el..el. */ public void add(int el) { add(el,el); }
/** Add a single element to the set. An isolated element is stored * as a range el..el. */ @Override public void add(int el) { add(el,el); }
/** Create a set with all ints within range [a..b] (inclusive) */ public static IntervalSet of(int a, int b) { IntervalSet s = new IntervalSet(); s.add(a,b); return s; }
/** Add interval; i.e., add all integers from a to b to set. * If b<a, do nothing. * Keep list in sorted order (by left range value). * If overlap, combine ranges. For example, * If this is {1..5, 10..20}, adding 6..7 yields * {1..5, 6..7, 10..20}. Adding 4..8 yields {1..8, 10..20}. */ public void add(int a, int b) { add(Interval.create(a,b)); }
public void addAll(IntSet set) { if ( set==null ) { return; } if ( !(set instanceof IntervalSet) ) { throw new IllegalArgumentException("can't add non IntSet ("+ set.getClass().getName()+ ") to IntervalSet"); } IntervalSet other = (IntervalSet)set; // walk set and add each interval int n = other.intervals.size(); for (int i = 0; i < n; i++) { Interval I = (Interval) other.intervals.get(i); this.add(I.a,I.b); } }
/** Create a set with all ints within range [a..b] (inclusive) */ public static IntervalSet of(int a, int b) { IntervalSet s = new IntervalSet(); s.add(a,b); return s; }
/** Create a set with all ints within range [a..b] (inclusive) */ public static IntervalSet of(int a, int b) { IntervalSet s = new IntervalSet(); s.add(a,b); return s; }
/** Create a set with all ints within range [a..b] (inclusive) */ public static IntervalSet of(int a, int b) { IntervalSet s = new IntervalSet(); s.add(a,b); return s; }
@Override public void addAll(IntSet set) { if ( set==null ) { return; } if ( !(set instanceof IntervalSet) ) { throw new IllegalArgumentException("can't add non IntSet ("+ set.getClass().getName()+ ") to IntervalSet"); } IntervalSet other = (IntervalSet)set; // walk set and add each interval int n = other.intervals.size(); for (int i = 0; i < n; i++) { Interval I = other.intervals.get(i); this.add(I.a,I.b); } }
/** Create a set with a single element, el. */ public static IntervalSet of(int a) { IntervalSet s = new IntervalSet(); s.add(a); return s; }
/** Create a set with a single element, el. */ public static IntervalSet of(int a) { IntervalSet s = new IntervalSet(); s.add(a); return s; }
/** Add interval; i.e., add all integers from a to b to set. * If b<a, do nothing. * Keep list in sorted order (by left range value). * If overlap, combine ranges. For example, * If this is {1..5, 10..20}, adding 6..7 yields * {1..5, 6..7, 10..20}. Adding 4..8 yields {1..8, 10..20}. */ public void add(int a, int b) { add(Interval.create(a,b)); }
/** Add interval; i.e., add all integers from a to b to set. * If b<a, do nothing. * Keep list in sorted order (by left range value). * If overlap, combine ranges. For example, * If this is {1..5, 10..20}, adding 6..7 yields * {1..5, 6..7, 10..20}. Adding 4..8 yields {1..8, 10..20}. */ public void add(int a, int b) { add(Interval.create(a,b)); }
/** Create a set with a single element, el. */ public static IntervalSet of(int a) { IntervalSet s = new IntervalSet(); s.add(a); return s; }
@Override public void addAll(IntSet set) { if ( set==null ) { return; } if ( !(set instanceof IntervalSet) ) { throw new IllegalArgumentException("can't add non IntSet ("+ set.getClass().getName()+ ") to IntervalSet"); } IntervalSet other = (IntervalSet)set; // walk set and add each interval int n = other.intervals.size(); for (int i = 0; i < n; i++) { Interval I = other.intervals.get(i); this.add(I.a,I.b); } }
public void addAll(IntSet set) { if ( set==null ) { return; } if ( !(set instanceof IntervalSet) ) { throw new IllegalArgumentException("can't add non IntSet ("+ set.getClass().getName()+ ") to IntervalSet"); } IntervalSet other = (IntervalSet)set; // walk set and add each interval int n = other.intervals.size(); for (int i = 0; i < n; i++) { Interval I = (Interval) other.intervals.get(i); this.add(I.a,I.b); } }
/** Create a set with a single element, el. */ public static IntervalSet of(int a) { IntervalSet s = new IntervalSet(); s.add(a); return s; }
/** Add interval; i.e., add all integers from a to b to set. * If b<a, do nothing. * Keep list in sorted order (by left range value). * If overlap, combine ranges. For example, * If this is {1..5, 10..20}, adding 6..7 yields * {1..5, 6..7, 10..20}. Adding 4..8 yields {1..8, 10..20}. */ public void add(int a, int b) { add(Interval.create(a,b)); }