/** * Extracts the morphism from rule nodes to input graph nodes corresponding to the transition's * input parameters. * * @return if {@code null}, the binding cannot be constructed and so the rule cannot match */ private RuleToHostMap extractBinding(Step step) { RuleToHostMap result = this.state.getGraph().getFactory().createRuleToHostMap(); Object[] sourceValues = this.state.getActualValues(); for (Assignment assign : step.getEnterAssignments()) { sourceValues = assign.compute(sourceValues); } for (Pair<Var, Binding> entry : step.getRuleSwitch().getCallBinding()) { Binding bind = entry.two(); HostNode value; if (bind == null) { // this corresponds to an output parameter of the call continue; } switch (bind.getSource()) { case CONST: value = bind.getValue().getNode(); break; case VAR: value = Valuator.get(sourceValues, bind); break; default: assert false; value = null; } RuleNode ruleNode = entry.one().getRuleNode(); if (isCompatible(ruleNode, value)) { result.putNode(ruleNode, value); } else { result = null; break; } } return result; }