SchemaNut:
CEDAR
DEFINITIONS =
BEGIN
OPEN DB, Rope, ViewerClasses;
AttributeInfo: TYPE = REF AttributeInfoRecord;
AttributeInfoRecord:
TYPE =
RECORD[
relation: Relation,
nameLabel: Buttons.Button,
name: Viewer,
typeLabel: Labels.Label,
type: Viewer,
lengthLabel: Labels.Label,
length: Viewer,
uniqueness: Buttons.Button ];
DomainInfo: TYPE = REF DomainInfoRecord;
DomainInfoRecord:
TYPE =
RECORD[
name: Rope.ROPE,
subTypes: Viewer,
superTypes: Viewer,
deleted: LIST OF Relation, -- deleted properties
properties: LIST OF AttributeInfo];
RelationInfo: TYPE = REF RelationInfoRecord;
RelationInfoRecord:
TYPE =
RECORD[name: Rope.
ROPE, attributes:
LIST
OF AttributeInfo];
*******************************************************
-- SchemaCopyImpl--
copy the elements of a schemata
coerce the data on a per-attribute data
*******************************************************
CopyDomainContents: PROCEDURE[oldD, newD: DB.Domain];
CopyRelships: PROCEDURE[oldR, newR: DB.Relation];
*******************************************************
--SchemaNutImpl--
useful routines
*******************************************************
GetRelationsOf: PROC[d: DB.Domain] RETURNS[relations: LIST OF DB.Relation];
SubType: PROC[sub, super: DB.Domain] RETURNS[BOOLEAN];
GetDataType: PROC[type: ROPE, segment: DB.Segment] RETURNS[dt: DB.DataType];
Optimized: PROCEDURE [d: Domain] RETURNS [opt: BOOLEAN];
SaveProperty: PROCEDURE [d: Domain, info: AttributeInfo];
NewAttribute: Buttons.ButtonProc;
AddAttribute:
PROC[button: Viewer, segment:
DB.Segment, oldList:
LIST
OF AttributeInfo]
RETURNS[newList: LIST OF AttributeInfo];
RemoveAttribute:
PROCEDURE[button: Viewer, oldList:
LIST
OF AttributeInfo]
RETURNS[newList: LIST OF AttributeInfo, relation: Relation];
DisplayAttribute:
PROC[r: Relation, a: Attribute, lastV: Viewer, segment: Segment ←
NIL]
RETURNS[info: AttributeInfo];
CheckProperty:
PROCEDURE[d: Domain, info: AttributeInfo, deleted:
LIST
OF Relation]
RETURNS[ok:
BOOLEAN ←
TRUE];
Check to see that the property defined by the attribute is legal for the domain
Reverse: PROCEDURE[old: LIST OF AttributeInfo] RETURNS[new: LIST OF AttributeInfo];
RemoveDeleted:
PROCEDURE[d: Domain, info: AttributeInfo, relations:
LIST
OF Relation]
RETURNS[
LIST
OF Relation];
Removes the attribute corresponding to the given attribute information from the list of relations (unless the viewers referred to in the info have been unchanged)
NextName: PROCEDURE[list: ROPE] RETURNS[token, newList: ROPE, ok: BOOLEAN ← TRUE];
END . .