public override void Emit(SourceBuilder sourceCode) { // emit initialization with element mapped from name map string tempVariableForMapResult = NamesOfEntities.MapByNameTemporary(PatternElementName); sourceCode.AppendFrontFormat("if({0}==null || !({0} is {1}))", tempVariableForMapResult, IsNode ? "GRGEN_LIBGR.INode" : "GRGEN_LIBGR.IEdge"); // emit check failed code sourceCode.Append("{\n"); sourceCode.Indent(); CheckFailedOperations.Emit(sourceCode); sourceCode.Unindent(); sourceCode.AppendFront("}\n"); // assign the value to the candidate variable, cast it to the variable type string typeOfVariableContainingCandidate = "GRGEN_LGSP." + (IsNode ? "LGSPNode" : "LGSPEdge"); string variableContainingCandidate = NamesOfEntities.CandidateVariable(PatternElementName); sourceCode.AppendFrontFormat("{0} = ({1}){2};\n", variableContainingCandidate, typeOfVariableContainingCandidate, tempVariableForMapResult); }