示例#1
0
 public static Collection<String> getUsedLanguageNamespaces(
     SModel model, boolean isTemplateModel) {
   if (isTemplateModel) {
     return getUsedLanguageNamespacesInTemplateModel(model);
   }
   if (SModelStereotype.isGeneratorModel(model)) {
     TemplateModelScanner templateModelScanner = new TemplateModelScanner(model);
     templateModelScanner.scan();
     Set<String> namespaces = new HashSet<String>(templateModelScanner.getQueryLanguages());
     for (SModuleReference ref :
         ((jetbrains.mps.smodel.SModelInternal) model).engagedOnGenerationLanguages()) {
       namespaces.add(ref.getModuleName());
     }
     return namespaces;
   }
   Set<String> namespaces = new HashSet<String>();
   for (SModuleReference ref :
       ((jetbrains.mps.smodel.SModelInternal) model).engagedOnGenerationLanguages()) {
     namespaces.add(ref.getModuleName());
   }
   for (SNode root : model.getRootNodes()) {
     namespaces.add(NameUtil.namespaceFromConceptFQName(root.getConcept().getId()));
     for (SNode child : jetbrains.mps.util.SNodeOperations.getDescendants(root, null)) {
       namespaces.add(NameUtil.namespaceFromConceptFQName(child.getConcept().getId()));
     }
   }
   // empty behavior model should have it's behavior aspect descriptor generated
   if (model.getModule() instanceof Language && LanguageAspect.BEHAVIOR.is(model)) {
     namespaces.add(BootstrapLanguages.BEHAVIOR.getModuleName());
   }
   return namespaces;
 }
示例#2
0
  public static void assertDeepNodeEquals(SNode expectedNode, SNode actualNode) {
    assertEquals(
        getErrorString("concept", expectedNode, actualNode),
        expectedNode.getConcept().getQualifiedName(),
        actualNode.getConcept().getQualifiedName());

    // match properties
    assertPropertyEquals(expectedNode, actualNode);
    // match references
    assertReferenceEquals(expectedNode, actualNode);
    // match children
    assertDeepChildrenEquals(expectedNode, actualNode);
  }
示例#3
0
  public SNode coerceSubTypingNew(
      final SNode subtype,
      final IMatchingPattern pattern,
      final boolean isWeak,
      final TypeCheckingContext context) {
    if (subtype == null) return null;
    if (pattern.match(subtype)) return subtype;
    if (!CoerceUtil.canBeCoerced(subtype, pattern.getConceptFQName())) return null;
    if ("jetbrains.mps.lang.typesystem.structure.MeetType"
        .equals(subtype.getConcept().getQualifiedName())) {
      List<SNode> children =
          new ArrayList(IterableUtil.asCollection(subtype.getChildren("argument")));
      for (SNode child : children) {
        SNode result = coerceSubTypingNew(child, pattern, isWeak, context);
        if (result != null) return result;
      }
      return null;
    }
    final TypeCheckingContext typeCheckingContext = context;
    if ("jetbrains.mps.lang.typesystem.structure.JoinType"
        .equals(subtype.getConcept().getQualifiedName())) {
      List<SNode> children =
          new ArrayList(IterableUtil.asCollection(subtype.getChildren("argument")));

      SNode lcs = SubtypingUtil.createLeastCommonSupertype(children, typeCheckingContext);
      return coerceSubTypingNew(lcs, pattern, isWeak, context);
    }

    // asking the cache
    return NodeReadAccessCasterInEditor.runReadTransparentAction(
        new Computable<SNode>() {
          @Override
          public SNode compute() {
            Pair<Boolean, SNode> answer = getCoerceCacheAnswer(subtype, pattern, isWeak);
            if (answer != null && answer.o1) {
              return answer.o2;
            }
            CoercionMatcher coercionMatcher = new CoercionMatcher(pattern);
            SNode result = searchInSuperTypes(subtype, coercionMatcher, isWeak);
            // writing to the cache
            SubtypingCache subtypingCache = myTypeChecker.getSubtypingCache();
            if (subtypingCache != null) {
              subtypingCache.cacheCoerce(subtype, pattern, result, isWeak);
            }
            return result;
          }
        });
  }
 public boolean match(SNode nodeToMatch) {
   {
     SNode nodeToMatch_rtu2iv_a0a = nodeToMatch;
     if (!(MetaAdapterFactory.getConcept(
             0xf3061a5392264cc5L,
             0xa443f952ceaf5816L,
             0x101de48bf9eL,
             "jetbrains.mps.baseLanguage.structure.ClassifierType")
         .equals(nodeToMatch_rtu2iv_a0a.getConcept()))) {
       return false;
     }
     {
       SNodeReference pointer = SNODE_POINTER_v5k8je_a0a0a0a0b0b0a0b0a0a0a0f;
       if (!(PatternUtil.matchReferentWithNode(
           pointer,
           nodeToMatch_rtu2iv_a0a.getReferenceTarget(
               MetaAdapterFactory.getReferenceLink(
                   0xf3061a5392264cc5L,
                   0xa443f952ceaf5816L,
                   0x101de48bf9eL,
                   0x101de490babL,
                   "classifier"))))) {
         return false;
       }
     }
   }
   return true;
 }
示例#5
0
 private static void checkModelNodes(@NotNull SModel model, @NotNull final List<String> result) {
   for (final SNode node : SNodeUtil.getDescendants(model)) {
     final SConcept concept = node.getConcept();
     if (concept == null) {
       result.add("unknown concept of node: " + SNodeUtil.getDebugText(node));
       continue;
     }
     for (String name : node.getPropertyNames()) {
       if (concept.getProperty(name) == null) {
         result.add("unknown property: `" + name + "' in node " + SNodeUtil.getDebugText(node));
       }
     }
     for (SReference ref : node.getReferences()) {
       SAbstractLink link = concept.getLink(ref.getRole());
       if (link == null || !(link.isReference())) {
         result.add(
             "unknown link role: `" + ref.getRole() + "' in node " + SNodeUtil.getDebugText(node));
       }
     }
     for (SNode child : node.getChildren()) {
       String role = child.getRoleInParent();
       SAbstractLink link = concept.getLink(role);
       if (link == null || link.isReference()) {
         result.add("unknown child role: `" + role + "' in node " + SNodeUtil.getDebugText(node));
       }
     }
   }
 }
 public boolean match(SNode nodeToMatch) {
   {
     SNode nodeToMatch_nlist_subtypeOf_list_of_nodes_3tjcdg_a0a_0;
     nodeToMatch_nlist_subtypeOf_list_of_nodes_3tjcdg_a0a_0 = nodeToMatch;
     if (!("jetbrains.mps.baseLanguage.collections.structure.ListType"
         .equals(
             nodeToMatch_nlist_subtypeOf_list_of_nodes_3tjcdg_a0a_0
                 .getConcept()
                 .getConceptId()))) {
       return false;
     }
     {
       String childRole_nlist_subtypeOf_list_of_nodes_3tjcdg_ = "elementType";
       if (!(PatternUtil.hasNChildren(
           nodeToMatch_nlist_subtypeOf_list_of_nodes_3tjcdg_a0a_0,
           childRole_nlist_subtypeOf_list_of_nodes_3tjcdg_,
           1))) {
         return false;
       }
       {
         SNode childVar_nlist_subtypeOf_list_of_nodes_3tjcdg_a0a0 =
             IterableUtil.get(
                 nodeToMatch_nlist_subtypeOf_list_of_nodes_3tjcdg_a0a_0.getChildren(
                     childRole_nlist_subtypeOf_list_of_nodes_3tjcdg_),
                 0);
         this.patternVar_ELEMENT = childVar_nlist_subtypeOf_list_of_nodes_3tjcdg_a0a0;
       }
     }
   }
   return true;
 }
示例#7
0
 @NotNull
 public TextGenDescriptor getTextGenDescriptor(@Nullable SNode node) {
   if (node == null) {
     return new DefaultTextGenDescriptor();
   }
   return getTextGenDescriptor(node.getConcept());
 }
示例#8
0
 public BehaviorDescriptor getBehaviorDescriptorForInstanceNode(@Nullable SNode node) {
   if (node == null) {
     return NullSafeIllegalBehaviorDescriptor.INSTANCE;
   } else {
     return getBehaviorDescriptor(node.getConcept().getQualifiedName());
   }
 }
 @Override
 public void propertyNameRead(SNode node, String propertyName, SNodeReference propertyPointer) {
   storeAndCheckConsistency(
       myPropertyNamesToPointers,
       MultiTuple.<String, String>from(node.getConcept().getConceptId(), propertyName),
       propertyPointer);
 }
示例#10
0
 /** this method doesn't expect root to be added twice to the same map (to keep impl simple) */
 public void add(SNode root) {
   String conceptFqName = root.getConcept().getQualifiedName();
   ArrayList<SNode> set = myNodes.get(conceptFqName);
   if (set == null) {
     myNodes.put(conceptFqName, set = new ArrayList<SNode>());
   }
   set.add(root);
 }
示例#11
0
 private static StringBuilder checkModel(final SModel sm) {
   StringBuilder errorMessages = new StringBuilder();
   List<String> validationResult =
       ModelAccess.instance()
           .runReadAction(
               new Computable<List<String>>() {
                 public List<String> compute() {
                   return new ModelValidator(sm).validate();
                 }
               });
   if (!(validationResult.isEmpty())) {
     errorMessages.append("errors in model: ").append(sm.getReference().toString()).append("\n");
     for (String item : validationResult) {
       errorMessages.append("\t");
       errorMessages.append(item);
       errorMessages.append("\n");
     }
   }
   for (SNode node : SNodeUtil.getDescendants(sm)) {
     // Testbench.LOG.debug("Checking node " + node);
     if (SModelUtil.findConceptDeclaration(node.getConcept().getQualifiedName()) == null) {
       errorMessages.append("Unknown concept ");
       errorMessages.append(node.getConcept().getQualifiedName());
       errorMessages.append("\n");
     }
   }
   for (SNode node : SNodeUtil.getDescendants(sm)) {
     for (SReference ref : node.getReferences()) {
       if (jetbrains.mps.smodel.SNodeUtil.hasReferenceMacro(node, ref.getRole())) {
         continue;
       }
       if (SNodeOperations.getTargetNodeSilently(ref) == null) {
         errorMessages
             .append("Broken reference in model {")
             .append(SNodeOperations.getModelLongName(node.getModel()))
             .append("}")
             .append(" node ")
             .append(node.getNodeId().toString())
             .append("(")
             .append(node)
             .append(")\n");
       }
     }
   }
   return errorMessages;
 }
 public IsApplicableStatus isApplicableSupertypeAndPattern(SNode node) {
   {
     boolean b =
         SModelUtil_new.isAssignableConcept(
             node.getConcept().getConceptId(), this.getApplicableSupertypeConceptFQName());
     return new IsApplicableStatus(b, null);
   }
 }
 public IsApplicableStatus isApplicableAndPattern(SNode argument) {
   {
     boolean b =
         SModelUtil_new.isAssignableConcept(
             argument.getConcept().getConceptId(), this.getApplicableConceptFQName());
     return new IsApplicableStatus(b, null);
   }
 }
 public TemplateSwitchMappingInterpreted(SNode aSwitch) {
   mySwitch = aSwitch;
   rules = new ArrayList<TemplateReductionRule>();
   for (SNode child : mySwitch.getChildren()) {
     String conceptName = child.getConcept().getQualifiedName();
     if (conceptName.equals(RuleUtil.concept_Reduction_MappingRule)) {
       rules.add(new TemplateReductionRuleInterpreted(child));
     }
   }
 }
示例#15
0
 /**
  * @deprecated there's code generated with MPS 3.2 that instantiates this context
  * @since 3.1
  */
 @Deprecated
 @ToRemove(version = 3.3)
 public ReferenceMacroContext(
     @NotNull TemplateContext context,
     SNode outputNode,
     @NotNull SNodeReference macroNode,
     @NotNull String role) {
   super(context, macroNode);
   myOutputNode = outputNode;
   myRole = ((ConceptMetaInfoConverter) outputNode.getConcept()).convertAssociation(role);
 }
示例#16
0
 @Override
 public void conceptRead(
     SNode node,
     SNodeReference conceptPointer,
     StaticScope conceptScope,
     ConceptKind conceptKind) {
   String name = node.getConcept().getConceptId();
   storeAndCheckConsistency(myConceptsToPointers, name, conceptPointer);
   storeAndCheckConsistency(myConceptScope, name, conceptScope);
   storeAndCheckConsistency(myConceptKind, name, conceptKind);
 }
示例#17
0
 public boolean match(SNode nodeToMatch) {
   {
     SNode nodeToMatch_7fbm30_a1a0a0 = nodeToMatch;
     if (!("jetbrains.mps.baseLanguage.structure.NotEqualsExpression"
         .equals(nodeToMatch_7fbm30_a1a0a0.getConcept().getQualifiedName()))) {
       return false;
     }
     {
       String childRole_7fbm30__2 = "leftExpression";
       if (!(PatternUtil.hasNChildren(nodeToMatch_7fbm30_a1a0a0, childRole_7fbm30__2, 1))) {
         return false;
       }
       {
         SNode childVar_7fbm30_a0b0a0a =
             IterableUtil.get(nodeToMatch_7fbm30_a1a0a0.getChildren(childRole_7fbm30__2), 0);
         {
           SNode nodeToMatch_7fbm30_a0b0a0a = childVar_7fbm30_a0b0a0a;
           if (!("jetbrains.mps.baseLanguage.structure.NullLiteral"
               .equals(nodeToMatch_7fbm30_a0b0a0a.getConcept().getQualifiedName()))) {
             return false;
           }
         }
       }
     }
     {
       String childRole_7fbm30__3 = "rightExpression";
       if (!(PatternUtil.hasNChildren(nodeToMatch_7fbm30_a1a0a0, childRole_7fbm30__3, 1))) {
         return false;
       }
       {
         SNode childVar_7fbm30_a0b0a0a_0 =
             IterableUtil.get(nodeToMatch_7fbm30_a1a0a0.getChildren(childRole_7fbm30__3), 0);
         {
           SNode nodeToMatch_7fbm30_a0b0a0a_0 = childVar_7fbm30_a0b0a0a_0;
           patternVar_p = nodeToMatch_7fbm30_a0b0a0a_0;
         }
       }
     }
   }
   return true;
 }
 @Deprecated
 private static boolean staticCanBeAChild_Old(
     SNode node,
     SNode parentNode,
     SNode link,
     SNode childConcept,
     final IOperationContext operationContext) {
   SNode pnode =
       (SNodeOperations.isInstanceOf(
               parentNode,
               MetaAdapterFactory.getConcept(
                   0xcf935df46994e9cL,
                   0xa132fa109541cba3L,
                   0x14d3fb6fb843ebddL,
                   "jetbrains.mps.build.mps.structure.BuildMps_Group"))
           ? SNodeOperations.getParent(parentNode)
           : parentNode);
   return SNodeOperations.isInstanceOf(
               pnode,
               MetaAdapterFactory.getConcept(
                   0x798100da4f0a421aL,
                   0xb99171f8c50ce5d2L,
                   0x4df58c6f18f84a13L,
                   "jetbrains.mps.build.structure.BuildProject"))
           && ListSequence.fromList(
                   SLinkOperations.getChildren(
                       SNodeOperations.cast(
                           pnode,
                           MetaAdapterFactory.getConcept(
                               0x798100da4f0a421aL,
                               0xb99171f8c50ce5d2L,
                               0x4df58c6f18f84a13L,
                               "jetbrains.mps.build.structure.BuildProject")),
                       MetaAdapterFactory.getContainmentLink(
                           0x798100da4f0a421aL,
                           0xb99171f8c50ce5d2L,
                           0x4df58c6f18f84a13L,
                           0x5c3f3e2c1ce9ac70L,
                           "plugins")))
               .any(
                   new IWhereFilter<SNode>() {
                     public boolean accept(SNode it) {
                       return SNodeOperations.isInstanceOf(
                           it,
                           MetaAdapterFactory.getConcept(
                               0xcf935df46994e9cL,
                               0xa132fa109541cba3L,
                               0xc0bde9fc71699d9L,
                               "jetbrains.mps.build.mps.structure.BuildMPSPlugin"));
                     }
                   })
       || pnode.getConcept().getQualifiedName().startsWith("jetbrains.mps.lang.generator");
 }
 @Override
 public List<SubstituteAction> createActions() {
   SConcept concept = mySourceNode.getConcept();
   SLanguage primaryLanguage = concept.getLanguage();
   if (primaryLanguage == null) {
     LOG.error(
         "Couldn't build actions : couldn't get declaring language for concept "
             + concept.getName());
     return Collections.emptyList();
   }
   SReference reference = mySourceNode.getReference(myLink);
   return createActions(reference == null ? null : reference.getTargetNode());
 }
示例#20
0
 @Override
 public boolean isInUnorderedRole(SNode node) {
   SNode parent = node.getParent();
   if (parent == null) {
     return false;
   }
   Boolean b =
       MapSequence.fromMap(myChildLinkToUnordered)
           .get(
               MultiTuple.<String, String>from(
                   parent.getConcept().getQualifiedName(), node.getRoleInParent()));
   return b != null && b.booleanValue();
 }
示例#21
0
 private void removeOrCommentChildInSingleRole() {
   if (!(getContainmentLink().isMultiple())) {
     SNode firstChild =
         ListSequence.fromList(SNodeOperations.getChildren(getParent(), getContainmentLink()))
             .first();
     if ((firstChild != null)) {
       if (firstChild.getConcept().isAbstract()) {
         SNodeOperations.deleteNode(firstChild);
       } else {
         new NodeCommenter(firstChild).commentOut(false);
       }
     }
   }
 }
示例#22
0
 @Override
 public void breakdownToUnits(@NotNull TextGenModelOutline outline) {
   for (SNode root : outline.getModel().getRootNodes()) {
     if (root.getConcept()
         .equals(
             MetaAdapterFactory.getConcept(
                 0x58f98fef90ad4b72L,
                 0xa390fad66ec7005aL,
                 0x36fb0dc9fd3a2754L,
                 "jetbrains.mps.core.properties.structure.PropertiesFile"))) {
       String fname = getFileName_PropertiesFile(root);
       String ext = getFileExtension_PropertiesFile(root);
       outline.registerTextUnit((ext == null ? fname : (fname + '.' + ext)), root);
       continue;
     }
   }
 }
 public boolean match(SNode nodeToMatch) {
   {
     SNode nodeToMatch_nlist_subtypeOf_list_of_nodes_3tjcdg_a0a;
     nodeToMatch_nlist_subtypeOf_list_of_nodes_3tjcdg_a0a = nodeToMatch;
     if (!("jetbrains.mps.lang.smodel.structure.SNodeListType"
         .equals(
             nodeToMatch_nlist_subtypeOf_list_of_nodes_3tjcdg_a0a
                 .getConcept()
                 .getConceptId()))) {
       return false;
     }
     patternVar_CONCEPT =
         nodeToMatch_nlist_subtypeOf_list_of_nodes_3tjcdg_a0a.getReferenceTarget(
             "elementConcept");
   }
   return true;
 }
 public boolean match(SNode nodeToMatch) {
   {
     SNode nodeToMatch_khpv0q_a0a = nodeToMatch;
     if (!("jetbrains.mps.baseLanguage.structure.ClassifierType"
         .equals(nodeToMatch_khpv0q_a0a.getConcept().getQualifiedName()))) {
       return false;
     }
     {
       SNodeReference pointer = SNODE_POINTER_fggx2c_a0a0a0a0b0b0a0a0a0a0a0e;
       if (!(PatternUtil.matchReferentWithNode(
           pointer, nodeToMatch_khpv0q_a0a.getReferenceTarget("classifier")))) {
         return false;
       }
     }
   }
   return true;
 }
示例#25
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;
 }
 public boolean match(SNode nodeToMatch) {
   {
     SNode nodeToMatch_6isygg_a0a0a0 = nodeToMatch;
     if (!(MetaAdapterFactory.getConcept(
             0xf3061a5392264cc5L,
             0xa443f952ceaf5816L,
             0x101de48bf9eL,
             "jetbrains.mps.baseLanguage.structure.ClassifierType")
         .equals(nodeToMatch_6isygg_a0a0a0.getConcept()))) {
       return false;
     }
     {
       SNodeReference pointer = SNODE_POINTER_w1n2qe_a0a0a0a0b0b0a0b0a0a0a0c7;
       if (!(PatternUtil.matchReferentWithNode(
           pointer,
           nodeToMatch_6isygg_a0a0a0.getReferenceTarget(
               MetaAdapterFactory.getReferenceLink(
                   0xf3061a5392264cc5L,
                   0xa443f952ceaf5816L,
                   0x101de48bf9eL,
                   0x101de490babL,
                   "classifier"))))) {
         return false;
       }
     }
     {
       SContainmentLink childRole_6isygg_ =
           MetaAdapterFactory.getContainmentLink(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0x101de48bf9eL,
               0x102419671abL,
               "parameter");
       if (!(PatternUtil.hasNChildren(nodeToMatch_6isygg_a0a0a0, childRole_6isygg_, 1))) {
         return false;
       }
       {
         SNode childVar_6isygg_a0a0a0a =
             IterableUtil.get(nodeToMatch_6isygg_a0a0a0.getChildren(childRole_6isygg_), 0);
         this.patternVar_elem = childVar_6isygg_a0a0a0a;
       }
     }
   }
   return true;
 }
 public boolean match(SNode nodeToMatch) {
   {
     SNode nodeToMatch_twopzc_a0a = nodeToMatch;
     if (!("jetbrains.mps.baseLanguage.collections.structure.SetType"
         .equals(nodeToMatch_twopzc_a0a.getConcept().getQualifiedName()))) {
       return false;
     }
     {
       String childRole_twopzc_ = "elementType";
       if (!(PatternUtil.hasNChildren(nodeToMatch_twopzc_a0a, childRole_twopzc_, 1))) {
         return false;
       }
       {
         SNode childVar_twopzc_a0a0 =
             IterableUtil.get(nodeToMatch_twopzc_a0a.getChildren(childRole_twopzc_), 0);
         this.patternVar_elementType = childVar_twopzc_a0a0;
       }
     }
   }
   return true;
 }
 private List<SubstituteAction> createActions(SNode targetNode) {
   final SAbstractConcept referentConcept = myLink.getTargetConcept();
   if (referentConcept == null) {
     return Collections.emptyList();
   }
   // todo use myLink.getScope
   // Iterable<SNode> nodes = myLink.getScope(mySourceNode).getAvailableElements(null);
   Iterable<SNode> nodes =
       ModelConstraints.getReferenceDescriptor(mySourceNode, myLink)
           .getScope()
           .getAvailableElements(null);
   List<SubstituteAction> actions = new ArrayList<SubstituteAction>();
   for (SNode node : nodes) {
     if (node == null) {
       continue;
     }
     assert node.getConcept().isSubConceptOf(referentConcept);
     actions.add(new DefaultSReferenceSubstituteAction(node, mySourceNode, targetNode, myLink));
   }
   return actions;
 }
示例#29
0
 protected void addNodeImports(SNode node) {
   final SModelInternal modelInternal = (SModelInternal) myModel;
   final AbstractModule module = ((AbstractModule) myModel.getModule());
   final Collection<SLanguage> importedLanguages = modelInternal.importedLanguageIds();
   for (SNode subNode :
       ListSequence.fromList(
           SNodeOperations.getNodeDescendants(node, null, true, new SAbstractConcept[] {}))) {
     SLanguage usedLanguage = subNode.getConcept().getLanguage();
     if (!(importedLanguages.contains(usedLanguage))) {
       modelInternal.addLanguage(usedLanguage);
     }
     for (SReference ref : ListSequence.fromList(SNodeOperations.getReferences(subNode))) {
       SModel usedModel = SNodeOperations.getModel(SLinkOperations.getTargetNode(ref));
       if (usedModel != null && !(modelInternal.importedModels().contains(usedModel))) {
         modelInternal.addModelImport(usedModel.getReference(), false);
         module.addDependency(
             SNodeOperations.getModel(SLinkOperations.getTargetNode(ref))
                 .getModule()
                 .getModuleReference(),
             false);
       }
     }
   }
 }
 public IsApplicableStatus isApplicableAndPattern(SNode argument) {
   return new IsApplicableStatus(
       argument.getConcept().isSubConceptOf(getApplicableConcept()), null);
 }