/** Create new multi rule with embedding of the kernel rule. */ public MultiRule createMultiRule(final String ruleName) { OrdinaryMorphism embL = this.kernelRule.getLeft().plainCopy(); if (embL == null) { embL = new OrdinaryMorphism( this.kernelRule.getLeft(), BaseFactory.theFactory().createGraph(this.kernelRule.getLeft().getTypeSet(), false), agg.attribute.impl.AttrTupleManager.getDefaultManager() .newContext(AttrMapping.PLAIN_MAP)); } OrdinaryMorphism embR = this.kernelRule.getRight().plainCopy(); if (embR == null) { embR = new OrdinaryMorphism( this.kernelRule.getRight(), BaseFactory.theFactory().createGraph(this.kernelRule.getRight().getTypeSet(), false), agg.attribute.impl.AttrTupleManager.getDefaultManager() .newContext(AttrMapping.PLAIN_MAP)); } MultiRule multiRule = new MultiRule(this.kernelRule, embL, embR); // add only variables of LHS and RHS if (this.kernelRule.hasNACs() || this.kernelRule.hasPACs()) { final Vector<String> list = this.kernelRule.getLeft().getVariableNamesOfAttributes(); list.addAll(this.kernelRule.getRight().getVariableNamesOfAttributes()); multiRule.addToAttrContextAccordingList( (VarTuple) this.kernelRule.getAttrContext().getVariables(), list); } else { multiRule.addToAttrContext((VarTuple) this.kernelRule.getAttrContext().getVariables()); } multiRule.setRuleScheme(this); multiRule.setName(ruleName); multiRule.getLeft().setKind(GraphKind.LHS); multiRule.getRight().setKind(GraphKind.RHS); this.multiRules.add(multiRule); this.kernelRule.getLeft().addObserver(multiRule); this.kernelRule.getRight().addObserver(multiRule); this.kernelRule.addObserver(multiRule); this.kernelRule.setChanged(false); return multiRule; }
/* Create an empty multi rule. */ protected MultiRule createEmptyMultiRule() { MultiRule multiRule = new MultiRule(this.kernelRule.getTypeSet()); multiRule.setEmbeddingLeft( new OrdinaryMorphism( this.kernelRule.getLeft(), multiRule.getLeft(), agg.attribute.impl.AttrTupleManager.getDefaultManager() .newContext(AttrMapping.PLAIN_MAP))); multiRule.setEmbeddingRight( new OrdinaryMorphism( this.kernelRule.getRight(), multiRule.getRight(), agg.attribute.impl.AttrTupleManager.getDefaultManager() .newContext(AttrMapping.PLAIN_MAP))); multiRule.setRuleScheme(this); this.multiRules.add(multiRule); return multiRule; }
public AttrManager getAttrManager() { return AttrTupleManager.getDefaultManager(); }