DIRECTORY SafeStorage, IO, Atom, Rope, Basics, Imager, MathExpr; ASStructures: CEDAR DEFINITIONS = BEGIN ROPE: TYPE = Rope.ROPE; STREAM: TYPE = IO.STREAM; EXPR: TYPE = MathExpr.EXPR; Category: TYPE ~ {set, lattice, group, ring, field, module, vectorSpace, algebra, divisionAlgebra}; PrintNameProc: TYPE = PROC [structure: Object] RETURNS [Rope.ROPE]; -- redundant with ToRopeOp StructureToExprOp: TYPE = PROC [structure: Object] RETURNS [out: EXPR]; StructureEqualityTest: TYPE = PROC [thisStructure, otherStructure: Object] RETURNS [BOOL]; StructureRankOp: TYPE = PROC [structure: Object] RETURNS [CARDINAL]; ReportOpsProc: TYPE = PROC [structure: Object] RETURNS [opNames: LIST OF Rope.ROPE, refOps: LIST OF REF]; BinaryStructureLUBOp: TYPE = PROC [firstStructure, secondStructure: Object] RETURNS [LUBStructure: Object]; StructureFromSetConstructor: TYPE = PROC [set: Object] RETURNS [structure: Object]; VectorStructureConstructor: TYPE = PROC [coordinateStructure: Object, dimension: NAT, row: BOOL _ TRUE] RETURNS [vectorStructure: Object]; SequenceStructureConstructor: TYPE = PROC [elementStructure: Object, row: BOOL _ TRUE] RETURNS [sequenceStructure: Object]; MatrixStructureConstructor: TYPE = PROC [elementStructure: Object, nRows, nCols: NAT] RETURNS [matrixStructure: Object]; PolynomialStructureConstructor: TYPE = PROC [coeffRing, variableSeq: Object] RETURNS [polynomialStructure: Object]; IsCategory: PROC [structure: Object, category: Category] RETURNS [BOOL]; HasProperty: PROC [structure: Object, property: ATOM] RETURNS [BOOL]; MakeStructure: PROC [name: Rope.ROPE, class: Object, instanceData: REF] RETURNS[structure: Object]; StructureEqual: PROC [structure1, structure2: Object] RETURNS [BOOL]; LookupMethodInStructure: PROC [methodSelector: ATOM, structure: Object] RETURNS[Method]; LookupMethodInAllStructures: PROC [methodSelector: ATOM] RETURNS[method: Method, structure: Object]; ResetStructureRegistry: PROC[]; InstallStructure: PROC[structure: Object]; LookupStructure: PROC[name: ROPE] RETURNS[structure: Object]; KillStructure: PROC[name: ROPE]; LegalFirstCharOp: TYPE = PROC [char: CHAR, structure: Object] RETURNS [BOOL]; ReadOp: TYPE = PROC [in: IO.STREAM, structure: Object _ NIL] RETURNS [out: Object]; FromRopeOp: TYPE = PROC [in: Rope.ROPE, structure: Object _ NIL] RETURNS [out: Object]; ToRopeOp: TYPE = PROC [in: Object] RETURNS [out: Rope.ROPE]; WriteOp: TYPE = PROC [stream: IO.STREAM, in: Object]; FromExprOp: TYPE = PROC [in: EXPR, structure: Object] RETURNS [out: Object]; ToExprOp: TYPE = PROC [in: Object] RETURNS [out: EXPR]; FromBOOLOp: TYPE = PROC [in: BOOL, structure: Object _ NIL] RETURNS [out: Object]; FromINTOp: TYPE = PROC [in: INT, structure: Object _ NIL] RETURNS [out: Object]; NullaryOp: TYPE = PROC[structure: Object] RETURNS [result: Object]; CompareToZeroOp: TYPE = PROC [arg: Object] RETURNS [Basics.Comparison]; BinaryCompareOp: TYPE = PROC [firstArg, secondArg: Object] RETURNS [Basics.Comparison]; StructuredToGroundOp: TYPE = PROC [structuredElt: Object] RETURNS [groundElement: Object]; ElementRankOp: TYPE = PROC [arg: Object] RETURNS [CARDINAL]; Display2DOp: TYPE = PROC [object: Object, context: Imager.Context, dotWidth, segmentWidth: REAL]; Copy: UnaryOp; ElementOf: PROC [object: Object, structure: Object] RETURNS [BOOL]; UnaryImbedOp: TYPE = PROC [in: Object, structure: Object] RETURNS [out: Object]; BinaryImbedOp: TYPE = PROC [data1: Object, data2: REF, structure: Object] RETURNS [out: Object]; ListImbedOp: TYPE = PROC [data: LIST OF Object, structure: Object] RETURNS [out: Object]; MatrixImbedOp: TYPE = PROC [elements: LIST OF Object, structure: Object] RETURNS [out: Object]; Structures: AC.Object; -- public structure StructuresClass: AC.Object; -- public class; other Structure Impls will add methods to it. END. ยASStructures.mesa Copyright c 1987 by Xerox Corporation. All rights reserved. Arnon, November 23, 1987 10:16:20 am PST Should handle interactions between the global structure registry, and the LB DB. It should be transparent to the structure registry whether an (instantiated) structure in it is online or offline. Types From Imported Interfaces Structure Categories Structure Operation Types Identify the particular structure to the world. Test whether some other structure is the same algebraic domain as this one For things like ring characteristic (smallest positive integer k such that k*1 = 0; 0 if k infinite) and vector space dimension. Report structure operations to outside world, e.g. a user interface Should be made a concrete proc to be applied to method dictionaries If either Structure NIL, return other Structure Constructor Types Make a Structure whose (finite) underlying set is the given argument. A particular vector structure is defined by its coordinateStructure, which can be any Structure, its dimension, and whether its elements are displayed as rows or columns. A particular sequence structure is defined by its elementStructure, which can be any Structure, and whether its elements are displayed as rows or columns. A particular matrix structure is defined by its elementStructure and its nRows, nCols. elementStructure can be a ring, field, algebra, or divisionAlgebra. A particular polynomial structure is defined by its coeffRing and its variables. coeffRing can be a ring, field, algebra, or divisionAlgebra. variableSeq is a sequence of any length, and the right thing happens. Structure Operations RETURN[structure1.name = structure2.name] LookupMethodInClass[structure.class] Linear search of StructureRegistry, LookupMethodForStructure until found or EOF. If found, then structure is Structure where found. Returns [NIL, NIL] if not found. Structure Registry Structures have nonNIL names. Mathematically different Structures have different names. A central registry of Structures is kept, and we never have more than one instance of a given mathematical structure in existence. effects: Installs structure in global StructureRegistry database. Replaces existing occurrence of a Structure with same name, if any, and otherwise places structure at the tail of StructureRegistry. effects: Returns the Structure Object associated with name. returns NIL if not found effects: delete structure from global StructureRegistry DataBase, if present. Only needed when want to delete a given Structure name entirely, not if just want to replace. StructureElement Operation Types True if char is legal first char in an external rep of a structure element. Since no object arg, need a hook to structure For things like determinant and coefficient extraction For things like degree functions in euclidean domains, rank of matrices Display an object in a 2D context. StructureElement Operations True if object is an element of structure. (check equality of its structure's name with this structure's name) StructureElement Creation Types Imbed in as an element of structure Construct an element of structure from data1 and data2. Sample use: constructing a term of a polynomial. Construct an element of a point, sequence, or vector Structure from data Construct an element of a matrix Structure from data. Assumes that correct number of elements supplied, in correct order, and that each element supplied belongs to structure.elementStructure Variables ส๊– "Mesa" style˜šœ ฯc™Jšœ ฯmœ1™