DIRECTORY HashPairCollectionsPrivate, HashTables, Collections, PairCollections; HashPairCollectionsPublicImpl: CEDAR PROGRAM IMPORTS HashPairCollectionsPrivate, HashTables, Collections, PairCollections EXPORTS PairCollections = BEGIN OPEN HT:HashTables, Colls:Collections, Collections, PairCollections, HashPairCollectionsPrivate; CreateHashReln: PUBLIC PROC [spaces: SpacePair _ [NIL, NIL], functional: BoolPair _ [FALSE, FALSE], mappable: BoolPair _ [TRUE, TRUE]] RETURNS [VarPairColl] ~ { ability: Abilities; FOR dir: Direction IN Direction DO IF spaces[Source[dir]]=NIL THEN spaces[Source[dir]] _ Colls.refs; ability[dir] _ IF functional[dir] THEN map ELSE IF mappable[dir] THEN image ELSE none; ENDLOOP; {bestDir: Direction ~ IF ability[rightToLeft] > ability[leftToRight] THEN rightToLeft ELSE leftToRight; hr: HashRelation ~ NEW [HashRelationPrivate _ [ spaces: spaces, ability: ability, bestDir: bestDir, bestAbility: ability[bestDir], tables: [HT.Create[spaces[left]], HT.Create[spaces[right]]] ]]; RETURN [AsVar[[FetchClass[hr.ability, variable], hr]]]; }}; CreateHashCopy: PUBLIC PROC [pc: PairColl, spaces: SpacePair _ [NIL, NIL], mappable: BoolPair _ [FALSE, FALSE]] RETURNS [copy: HashFn] ~ { FOR side: Side IN Side DO IF spaces[side]=NIL THEN spaces[side] _ pc.Spaces[][side]; IF pc.QualityOf[$Image, LIST[IF side=left THEN $leftToRight ELSE $rightToLeft]] >= goodDefault THEN mappable[From[side]] _ TRUE; ENDLOOP; copy _ CreateHashReln[spaces, pc.Functional, mappable]; [] _ copy.AddColl[pc]; }; END. lHashPairCollectionsPublicImpl.Mesa Last tweaked by Mike Spreitzer on August 28, 1987 10:45:05 am PDT Κρ– "cedar" style˜code™"KšœA™A—K˜KšΟk œF˜OK˜šΟnœœ˜,KšœE˜LKšœ˜K˜—K˜Kšœœœ žœG˜fK˜šžœœœœœœœœœœ˜ Kšœ˜šœœ ˜"Kšœœœ"˜AKš œœœœœœœ˜VKšœ˜—Kšœœ-œ œ ˜gšœœ˜/K˜Kšœ˜Kšœ˜Kšœ˜Kšœ œœ˜;K˜—Kšœ1˜7K˜—K˜šžœœœ%œœœœœ˜Ššœ œ˜Kšœœœ"˜:Kšœœœ œœœœ˜€Kšœ˜—Kšœ7˜7Kšœ˜K˜—K˜Kšœ˜—…—τQ