projects
/
sbp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add a second parameter argument to Invokable (two params now)
[sbp.git]
/
src
/
edu
/
berkeley
/
sbp
/
util
/
Range.java
diff --git
a/src/edu/berkeley/sbp/util/Range.java
b/src/edu/berkeley/sbp/util/Range.java
index
399d2bb
..
b803480
100644
(file)
--- a/
src/edu/berkeley/sbp/util/Range.java
+++ b/
src/edu/berkeley/sbp/util/Range.java
@@
-35,12
+35,13
@@
package edu.berkeley.sbp.util;
import java.util.*;
import java.text.*;
package edu.berkeley.sbp.util;
import java.util.*;
import java.text.*;
+import java.io.*;
/**
* This class represents a range of integers (incuding positive and negative
* infinity).
*/
/**
* This class represents a range of integers (incuding positive and negative
* infinity).
*/
-public class Range {
+public class Range implements Serializable {
private boolean negInf, posInf;
private long min,max;
private boolean negInf, posInf;
private long min,max;
@@
-269,7
+270,7
@@
public class Range {
*
* @author Justin F. Chapweske
*/
*
* @author Justin F. Chapweske
*/
- public static class Set implements Iterable<Range> {
+ public static class Set implements Iterable<Range>, Serializable {
public static final int DEFAULT_CAPACITY = 16;
public static final int DEFAULT_CAPACITY = 16;
@@
-298,6
+299,11
@@
public class Range {
for(Range r : ranges) add(r);
}
for(Range r : ranges) add(r);
}
+ public Set(Iterable<Range> it) {
+ this();
+ for(Range r : it) add(r);
+ }
+
/**
* @param rs The set with which to union with this set.
* @return A new set that represents the union of this and the passed set.
/**
* @param rs The set with which to union with this set.
* @return A new set that represents the union of this and the passed set.
@@
-548,6
+554,12
@@
public class Range {
return result;
}
return result;
}
+ public boolean containsAll(Range.Set rs) {
+ for(Range r : rs)
+ if (!contains(r)) return false;
+ return true;
+ }
+
public boolean equals(Object obj) {
if (obj instanceof Range.Set) {
Range.Set rs = (Range.Set) obj;
public boolean equals(Object obj) {
if (obj instanceof Range.Set) {
Range.Set rs = (Range.Set) obj;