Example #1
0
 public void fillFieldValuesFrom(GeneratedMatchingPattern pattern) {
   if (pattern != null && pattern.getClass() == this.getClass()) {
     patternVar_p = (SNode) pattern.getFieldValue("patternVar_p");
     patternVar_action_var_5730083271929373007 =
         (SNode) pattern.getFieldValue("patternVar_action_var_5730083271929373007");
   }
 }
Example #2
0
 public static GeneratedMatchingPattern patternRule_Condition_8654221991637509675(
     final PatternRuleContext _context) {
   GeneratedMatchingPattern pattern = new QueriesGenerated.Pattern_x583g4_a0a0a68();
   if (!(pattern.match(_context.getNode()))) {
     return null;
   }
   return pattern;
 }
Example #3
0
 public static GeneratedMatchingPattern patternRule_Condition_7926701909975928828(
     final PatternRuleContext _context) {
   GeneratedMatchingPattern pattern = new QueriesGenerated.Pattern_x583g4_a0a0a88();
   if (!(pattern.match(_context.getNode()))) {
     return null;
   }
   return pattern;
 }
Example #4
0
 public static GeneratedMatchingPattern patternRule_Condition_6647099934207260021(
     final PatternRuleContext _context) {
   GeneratedMatchingPattern pattern = new QueriesGenerated.Pattern_x583g4_a0a0a58();
   if (!(pattern.match(_context.getNode()))) {
     return null;
   }
   return pattern;
 }
Example #5
0
 public void fillFieldValuesFrom(GeneratedMatchingPattern pattern) {
   if (pattern != null && pattern.getClass() == this.getClass()) {
     patternVar_field = (SNode) pattern.getFieldValue("patternVar_field");
     patternVar_className = (SNode) pattern.getFieldValue("patternVar_className");
     patternVar_method = (SNode) pattern.getFieldValue("patternVar_method");
     patternVar_printed = (String) pattern.getFieldValue("patternVar_printed");
   }
 }
 public IsApplicableStatus isApplicableSecond(SNode node) {
   {
     GeneratedMatchingPattern pattern =
         new ResourceType_comparableWith_IResource_ComparisonRule.Pattern_v5k8je_a0a0a0a5();
     this.myMatchingPattern2 = pattern;
     boolean b = pattern.match(node);
     return new IsApplicableStatus(b, pattern);
   }
 }
 public IsApplicableStatus isApplicableSupertypeAndPattern(SNode node) {
   {
     GeneratedMatchingPattern pattern =
         new nlist_subtypeOf_list_of_nodes_InequationReplacementRule.Pattern_9szvhv_a0a0a0a7();
     this.myMatchingPattern2 = pattern;
     boolean b = pattern.match(node);
     return new IsApplicableStatus(b, pattern);
   }
 }
 public IsApplicableStatus isApplicableAndPattern(SNode argument) {
   {
     GeneratedMatchingPattern pattern =
         new sequence_supertypeOf_set_SubtypingRule.Pattern_5z9xz6_a0a0a0a4();
     this.myMatchingPattern = pattern;
     boolean b = pattern.match(argument);
     return new IsApplicableStatus(b, pattern);
   }
 }
 public IsApplicableStatus isApplicableAndPattern(SNode argument) {
   {
     GeneratedMatchingPattern pattern =
         new double_unboxing_SubtypingRule.Pattern_jy4zax_a0a0a0a4();
     this.myMatchingPattern = pattern;
     boolean b = pattern.match(argument);
     return new IsApplicableStatus(b, pattern);
   }
 }
 public IsApplicableStatus isApplicableSecond(SNode node) {
   {
     GeneratedMatchingPattern pattern =
         new DebuggerIsDebugger_ComparisonRule.Pattern_wcp5kc_a0a0a0a3();
     this.myMatchingPattern2 = pattern;
     boolean b = pattern.match(node);
     return new IsApplicableStatus(b, pattern);
   }
 }
 public IsApplicableStatus isApplicableSecond(SNode node) {
   {
     GeneratedMatchingPattern pattern =
         new Pattern_fub42q55(_quotation_createNode_3k2v7g_a0a0a0a0f());
     this.myMatchingPattern2 = pattern;
     boolean b = pattern.match(node);
     return new IsApplicableStatus(b, pattern);
   }
 }
 public IsApplicableStatus isApplicableAndPattern(SNode argument) {
   {
     GeneratedMatchingPattern pattern =
         new supertypesOf_ClassifierType_Collection_SubtypingRule.Pattern_832k9i_a0a0a0a2();
     this.myMatchingPattern = pattern;
     boolean b = pattern.match(argument);
     return new IsApplicableStatus(b, pattern);
   }
 }
 public IsApplicableStatus isApplicableAndPattern(SNode argument) {
   {
     GeneratedMatchingPattern pattern =
         new supertypesOf_ClassifierTypeSModel_SModelType_SubtypingRule.Pattern_fggx2c_a0a0a0a4();
     this.myMatchingPattern = pattern;
     boolean b = pattern.match(argument);
     return new IsApplicableStatus(b, pattern);
   }
 }
Example #14
0
 public boolean match() {
   SNode nodeToMatch = _quotation_createNode_xihehy_a0a0c2();
   GeneratedMatchingPattern pattern = new PatternProperty_Test.TestBody.Pattern_xihehy_a0a1a2c();
   boolean matchNeeded = true;
   boolean matches = pattern.match(nodeToMatch);
   if (matchNeeded != matches) {
     return false;
   }
   if (!(matchNeeded)) {
     return true;
   }
   Assert.assertEquals("something", (String) pattern.getFieldValue("patternVar_printed"));
   return true;
 }
Example #15
0
 public boolean match(SNode nodeToMatch) {
   {
     SNode nodeToMatch_7fbm30_a0a = nodeToMatch;
     if (!("jetbrains.mps.baseLanguage.structure.AssertStatement"
         .equals(nodeToMatch_7fbm30_a0a.getConcept().getQualifiedName()))) {
       return false;
     }
     {
       String childRole_7fbm30_ = "condition";
       if (!(PatternUtil.hasNChildren(nodeToMatch_7fbm30_a0a, childRole_7fbm30_, 1))) {
         return false;
       }
       {
         SNode childVar_7fbm30_a0a0 =
             IterableUtil.get(nodeToMatch_7fbm30_a0a.getChildren(childRole_7fbm30_), 0);
         {
           SNode nodeToMatch_7fbm30_a0a0 = childVar_7fbm30_a0a0;
           {
             boolean orMatches = false;
             GeneratedMatchingPattern orPattern;
             orPattern =
                 new RuleAssertNotNull.Pattern_7fbm30_a0a
                     .Pattern_7fbm30_a0a0a2a1a1a1a1a0a1a1a0a0a0a();
             if (orPattern.match(nodeToMatch_7fbm30_a0a0)) {
               orMatches = true;
               myOrPattern_7fbm30_a0a0 = orPattern;
             }
             orPattern =
                 new RuleAssertNotNull.Pattern_7fbm30_a0a
                     .Pattern_7fbm30_a0a0a3a1a1a1a1a0a1a1a0a0a0a();
             if (orPattern.match(nodeToMatch_7fbm30_a0a0)) {
               orMatches = true;
               myOrPattern_7fbm30_a0a0 = orPattern;
             }
             if (!(orMatches)) {
               return false;
             }
           }
         }
         this.patternVar_action_var_5730083271929373007 = childVar_7fbm30_a0a0;
       }
     }
   }
   return true;
 }
Example #16
0
 public void performActions(Program program, SNode node) {
   myPattern.performActions(program);
 }
Example #17
0
 public boolean isApplicable(SNode node) {
   return myPattern.match(node);
 }
 public void fillFieldValuesFrom(GeneratedMatchingPattern pattern) {
   if (pattern != null && pattern.getClass() == this.getClass()) {
     patternVar_elem = (SNode) pattern.getFieldValue("patternVar_elem");
   }
 }
 @Override
 public void execute(final SNode node, final EditorContext editorContext) {
   {
     GeneratedMatchingPattern pattern_6isygg_a0a =
         new IterateOverIterable_Intention.Pattern_w1n2qe_a0a0a0a2h();
     SNode coercedNode_6isygg_a0a =
         TypeChecker.getInstance()
             .getRuntimeSupport()
             .coerce_(
                 TypeChecker.getInstance()
                     .getTypeOf(
                         SLinkOperations.getTarget(
                             node,
                             MetaAdapterFactory.getContainmentLink(
                                 0xf3061a5392264cc5L,
                                 0xa443f952ceaf5816L,
                                 0xf8cc56b213L,
                                 0xf8cc56b214L,
                                 "expression"))),
                 pattern_6isygg_a0a);
     if (coercedNode_6isygg_a0a != null) {
       SNode foreachStatement =
           SNodeFactoryOperations.createNewNode(
               SNodeFactoryOperations.asInstanceConcept(
                   MetaAdapterFactory.getConcept(
                       0xf3061a5392264cc5L,
                       0xa443f952ceaf5816L,
                       0x10a6933ce33L,
                       "jetbrains.mps.baseLanguage.structure.ForeachStatement")),
               null);
       SNode variableDeclaration =
           SNodeFactoryOperations.setNewChild(
               foreachStatement,
               MetaAdapterFactory.getContainmentLink(
                   0xf3061a5392264cc5L,
                   0xa443f952ceaf5816L,
                   0x10a697996feL,
                   0x10a6979f36bL,
                   "variable"),
               SNodeFactoryOperations.asInstanceConcept(
                   MetaAdapterFactory.getConcept(
                       0xf3061a5392264cc5L,
                       0xa443f952ceaf5816L,
                       0xf8cc67c7efL,
                       "jetbrains.mps.baseLanguage.structure.LocalVariableDeclaration")));
       SLinkOperations.setTarget(
           variableDeclaration,
           MetaAdapterFactory.getContainmentLink(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0x450368d90ce15bc3L,
               0x4ed4d318133c80ceL,
               "type"),
           SNodeOperations.copyNode(
               ((SNode) pattern_6isygg_a0a.getFieldValue("patternVar_elem"))));
       SPropertyOperations.set(
           variableDeclaration,
           MetaAdapterFactory.getProperty(
               0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"),
           NameUtil.toValidIdentifier(
               BaseConcept_BehaviorDescriptor.getPresentation_idhEwIMiw.invoke(
                   ((SNode) pattern_6isygg_a0a.getFieldValue("patternVar_elem")))));
       SLinkOperations.setTarget(
           foreachStatement,
           MetaAdapterFactory.getContainmentLink(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0x10a6933ce33L,
               0x10a6934ab66L,
               "iterable"),
           SNodeOperations.copyNode(
               SLinkOperations.getTarget(
                   node,
                   MetaAdapterFactory.getContainmentLink(
                       0xf3061a5392264cc5L,
                       0xa443f952ceaf5816L,
                       0xf8cc56b213L,
                       0xf8cc56b214L,
                       "expression"))));
       SNodeOperations.insertNextSiblingChild(node, foreachStatement);
       SNodeOperations.deleteNode(node);
     } else {
     }
   }
 }