DIRECTORY Rope, IO, AlgebraClasses; ASSetStructure: CEDAR DEFINITIONS ~ BEGIN OPEN Rope, AC: AlgebraClasses; SetStructureElement: TYPE = AC.Object; SetStructureData: TYPE = REF SetStructureDataRec; SetStructureDataRec: TYPE = RECORD [ definingSet: AC.Object, -- the elements of the Structure are the elements of definingSet elementUniverse: AC.Object -- the universe of the PowerSetStructure to which definingSet belongs ]; MakeSetStructure: AC.StructureFromSetConstructor; PrintName: AC.ToRopeOp; ShortPrintName: AC.ToRopeOp; IsSetStructure: AC.UnaryPredicate; DefiningSet: AC.UnaryOp; ElementUniverse: AC.UnaryOp; StructureData: AC.UnaryToListOp; Recast: AC.BinaryOp; CanRecast: AC.BinaryPredicate; ToExpr: AC.ToExprOp; LegalFirstChar: AC.LegalFirstCharOp; Read: AC.ReadOp; FromRope: AC.FromRopeOp; ToRope: AC.ToRopeOp; Write: AC.WriteOp; UnderlyingSetUniverseEltFromSSSElt: AC.UnaryOp; SSSEltFromUnderlyingSetUniverseElt: AC.BinaryOp; IsVariable: AC.UnaryPredicate; VariableFromRope: AC.FromRopeOp; END. xASSetStructure.mesa Last Edited by: November 19, 1987 8:37:46 am PST Constructor: make a Structure whose underlying set is a given argument Set (i.e. an element of a Power Set Structure). Element Representation Elements of a SetStructure are represented as elements of the universe of the PowerSet Structure to which the argument Set belongs (i.e. they have the same rep as the elements of the argument Set), except that their class fields are reset to point to the SetStructure. Thus they are just like elements of the argument Set, except that there is a level of "indirection" in their class fields, e.g. to operate on them, you have to follow their class pointer to the SetStructure, then get the elementUniverse of that SetStructure. Structure Instance Data Structure Constructor Structure Operations selector: definingSet of a Set Structure selector: elementUniverse of a Set Structure selector: returns LIST[definingSet, elementUniverse] of a Set Structure Element Conversion and IO secondArg is a Single Set Structure, firstArg is an element of its underlyingSet represented as an element of the underlyingSet's universe. result is (a copy of) firstArg with its class reset to secondArg check whether arg is a variable represented as an element of a SetStructure Get a variable from a rope, and recast it as an element of the SetStructure consisting of itself as the only element Κg˜Jšœ™J™0J˜Jšœv™vJ™šΟk ˜ Icodešœ˜Kšœ˜Kšœ˜—Ihead2šΟnœœ ˜!Jšœœœœ˜'headšž™Jšœœœ˜&J˜Kšœ™—šœ™Kšœœœ˜1šœœœ˜$Kšœ œ ΟcA˜ZKšœœ ŸF˜bK˜——™Kšžœœ˜1—šœ™šž œœ ˜K˜—šžœœ ˜K˜—šžœœ˜"J˜—šž œœ ˜Jšœ(™(J™—šžœœ ˜Jšœ,™,J™—šž œœ˜ JšœH™H——šœ™šžœœ ˜J˜—šž œœ˜J˜—šžœœ ˜J˜—šžœœ˜$J˜—šžœœ˜J˜—šžœœ ˜J˜—šžœœ ˜J˜—šžœœ ˜J˜—šž"œœ ˜/K˜—šž"œœ ˜0K™Ν—K˜šž œœ˜K™KK˜—šžœœ ˜ Jšœt™t——J˜Jšœ˜—…— ε