LichenTransforms.Mesa
Last tweaked by Mike Spreitzer on May 5, 1987 10:50:30 am PDT
DIRECTORY LichenDataStructure, LichenSetTheory, IO;
LichenTransforms: CEDAR DEFINITIONS =
BEGIN OPEN LichenDataStructure, LichenSetTheory;
IntroCellType: PROC [design: Design] RETURNS [newCT: CellType];
Pre: newCT design
Post: newCT  design ' empty newCT ' |instances of newCT|=0
ExtroCellType: PROC [design: Design, oldCT: CellType];
Pre: newCT  design ' (empty newCT ( |instances of newCT|=0)
Post: newCT design
Differentiate: PROC [design: Design, instances: Set--of Vertex--] RETURNS [newCT: CellType];
Pre:  oldCT i  instances: i of oldCT
Post: (instances of newCT) = instances ' equiv(newCT, oldCT)
Undifferentiate: PROC [design: Design, toType, fromType: CellType] RETURNS [changed: Set--of Vertex--];
Pre: i  changed: i of fromType ' equiv(fromType, toType)
Post: i  changed: i of toType
LowerChildren: PROC [design: Design, childType: CellType, sibber: Mapper--child b RefSeq (role b sibling: Vertex)--] RETURNS [gcs: RefSeq--role b grandchild--, children: Set--of Vertex--];
Pre:
(dom sibber)=(instances of childType).
c of childType: (dom range sibber(c)) = [0 .. |gcs|).
c of childType, n  dom sibber(c): parent(c)=parent(sibber(c)[n]).
Post:
c of childType, n  dom sibber(c): type of sibber(c)[n] = type of gcs[n].
children = instances of childType.
n: parent of gcs[n] = childType.
c of childType, n  dom sibber(c): sibber(c)[n] ~~ gcs[n].
Inverse of RaiseGrandchildren.
Equivalent to [temp, pairs] ← GroupType[sibber]; MergeTypes[reverse pairs].
RaiseGrandchildren: PROC [design: Design, gcs: Set--of Vertex--] RETURNS [childType: CellType, sibber: Mapper--child b RefSeq (role b sibling: Vertex)--];
Pre:
gc  gcs: parent(gc) = childType.
Post:
(dom sibber) = (instances of childType).
c of childType: (dom range sibber(c)) = [0 .. |gcs|).
c of childType, n  dom sibber(c): parent(c)=parent(sibber(c)[n]).
c of childType, n  dom sibber(c): type of sibber(c)[n] = type of gcs[n].
c of childType, n  dom sibber(c): sibber(c)[n] ~~ gcs[n].
Inverse of LowerChildren.
Equivalent to [childType, temp, pairs] ← SplitType[gcs]; ss ← ExpandType[temp]; sibber ← (lbr pairs)gss.
MergeTypes: PROC [design: Design, pairs: OneToOne--instances of from é instances of into--];
Each pair is replaced by an instance of the new version of into, which got the contents of from merged into it. Cell type from is then deleted.
Inverse of SplitType.
Equivalent to [from, sibber]←RaiseGrandchildren[(children of from)]; LowerChildren[into, (rbl pairs)gsibber]; DeleteCellTypeAndInstances[from].
SplitType: PROC [design: Design, fizz: Set--of CellInstance--] RETURNS [from, to: CellType, pairs: OneToOne--instances of from é instances of to--];
The fizz must all be components of from; they are moved into the new cell type to. At each instance of from, an instance of to is created.
Inverse of MergeTypes.
Equivalent to to𡤌reateCellType[]; at each instance of from instantiate to; [from, sibber]←RaiseGrandchildren[fizz]; LowerChildren[to, (rbl pairs)gsibber].
ExpandType: PROC [design: Design, cellType: CellType] RETURNS [mapper: Mapper--Vertex b RefSeq (role b sibling: Vertex)--];
Replaces each instance of cellType with the contents of cellType.
Inverse of GroupType.
Equivalent to [cellType, sibber] ← RaiseGrandchildren[(contents of cellType)]; delete new version of cellType and all its instances.
ExpandVertex: PROC [child: CellInstance] RETURNS [roleToSib: RefSeq--role b sibling: CellInstance--];
replaces child with its contents.
Equivalent to Differentiate[{child}] then ExpandType[(new type of child)].
ExpandChildren: PROC [design: Design, parent: CellType, flatten: BOOLFALSE];
If flatten then ExpandVertex[each composite descendant] else ExpandVertex[each composite child].
Flatten: PROC [root: CellType, expand: Filter--of CellInstance--];
GroupType: PROC [design: Design, mapper: Mapper--any b RefSeq (role b sibling: CellInstance)--] RETURNS [newType: CellType, pairs: OneToOne--domain of mapper é instances of newType--];
For each pair in the mapping, replace the range of the range with an instance of the new cell type.
Inverse of ExpandType.
Equivalent to: introduce newType; instantiate it in the parent of each set of instances; LowerChildren[newType, an instance of newType b the set of instances it is for].
END.