Exemplo n.º 1
0
 /**
  * "pick output <mapping label> for ( <input node> )"
  * GenerationContextOp_GetOutputByLabelAndInputAndReferenceScope
  */
 @Nullable
 public SNode getOutputNodeByInputNodeAndMappingLabelAndOutputNodeScope(
     SNode inputNode, String label) {
   List<SNode> outputNodes = this.getAllOutputNodesByInputNodeAndMappingLabel(inputNode, label);
   if (outputNodes == null) {
     return null;
   }
   final Scope scope = ModelConstraints.getReferenceDescriptor(getOutputNode(), myRole).getScope();
   for (SNode outputNode : outputNodes) {
     if (scope.contains(outputNode)) {
       return outputNode;
     }
   }
   return null;
 }
 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;
 }