add Serializable to util classes
[sbp.git] / src / edu / berkeley / sbp / util / Range.java
index 714cd83..b803480 100644 (file)
 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).
  */
-public class Range {
+public class Range implements Serializable {
 
     private boolean negInf, posInf;
     private long min,max;
@@ -269,7 +270,7 @@ public class Range {
      *
      * @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;
     
@@ -553,6 +554,12 @@ public class Range {
             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;