[e-cvs] cvs commit: e/src/jsrc/org/quasiliteral/term Term.updoc

markm@eros.cs.jhu.edu markm@eros.cs.jhu.edu
Sun, 11 Nov 2001 00:54:37 -0500


markm       01/11/11 00:54:37

  Modified:    src/jsrc/org/erights/e/elang/evm EExpr.java NounPattern.java
                        SeqExpr.java
               src/jsrc/org/erights/e/elang/interp ScopeSetup.java
               src/jsrc/org/erights/e/elang/scope Scope.java ScopeMap.java
               src/jsrc/org/erights/e/elang/visitors BindFramesVisitor.java
               src/jsrc/org/erights/e/elib/tables ConstMap.java EList.java
                        EMap.java Equalizer.java FlexMap.java ROMap.java
               src/jsrc/org/quasiliteral/term Term.updoc
  Added:       src/jsrc/org/erights/e/elib/tables ConstSet.java ESet.java
                        FlexSet.java ROSet.java
  Log:
  Switched to our own collection classes.  Added xSet classes so no info would be lost.

Revision  Changes    Path
1.30      +4 -6      e/src/jsrc/org/erights/e/elang/evm/EExpr.java

Index: EExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/EExpr.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- EExpr.java	2001/11/10 19:40:39	1.29
+++ EExpr.java	2001/11/11 05:54:36	1.30
@@ -26,11 +26,10 @@
 import org.erights.e.elang.visitors.SubstVisitor;
 import org.erights.e.elib.eio.TextWriter;
 import org.erights.e.elib.prim.E;
+import org.erights.e.elib.tables.FlexList;
 
 import java.io.IOException;
-import java.util.List;
 
-
 /**
  * Those ParseNodes that--after expansion--define the kernel
  * expressions evaluated by the E Virtual Machine.
@@ -113,8 +112,8 @@
      * argument.
      * @param accum
      */
-    protected void appendTo(List accum) {
-        accum.add(this);
+    protected void appendTo(FlexList accum) {
+        accum.push(this);
     }
 
     /**
@@ -122,10 +121,9 @@
      * @param accum the List to accumulate the results into.
      * @param all the EExprs to accumulate.
      */
-    static protected void appendAllTo(List accum, EExpr[] all) {
+    static protected void appendAllTo(FlexList accum, EExpr[] all) {
         for (int i = 0, max = all.length; i < max; i++) {
             all[i].appendTo(accum);
         }
     }
-
 }



1.4       +2 -2      e/src/jsrc/org/erights/e/elang/evm/NounPattern.java

Index: NounPattern.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/NounPattern.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- NounPattern.java	2001/11/10 23:51:51	1.3
+++ NounPattern.java	2001/11/11 05:54:36	1.4
@@ -25,9 +25,9 @@
 import org.erights.e.elib.ref.Ref;
 import org.erights.e.elib.tables.FlexList;
 import org.erights.e.elib.tables.FlexMap;
+import org.erights.e.elib.tables.ESet;
 
 import java.io.IOException;
-import java.util.Set;
 
 /**
  * BNF: Identifier ':' expr <p>
@@ -61,7 +61,7 @@
      * A set of all the variable names that may not be shadowed (ie,
      * redefined)
      */
-    static public final Set NonShadowable = ScopeSetup.nonShadowable();
+    static public final ESet NonShadowable = ScopeSetup.nonShadowable();
 
     private String myVarName;
 



1.11      +3 -7      e/src/jsrc/org/erights/e/elang/evm/SeqExpr.java

Index: SeqExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/SeqExpr.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- SeqExpr.java	2001/11/10 19:40:39	1.10
+++ SeqExpr.java	2001/11/11 05:54:36	1.11
@@ -26,8 +26,6 @@
 import org.erights.e.elib.tables.FlexList;
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
 
 /**
  * BNF: eExpr "\n" eExpr <p>
@@ -38,17 +36,15 @@
  */
 public class SeqExpr extends EExpr {
 
-    static private final EExpr[] EEXPR_PROTOTYPE = {};
-
     private EExpr[] mySubs;
 
     /**
      *
      */
     public SeqExpr(EExpr[] subs) {
-        List accum = new ArrayList(subs.length);
+        FlexList accum = FlexList.fromType(EExpr.class, subs.length);
         appendAllTo(accum, subs);
-        mySubs = (EExpr[])accum.toArray(EEXPR_PROTOTYPE);
+        mySubs = (EExpr[])accum.getArray();
     }
 
     /**
@@ -139,7 +135,7 @@
     /**
      * Append subs in place of the receiver.
      */
-    protected void appendTo(List accum) {
+    protected void appendTo(FlexList accum) {
         appendAllTo(accum, mySubs);
     }
 }



1.70      +14 -16    e/src/jsrc/org/erights/e/elang/interp/ScopeSetup.java

Index: ScopeSetup.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/interp/ScopeSetup.java,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- ScopeSetup.java	2001/11/10 23:51:51	1.69
+++ ScopeSetup.java	2001/11/11 05:54:36	1.70
@@ -50,13 +50,12 @@
 import org.erights.e.elib.tables.ConstMap;
 import org.erights.e.elib.tables.Equalizer;
 import org.erights.e.elib.tables.Twine;
+import org.erights.e.elib.tables.FlexList;
+import org.erights.e.elib.tables.FlexMap;
+import org.erights.e.elib.tables.ESet;
 import org.erights.e.elib.util.ClassCache;
 import org.erights.e.meta.java.io.FileGetter;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Set;
-
 /**
  * The initial namespace as seen by the E language programmer.
  *
@@ -88,7 +87,7 @@
      * NOTE: these could be cached, but they are actually only used to
      *       set a variable in NounExpr, so the cache is currently unneeded.
      */
-    static public Set nonShadowable() {
+    static public ESet nonShadowable() {
         return universalMaker().keys();
     }
 
@@ -319,27 +318,26 @@
 
         static private final int DEFAULT_SIZE = 50;
 
-        private ArrayList myOuters;
+        private FlexList myOuters;
 
-        private HashMap myBindings;
+        private FlexMap myBindings;
 
         public ScopeMaker() {
-            this(new ArrayList(DEFAULT_SIZE),
-                 new HashMap(DEFAULT_SIZE));
+            this(FlexList.make(DEFAULT_SIZE),
+                 FlexMap.make(DEFAULT_SIZE));
         }
 
-        private ScopeMaker(ArrayList outers, HashMap bindings) {
+        private ScopeMaker(FlexList outers, FlexMap bindings) {
             myOuters = outers;
             myBindings = bindings;
         }
 
         public ScopeMaker copy() {
-            return new ScopeMaker(new ArrayList(myOuters),
-                                  new HashMap(myBindings));
+            return new ScopeMaker(myOuters.diverge(), myBindings.diverge());
         }
 
-        public Set keys() {
-            return myBindings.keySet();
+        public ESet keys() {
+            return myBindings.domain();
         }
 
         public Scope scope() {
@@ -350,7 +348,7 @@
             ScopeMap outerNouns = ScopeMap.make(myBindings);
             int outerCount = myOuters.size();
             int outerSpace = outerCount + OUTER_SPACE;
-            Slot[] outers = (Slot[])myOuters.toArray(new Slot[outerSpace]);
+            Slot[] outers = (Slot[])myOuters.getArray(Slot.class);
             return OuterScope.make(outerNouns, outers, outerCount, isMutable);
         }
 
@@ -378,7 +376,7 @@
 
         private void initSlot(String name, Slot slot) {
             int i = myOuters.size();
-            myOuters.add(slot);
+            myOuters.push(slot);
             myBindings.put(name, new OuterNounExpr(name, i));
         }
     }



1.48      +1 -1      e/src/jsrc/org/erights/e/elang/scope/Scope.java

Index: Scope.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/scope/Scope.java,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- Scope.java	2001/11/10 23:51:51	1.47
+++ Scope.java	2001/11/11 05:54:37	1.48
@@ -136,7 +136,7 @@
         StringWriter buf = new StringWriter();
         final TextWriter os1 = new TextWriter(buf);
         final TextWriter os2 = os1.indent();
-        Object names = myScopeMap.namesSet().toArray(new String[]{});
+        Object names = myScopeMap.namesSet().getElements(String.class);
         ConstList keys = ConstList.fromArray(names).sort();
         for (int i = 0, len = keys.size(); i < len; i++) {
             String key = (String)keys.get(i);



1.4       +17 -15    e/src/jsrc/org/erights/e/elang/scope/ScopeMap.java

Index: ScopeMap.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/scope/ScopeMap.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ScopeMap.java	2001/11/10 23:51:51	1.3
+++ ScopeMap.java	2001/11/11 05:54:37	1.4
@@ -23,20 +23,22 @@
 
 import org.erights.e.elang.evm.NounExpr;
 import org.erights.e.elib.util.AlreadyDefinedException;
+import org.erights.e.elib.tables.ConstMap;
+import org.erights.e.elib.tables.ConstSet;
+import org.erights.e.elib.tables.FlexSet;
+import org.erights.e.elib.tables.EMap;
+import org.erights.e.elib.tables.ESet;
 
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
 /**
  *
  *
  */
 public abstract class ScopeMap {
 
-    static public final ScopeMap EMPTY = new ScopeMapBase(new HashMap());
+    static public final ScopeMap EMPTY =
+      new ScopeMapBase(ConstMap.EmptyMap);
 
-    static public ScopeMap make(Map initial) {
+    static public ScopeMap make(EMap initial) {
         return new ScopeMapBase(initial);
     }
 
@@ -54,7 +56,7 @@
     /*
      * Return the set of all names mapped by the receiver.
      */
-    public abstract Set namesSet();
+    public abstract ESet namesSet();
 
     /*
      * Make a new contour within the receiver.
@@ -94,7 +96,7 @@
         return myNext.contains(name);
     }
 
-    public Set namesSet() {
+    public ESet namesSet() {
         return myNext.namesSet();
     }
 
@@ -144,8 +146,8 @@
         return myName.equals(name) || myNext.contains(name);
     }
 
-    public Set namesSet() {
-        Set res = myNext.namesSet();
+    public ESet namesSet() {
+        FlexSet res = myNext.namesSet().diverge();
         res.add(myName);
         return res;
     }
@@ -161,9 +163,9 @@
 
 class ScopeMapBase extends ScopeMap {
 
-    private final Map myBindings;
+    private final EMap myBindings;
 
-    public ScopeMapBase(Map bindings) {
+    public ScopeMapBase(EMap bindings) {
         myBindings = bindings;
     }
 
@@ -180,11 +182,11 @@
     }
 
     public boolean contains(String name) {
-        return myBindings.containsKey(name);
+        return myBindings.maps(name);
     }
 
-    public Set namesSet() {
-        return myBindings.keySet();
+    public ESet namesSet() {
+        return myBindings.domain();
     }
 
     public void assertShadowable(String name) {



1.4       +9 -9      e/src/jsrc/org/erights/e/elang/visitors/BindFramesVisitor.java

Index: BindFramesVisitor.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/visitors/BindFramesVisitor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BindFramesVisitor.java	2001/11/10 23:51:51	1.3
+++ BindFramesVisitor.java	2001/11/11 05:54:37	1.4
@@ -38,14 +38,14 @@
 import org.erights.e.elang.scope.Scope;
 import org.erights.e.elang.scope.ScopeMap;
 import org.erights.e.elib.tables.ConstMap;
+import org.erights.e.elib.tables.FlexMap;
+import org.erights.e.elib.tables.FlexList;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-
+/**
+ *
+ */
 public abstract class BindFramesVisitor extends CopyVisitor {
 
-    static private final NounExpr[] NOUN_PROTO = {};
-
     protected ScopeMap myBindings;
 
     protected int[] myMaxLocalsCell;
@@ -141,15 +141,15 @@
         // TODO markm can worry about auditors
         StaticScope ss = eScript.staticScope();
         String[] used = (String[])ss.namesUsed().getKeys(String.class);
-        HashMap newBindings = new HashMap(used.length);
-        ArrayList fields = new ArrayList(used.length);
+        FlexMap newBindings = FlexMap.make(used.length);
+        FlexList fields = FlexList.make(used.length);
         for (int i = 0, max = used.length; i < max; i++) {
             NounExpr noun = myBindings.getNoun(used[i]);
             if (noun.isOuter()) {
                 newBindings.put(noun.name(), noun);
             } else {
                 NounExpr newNoun = noun.asFieldAt(fields.size());
-                fields.add(noun);
+                fields.push(noun);
                 newBindings.put(newNoun.name(), newNoun);
             }
         }
@@ -159,7 +159,7 @@
                               optFQN,
                               (NounExpr[])xformEExprs(auditors),
                               nested.xformEScript(eScript),
-                              (NounExpr[])fields.toArray(NOUN_PROTO));
+                              (NounExpr[])fields.getArray(NounExpr.class));
     }
 
     /**



1.27      +7 -0      e/src/jsrc/org/erights/e/elib/tables/ConstMap.java

Index: ConstMap.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/tables/ConstMap.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- ConstMap.java	2001/11/10 19:40:48	1.26
+++ ConstMap.java	2001/11/11 05:54:37	1.27
@@ -100,6 +100,13 @@
     }
 
     /**
+     *
+     */
+    public ESet domain() {
+        return ConstSet.make(this);
+    }
+
+    /**
      * This method enables E's magnitude comparison operators
      * (<, <=, <=>, >=, >) to express subset-ness of the domains of
      * ConstMaps. <p>



1.31      +7 -0      e/src/jsrc/org/erights/e/elib/tables/EList.java

Index: EList.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/tables/EList.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- EList.java	2001/11/10 19:40:48	1.30
+++ EList.java	2001/11/11 05:54:37	1.31
@@ -322,6 +322,13 @@
     }
 
     /**
+     * Returns a set whose elements are the values in this list
+     */
+    public ConstSet asSet() {
+        return ConstSet.make(asKeys());
+    }
+
+    /**
      * Does this list include candidate as a sub-list?
      */
     public boolean includes(EList candidate) {



1.30      +6 -2      e/src/jsrc/org/erights/e/elib/tables/EMap.java

Index: EMap.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/tables/EMap.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- EMap.java	2001/11/10 19:40:48	1.29
+++ EMap.java	2001/11/11 05:54:37	1.30
@@ -76,8 +76,7 @@
     /**
      * Only subclasses within the package
      */
-    /*package*/ EMap() {
-    }
+    /*package*/ EMap() {}
 
     /**
      * Returns a ConstMap whose state is a snapshot of the state of this
@@ -282,6 +281,11 @@
      * Returns a divergent array-of-type of all the keys in order.
      */
     public abstract Object getKeys(Class type);
+
+    /**
+     * Returns a set providing a read-only view of the domain of this map.
+     */
+    public abstract ESet domain();
 
     /**
      * Defaults to an array of valueType()



1.29      +0 -1      e/src/jsrc/org/erights/e/elib/tables/Equalizer.java

Index: Equalizer.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/tables/Equalizer.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- Equalizer.java	2001/11/10 19:40:48	1.28
+++ Equalizer.java	2001/11/11 05:54:37	1.29
@@ -9,7 +9,6 @@
 import java.lang.reflect.Array;
 import java.util.HashMap;
 
-
 /**
  * Implements E's sameness semantics, which should be used only through the
  * Ref class.  <p>



1.28      +8 -2      e/src/jsrc/org/erights/e/elib/tables/FlexMap.java

Index: FlexMap.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/tables/FlexMap.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- FlexMap.java	2001/11/10 19:40:48	1.27
+++ FlexMap.java	2001/11/11 05:54:37	1.28
@@ -38,8 +38,7 @@
     /**
      * Only subclasses within the package
      */
-    /*package*/ FlexMap() {
-    }
+    /*package*/ FlexMap() {}
 
     /**
      *
@@ -53,6 +52,13 @@
      */
     public EMap readOnly() {
         return new ROMap(this);
+    }
+
+    /**
+     *
+     */
+    public ESet domain() {
+        return ROSet.make(this);
     }
 
     /**



1.19      +7 -0      e/src/jsrc/org/erights/e/elib/tables/ROMap.java

Index: ROMap.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/tables/ROMap.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- ROMap.java	2001/11/11 00:15:31	1.18
+++ ROMap.java	2001/11/11 05:54:37	1.19
@@ -65,6 +65,13 @@
     /**
      *
      */
+    public ESet domain() {
+        return ROSet.make(this);
+    }
+
+    /**
+     *
+     */
     public int size() {
         return myPrecious.size();
     }



1.1                  e/src/jsrc/org/erights/e/elib/tables/ConstSet.java

Index: ConstSet.java
===================================================================
package org.erights.e.elib.tables;

import org.erights.e.elib.serial.PassByConstruction;
import org.erights.e.elib.eio.TextWriter;
import org.erights.e.elib.prim.StaticMaker;

import java.io.IOException;

/**
 *
 * @author <a href="mailto:markm@caplet.com">Mark S Miller</a>
 */
public class ConstSet
  extends ESet implements PassByConstruction, Selfless {

    /**
     *
     */
    static public ConstSet EmptySet = new ConstSet(ConstMap.EmptyMap);

    /**
     *
     */
    private ConstSet(ConstMap map) {
        super(map);
    }

    /**
     *
     */
    static public ConstSet make(ConstMap map) {
        return new ConstSet(map);
    }

    /**
     * Uses 'elementsList asSet()', where the elementsList is as returned
     * by getElements.
     */
    public Object[] getCanonicalState() {
        Object[] result = { getElements(), "asSet" };
        return result;
    }

    /**
     *
     */
    public ConstSet snapshot() {
        return this;
    }

    /**
     *
     */
    public ESet readOnly() {
        return this;
    }

    /**
     * Prints as an E list send the message 'asSet()'
     */
    public void printOn(TextWriter out) throws IOException {
        printOn("[", ", ", "] asSet()", out);
    }

    /**
     *
     */
    private ConstMap getMap() {
        return (ConstMap)myMap;
    }

    /**
     * This method enables E's magnitude comparison operators
     * (<, <=, <=>, >=, >) to express subset-ness of these sets.
     * <p>
     * If this set is a strict subset of other's, return -1.0.
     * If this set has the same elements as other, return 0.0.
     * If this set is a strict superset of other, return 1.0.
     * Otherwise return NaN.
     */
    public double compareTo(ConstSet other) {
        return getMap().compareTo(other.getMap());
    }
}



1.1                  e/src/jsrc/org/erights/e/elib/tables/ESet.java

Index: ESet.java
===================================================================
package org.erights.e.elib.tables;

/*
The contents of this file are subject to the Electric Communities E Open
Source Code License Version 1.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of the License
at http://www.communities.com/EL/.

Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
the specific language governing rights and limitations under the License.

The Original Code is the Distributed E Language Implementation, released
July 20, 1998.

The Initial Developer of the Original Code is Electric Communities.
Copyright (C) 1998 Electric Communities. All Rights Reserved.

Contributor(s): ______________________________________.
*/

import org.erights.e.develop.exception.ExceptionMgr;
import org.erights.e.elib.eio.EPrintable;
import org.erights.e.elib.eio.TextWriter;
import org.erights.e.elib.serial.Persistent;
import org.erights.e.elib.util.ArityMismatchException;

import java.io.IOException;
import java.lang.reflect.Array;

/**
 * A wrapper around an EMap, whose set-elements are the keys of the EMap.
 * <p>
 * XXX To be re-rationalized when we deprecate mutable collections.  But
 * introduced for now in order to remove 'Set' and its bretheren from Dean's
 * transformer.
 *
 * @author <a href="mailto:markm@erights.org">Mark S. Miller</a>
 */
public abstract class ESet implements EPrintable, Persistent {

    /**
     *
     */
    /*package*/ EMap myMap;

    /**
     * Only subclasses within the package
     */
    /*package*/ ESet(EMap map) {
        myMap = map;
    }

    /**
     * Returns a ConstSet whose state is a snapshot of the state of this
     * set at the time of the snapshot() request.  A ConstSet returns
     * itself.
     */
    public ConstSet snapshot() {
        return ConstSet.make(myMap.snapshot());
    }

    /**
     * Returns a read-only facet on this set.  Someone holding this facet
     * may see changes, but they cannot cause them.
     */
    public ESet readOnly() {
        return ROSet.make(myMap);
    }

    /**
     * Returns a FlexSet whose initial state is a snapshot of the state of
     * this set at the time of the diverge() request.  Further changes to
     * the original and/or the new set are independent -- they diverge. <p>
     *
     * The new set is constrained to only hold object of type 'type'.
     */
    public FlexSet diverge(Class type) {
        return FlexSet.make(myMap.diverge(type, Void.TYPE));
    }

    /**
     * 'type' default to Object.class
     */
    public FlexSet diverge() {
        return diverge(Object.class);
    }

    /**
     * Is the candidate the same as any of the elements of the set?
     */
    public boolean contains(Object candidate) {
        return myMap.maps(candidate);
    }

    /**
     * Do these sets have any elements in common?
     */
    public boolean intersects(ESet other) {
        return myMap.intersects(other.myMap);
    }

    /**
     * How many entries are in the set?
     */
    public int size() {
        return myMap.size();
    }

    /**
     * Call 'func' with each index-value pair in the set, in order.
     */
    public void iterate(AssocFunc func) throws Throwable {
        ConstList.fromArray(getElements()).iterate(func);
    }

    /**
     * Returns the union of the sets.
     * <p>
     * If sets intersect, then if strict, throw an exception.
     * <p>
     * In the order, the 'behind' keys come first in their original
     * order, then the receiver's remaining keys in their original
     * order.
     */
    public ConstSet or(ESet behind, boolean strict) {
        return ConstSet.make(myMap.or(behind.myMap, strict));
    }

    /**
     * Defaults to not strict.
     */
    public ConstSet or(ESet behind) {
        return or(behind, false);
    }

    /**
     * The intersection of the sets.
     * <p>
     * The order in the intersection is taken from the smaller
     * of the original two.  If they're the same size, then the
     * receiver's order is used.
     */
    public ConstSet and(ESet mask) {
        return ConstSet.make(myMap.and(mask.myMap));
    }


    /**
     * The subset of this set not in 'mask'. <p>
     *
     * The order is the order of the receiver, as modified by removal
     * of the elements in mask in mask's order.
     */
    public ConstSet butNot(ESet mask) {
        return ConstSet.make(myMap.butNot(mask.myMap));
    }

    /**
     * Defaults to an array of elementType()
     */
    public Object getElements() {
        return getElements(elementType());
    }

    /**
     * Returns a divergent array-of-type of all the values in order.
     */
    public Object getElements(Class elementType) {
        return myMap.getKeys(elementType);
    }

    /**
     * Returns a ConstSet just like this one, except containing newElement.
     * <p>
     * The order is the same as the original; if 'newElement' is
     * new, it is added to the end of the order. <p>
     *
     * @param newElement nullOk;
     */
    public ConstSet with(Object newElement) {
        return ConstSet.make(myMap.with(newElement, null));
    }

    /**
     * Returns a ConstSet just like this one, except that there is no
     * ConstSet for 'key'.  The order is the same as the original,
     * except that if 'key' was in the original, the last key in the
     * ordering is moved into its place (as in the standard removal
     * spec). <p>
     *
     * This is currently horribly inefficient.  Can be made efficient by
     * using backward deltas.
     *
     * @param element nullOk;
     */
    public ConstSet without(Object element) {
        return ConstSet.make(myMap.without(element));
    }

    /**
     * Returns a snapshot of this set, but reordered so the elements
     * are in ascending order.
     */
    public ConstSet sort() {
        return sort(SimpleCompFunc.THE_ONE);
    }

    /**
     * Returns a snapshot of this set, but reordered so the elements
     * are in ascending order according to func.
     */
    public ConstSet sort(CompFunc func) {
        return ConstSet.make(myMap.sortKeys(func));
    }

    /**
     * Onto out, print 'left' element0 'sep' ... 'right'
     */
    public void printOn(String left,
                        String sep,
                        String right,
                        TextWriter out)
      throws IOException {
        ConstList.fromArray(getElements()).printOn(left, sep, right, out);
    }

    /**
     * All elements of this set must be of this type
     */
    public Class elementType() {
        return myMap.keyType();
    }
}



1.1                  e/src/jsrc/org/erights/e/elib/tables/FlexSet.java

Index: FlexSet.java
===================================================================
package org.erights.e.elib.tables;

import org.erights.e.elib.eio.TextWriter;
import org.erights.e.elib.serial.PassByProxy;

import java.io.IOException;

/**
 *
 * @author <a href="mailto:markm@caplet.com">Mark S Miller</a>
 */
public class FlexSet extends ESet implements PassByProxy {

    /**
     *
     */
    private FlexSet(FlexMap map) {
        super(map);
    }

    /**
     *
     */
    static public FlexSet make(FlexMap map) {
        return new FlexSet(map);
    }

    /**
     *
     */
    private FlexMap getMap() {
        return (FlexMap)myMap;
    }

    /**
     * Prints as an E list send the message 'asSet() diverge()'
     */
    public void printOn(TextWriter out) throws IOException {
        printOn("[", ", ", "] asSet() diverge()", out);
    }

    /**
     * 'strict' defaults to false
     */
    public void add(Object newElement) {
        add(newElement, false);
    }

    /**
     * Adds newElement to the set.
     * <p>
     * If it's already there, then if strict, throw an exception.
     */
    public void add(Object newElement, boolean strict) {
        getMap().put(newElement, null, strict);
    }

    /**
     * 'strict' defaults to false
     */
    public void remove(Object element) {
        remove(element, false);
    }

    /**
     * Removes the element from the set.
     * <p>
     * If it isn't there to be removed, then if strict, throw an exception.
     */
    public void remove(Object element, boolean strict) {
        getMap().removeKey(element, strict);
    }
}



1.1                  e/src/jsrc/org/erights/e/elib/tables/ROSet.java

Index: ROSet.java
===================================================================
package org.erights.e.elib.tables;

import org.erights.e.elib.eio.TextWriter;
import org.erights.e.elib.serial.PassByProxy;

import java.io.IOException;

/**
 *
 * @author <a href="mailto:markm@caplet.com">Mark S Miller</a>
 */
/*package*/ class ROSet extends ESet implements PassByProxy {

    /**
     *
     */
    private ROSet(EMap map) {
        super(map);
    }

    /**
     *
     */
    static public ROSet make(EMap map) {
        return new ROSet(map);
    }

    /**
     *
     */
    public ESet readOnly() {
        return this;
    }

    /**
     * Prints as an E list send the messages 'asSet() readOnly()'
     */
    public void printOn(TextWriter out) throws IOException {
        printOn("[", ", ", "] asSet() readOnly()", out);
    }
}



1.6       +0 -1      e/src/jsrc/org/quasiliteral/term/Term.updoc

Index: Term.updoc
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/term/Term.updoc,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Term.updoc	2001/11/06 06:27:33	1.5
+++ Term.updoc	2001/11/11 05:54:37	1.6
@@ -20,7 +20,6 @@
 
 
 
-
     ? def astro__uriGetter := <unsafe:org.quasiliteral.astro.*>
     # value: <unsafe:org.quasiliteral.astro.*>