Nice/src/mlsub/typing/lowlevel BitMatrix.java,1.10,1.11 BitVector.java,1.12,1.13 Domain.java,1.6,1.7 DomainVector.java,1.5,1.6 K0.java,1.27,1.28 Satisfier.java,1.3,1.4

Arjan Boeijink <[email protected]> Wed, 30 Mar 2005 23:08:19 +0000
Newsgroups gmane.comp.lang.nice.cvs
Message-ID <[email protected]>
Update of /cvsroot/nice/Nice/src/mlsub/typing/lowlevel
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23840/F:/nice/src/mlsub/typing/lowlevel

Modified Files:
	BitMatrix.java BitVector.java Domain.java DomainVector.java 
	K0.java Satisfier.java 
Log Message:
Copy-constructor for BitVector.

Index: Domain.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/mlsub/typing/lowlevel/Domain.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Domain.java	29 Mar 2005 22:51:57 -0000	1.6
--- Domain.java	30 Mar 2005 23:08:16 -0000	1.7
***************
*** 32,35 ****
--- 32,45 ----
    }
  
+   /**
+    * Creates a copy of a Domain.
+    **/
+   public Domain(Domain old) {
+     super(old);
+     this.containsUnit = old.containsUnit;
+     this.cardUp = old.cardUp;
+     this.cardDown = old.cardDown;
+   }
+ 
    // size of this domain (possibly including unit)
    int cardinal() {
***************
*** 224,239 ****
    }
  
-   public Domain cloneDomain() {
-     Domain result = new Domain(0);
-     this.copyTo(result);
-     return result;
-   }
- 
-   private void copyTo(Domain result) {
-     super.copyTo(result);
- 
-     result.containsUnit = containsUnit;
-     result.cardUp = cardUp;
-     result.cardDown = cardDown;
-   }
  }
--- 234,236 ----

Index: DomainVector.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/mlsub/typing/lowlevel/DomainVector.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** DomainVector.java	29 Mar 2005 22:51:57 -0000	1.5
--- DomainVector.java	30 Mar 2005 23:08:16 -0000	1.6
***************
*** 98,102 ****
        Domain d = ((Domain)elementData[i]);
        if (d != null) {
!         result.elementData[i] = d.cloneDomain();
        }
      }
--- 98,102 ----
        Domain d = ((Domain)elementData[i]);
        if (d != null) {
!         result.elementData[i] = new Domain(d);
        }
      }

Index: Satisfier.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/mlsub/typing/lowlevel/Satisfier.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Satisfier.java	29 Mar 2005 22:51:57 -0000	1.3
--- Satisfier.java	30 Mar 2005 23:08:17 -0000	1.4
***************
*** 45,49 ****
        }
      }
!     Domain dx = domains.getDomain(x).cloneDomain();
      for (int a = dx.getLowestSetBit();
           a >= 0;
--- 45,49 ----
        }
      }
!     Domain dx = new Domain(domains.getDomain(x));
      for (int a = dx.getLowestSetBit();
           a >= 0;
***************
*** 89,93 ****
        throw LowlevelUnsatisfiable.instance;
      }
!     Domain dx = domains.getDomain(x).cloneDomain();
      // iterate through the elements of dx
      for (int a = dx.getLowestSetBit();
--- 89,93 ----
        throw LowlevelUnsatisfiable.instance;
      }
!     Domain dx = new Domain(domains.getDomain(x));
      // iterate through the elements of dx
      for (int a = dx.getLowestSetBit();

Index: BitVector.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/mlsub/typing/lowlevel/BitVector.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** BitVector.java	30 Mar 2005 18:02:41 -0000	1.12
--- BitVector.java	30 Mar 2005 23:08:11 -0000	1.13
***************
*** 83,86 ****
--- 83,105 ----
  
    /**
+    * Creates a copy of a BitVector.
+    */
+   public BitVector(BitVector old) {
+     if (old.bits1 == null)
+       {
+         this.bits0 = old.bits0;
+         this.bits1 = null;
+       }
+     else
+       {
+         this.bits0 = 0L;
+ 	// optim: shrink to nonZeroLength()?
+ 	int n = old.bits1.length;
+ 	this.bits1 = new long[n];
+ 	System.arraycopy(old.bits1, 0, this.bits1, 0, n);
+       }
+   }
+ 
+   /**
     * Ensures that the BitVector can hold at least an nth bit.
     * This cannot leave the bits array at length 0.
***************
*** 522,548 ****
    }
  
- 
- 
-   /**
-    * Clones the BitVector.
-    */
-   public BitVector cloneVector() {
-     BitVector result = new BitVector();
-     this.copyTo(result);
-     return result;
-   }
- 
-   public void copyTo(BitVector result) {
-     if (bits1 == null)
-       result.bits0 = bits0;
-     else
-       {
- 	// optim: shrink to nonZeroLength()?
- 	int n = length();
- 	result.bits1 = new long[n];
- 	System.arraycopy(bits1, 0, result.bits1, 0, n);
-       }
-   }
- 
    /**
     * Converts the BitVector to a String.
--- 541,544 ----
***************
*** 794,800 ****
     **/
    public boolean isEmpty() {
!     int n = length();
      for (int i = 0; i < n; i++) {
!       if (getW(i) != 0L) {
          return false;
        }
--- 790,799 ----
     **/
    public boolean isEmpty() {
!     if (bits1 == null)
!       return bits0 == 0L;
! 
!     int n = bits1.length;
      for (int i = 0; i < n; i++) {
!       if (bits1[i] != 0L) {
          return false;
        }

Index: K0.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/mlsub/typing/lowlevel/K0.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** K0.java	30 Mar 2005 21:24:02 -0000	1.27
--- K0.java	30 Mar 2005 23:08:16 -0000	1.28
***************
*** 1272,1276 ****
      for (int iid = 0; iid < nInterfaces(); iid++) {
        BitVector I_impls = getInterface(iid).implementors;
!       rigidImplementors[iid] = I_impls.cloneVector();
        for (int x = I_impls.getLowestSetBit();
             x != BitVector.UNDEFINED_INDEX;
--- 1272,1276 ----
      for (int iid = 0; iid < nInterfaces(); iid++) {
        BitVector I_impls = getInterface(iid).implementors;
!       rigidImplementors[iid] = new BitVector(I_impls);
        for (int x = I_impls.getLowestSetBit();
             x != BitVector.UNDEFINED_INDEX;
***************
*** 1358,1362 ****
          this.savedC = new BitMatrix(K0.this.C);
  
!       this.savedGarbage = K0.this.garbage.cloneVector();
        this.savedDomains = (DomainVector)K0.this.domains.clone();
        /*
--- 1358,1362 ----
          this.savedC = new BitMatrix(K0.this.C);
  
!       this.savedGarbage = new BitVector(K0.this.garbage);
        this.savedDomains = (DomainVector)K0.this.domains.clone();
        /*

Index: BitMatrix.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/mlsub/typing/lowlevel/BitMatrix.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** BitMatrix.java	30 Mar 2005 21:23:58 -0000	1.10
--- BitMatrix.java	30 Mar 2005 23:07:58 -0000	1.11
***************
*** 44,48 ****
          BitVector row = oldRows[i];
          if (row != null && !row.isEmpty())
!           newRows[i] = row.cloneVector();
        }
  
--- 44,48 ----
          BitVector row = oldRows[i];
          if (row != null && !row.isEmpty())
!           newRows[i] = new BitVector(row);
        }
  
***************
*** 304,308 ****
  			cyclicmask.set(index[tempsp]);
  		      } while (index[tempsp--] != nextbitpos);
! 		      current = current.cloneVector();
  		      current.andNot(cyclicmask);
  		      bitpos[stackpos] = 0;
--- 304,308 ----
  			cyclicmask.set(index[tempsp]);
  		      } while (index[tempsp--] != nextbitpos);
! 		      current = new BitVector(current);
  		      current.andNot(cyclicmask);
  		      bitpos[stackpos] = 0;



-------------------------------------------------------
This SF.net email is sponsored by Demarc:
A global provider of Threat Management Solutions.
Download our HomeAdmin security software for free today!
http://www.demarc.com/Info/Sentarus/hamr30