6.4 Classification Interface

ORIGIN 'sets';
BODY 'private/classificationBody';
(*
 * COPYRIGHT
 *       Copyright (C) Mjolner Informatics, 1992-94
 *       All rights reserved.
 *)
--- lib: attributes ---
classificationSet: set
  (* A classification set is a set in which subsets may be defined.
   * The subsets of a classificationSet are such that inserting
   * elements in the subsets, makes the element a member of the
   * classificationSet.  Inserting an element in one of the subsets of
   * the classificationSet, which is already in the classificationSet
   * (or one of its subsets), will move the element from the
   * classificationSet (or the subset) into the proper subset.  If a
   * classificationSet is inserted as a subset of
   * THIS(classificationSet), it is ensured that inserting elements in
   * the subset will not result in dublicates being present in
   * THIS(classificationSet).  The reference SuperSet in
   * THIS(classificationSet) refers to the classificationSet,
   * THIS(classificationSet) might be a subset of.  SuperSet is NONE,
   * if THIS(classificationSet) is not a subset of any other
   * classificationSet.  Defines two new operations: 
   *       insertSubset, scanUnclassified
   *)
  (# <<SLOT classificationSetLib: attributes>>;
     clear::< (# ... #);
     size::< (# ... #);
     has::< (# ... #);
     copy::< (# ... #);
     delete::<(# ... #);
     subsets: @
       (* The subsets currently registered in THIS(classificationSet)
        *)
       set(# element::< classificationSet #);
     superSet: ^classificationSet;
     insertSubset: 
       (* Takes a classificationSet, and defines it as a subset of
        * this classificationSet.  The elements of this subset will
        * now be member of THIS(classificationSet)
        *)
       (# ss: ^classificationSet;
          illegalSubset:< Exception
            (* Will be invoked if a subset is inserted with an
             * element type is not a subpattern of the element type of
             * THIS(classificationSet).
             *)
            (# 
            do 'The elements of the subset does not share '->msg.putText;
               'qualifications with the elements of this set'->msg.putLine;
               INNER
            #)
       enter ss[]
       ...
       #);
     insert::< (# ... #);
     scanUnclassified: 
       (* similar to scan, except that it only scans those elements
        * that are NOT member of any subsets
        *)
       (# where:< elementPredicate;
          current: ^element;
          start:< object;
          end:< object
       do start; ...; end
       #);
     theScanner::<  (* private *)
       (# 
       ...
       #);
     doEnter::<
       (# containerType::<classificationSet;
          ...
       #);
  #)


6.4 Classification Interface
© 1992-2002 Mjølner Informatics
[Modified: Thursday September 9th 1999 at 16:18]