Package eu.admire.dispel.references

Examples of eu.admire.dispel.references.IdentifierReference


    //    System.out.println("SRT:  " + src +"  -> DST: "+ dst );

    if (dst instanceof IdentifierReference
        && src instanceof IdentifierReference) {

      IdentifierReference dst_i = (IdentifierReference) dst;
      IdentifierReference src_i = (IdentifierReference) src;

      if (src_i.getNext() instanceof IdentifierReference
          && dst_i.getNext() instanceof IdentifierReference) {

        IdentifierReference src_n = (IdentifierReference) src_i
            .getNext();

        IdentifierReference dst_n = (IdentifierReference) dst_i
            .getNext();

        if (src_n.getTarget() instanceof ProcessingElementParameter
            && dst_n.getTarget() instanceof ProcessingElementParameter)
          result.add(new DispelLinkDescriptor(
              ((ProcessingElementParameter) src_n.getTarget()),
              ((ProcessingElementParameter) dst_n.getTarget()),
              link, DispelElementTypes.ConnectionExpression_4001,
              ConnectionExpressionEditPart.VISUAL_ID));

      }

      /* PE2.out => var  */

      if (src_i.getNext() instanceof IdentifierReference
          && dst_i.getNext() == null) {

        IdentifierReference src_n = (IdentifierReference) src_i
            .getNext();

        if (src_n.getTarget() instanceof ProcessingElementParameter
            && dst_i.getTarget() instanceof LocalVariable)
          result.add(new DispelLinkDescriptor(
              ((ProcessingElementParameter) src_n.getTarget()),
              (LocalVariable) dst_i.getTarget(), link,
              DispelElementTypes.ConnectionExpression_4001,
              ConnectionExpressionEditPart.VISUAL_ID));
      }

      /* var  => PE2.in  */

      if (dst_i.getNext() instanceof IdentifierReference
          && src_i.getNext() == null) {

        IdentifierReference dst_n = (IdentifierReference) dst_i
            .getNext();

        if (dst_n.getTarget() instanceof ProcessingElementParameter
            && src_i.getTarget() instanceof LocalVariable)
          result.add(new DispelLinkDescriptor(((LocalVariable) src_i
              .getTarget()), (ProcessingElementParameter) dst_n
              .getTarget(), link,
              DispelElementTypes.ConnectionExpression_4001,
              ConnectionExpressionEditPart.VISUAL_ID));
      }

    }

    if (src instanceof ConnectionInitialization
        && dst instanceof IdentifierReference) {

      IdentifierReference dst_i = (IdentifierReference) dst;
      ConnectionInitialization src_i = (ConnectionInitialization) src;

      /* |- X -| => PE2.in */

      if (src_i.getConnectionElement() instanceof IdentifierReference
          && dst_i.getNext() != null
          && dst_i.getNext() instanceof IdentifierReference) {

        IdentifierReference ir = (IdentifierReference) src_i
            .getConnectionElement();
        IdentifierReference dst_n = (IdentifierReference) dst_i
            .getNext();

        if (dst_n.getTarget() instanceof ProcessingElementParameter
            && ir.getTarget() instanceof LocalVariable) {

          result.add(new DispelLinkDescriptor(((LocalVariable) ir
              .getTarget()), ((ProcessingElementParameter) dst_n
              .getTarget()), link,
              DispelElementTypes.ConnectionExpression_4001,
              ConnectionExpressionEditPart.VISUAL_ID));

        }
      }

      /* |- 100 -| => PE2.in */

      if (src_i.getConnectionElement() instanceof Literal
          && dst_i.getNext() != null
          && dst_i.getNext() instanceof IdentifierReference) {

        IdentifierReference dst_n = (IdentifierReference) dst_i
            .getNext();

        if (dst_n.getTarget() instanceof ProcessingElementParameter) {

          result.add(new DispelLinkDescriptor(src,
              ((ProcessingElementParameter) dst_n.getTarget()),
              link, DispelElementTypes.ConnectionExpression_4001,
              ConnectionExpressionEditPart.VISUAL_ID));

        }
      }

      /* |- "A" -| => PE2.in */

      if (src_i.getConnectionElement() instanceof StringReference
          && dst_i.getNext() != null
          && dst_i.getNext() instanceof IdentifierReference) {

        IdentifierReference dst_n = (IdentifierReference) dst_i
            .getNext();

        if (dst_n.getTarget() instanceof ProcessingElementParameter) {

          result.add(new DispelLinkDescriptor(src,
              ((ProcessingElementParameter) dst_n.getTarget()),
              link, DispelElementTypes.ConnectionExpression_4001,
              ConnectionExpressionEditPart.VISUAL_ID));

        }
      }

      /* |- ["A","B"] -| => PE2.in */

      if (src_i.getConnectionElement() instanceof ArrayInitializationByElements
          && dst_i.getNext() != null
          && dst_i.getNext() instanceof IdentifierReference) {

        IdentifierReference dst_n = (IdentifierReference) dst_i
            .getNext();

        if (dst_n.getTarget() instanceof ProcessingElementParameter) {

          result.add(new DispelLinkDescriptor(src,
              ((ProcessingElementParameter) dst_n.getTarget()),
              link, DispelElementTypes.ConnectionExpression_4001,
              ConnectionExpressionEditPart.VISUAL_ID));

        }
      }
View Full Code Here


    ConnectionStatement cs =
        StatementsFactory.eINSTANCE.createConnectionStatement();
    ConnectionExpression ce =
        ExpressionsFactory.eINSTANCE.createConnectionExpression();
   
    IdentifierReference outVarRef =
        ReferencesFactory.eINSTANCE.createIdentifierReference();
    IdentifierReference outRef =
        ReferencesFactory.eINSTANCE.createIdentifierReference();
    outVarRef.setTarget(sourceVariable);
    outRef.setTarget(sourceOutput);
    outVarRef.setNext(outRef);
   
    cs.setExpression(ce);
    ce.setChild(outVarRef);
    ce.setConnectionOperator(OperatorsFactory.eINSTANCE.createConnector());
   
    IdentifierReference variableRef =
        ReferencesFactory.eINSTANCE.createIdentifierReference();
    IdentifierReference inputRef =
        ReferencesFactory.eINSTANCE.createIdentifierReference();
   
    variableRef.setTarget(targetVariable);
    inputRef.setTarget(targetInput);
    variableRef.setNext(inputRef);
   
    ce.setValue(variableRef);

    //Add statement to model
View Full Code Here

    ConnectionStatement cs =
        StatementsFactory.eINSTANCE.createConnectionStatement();
    ConnectionExpression ce =
        ExpressionsFactory.eINSTANCE.createConnectionExpression();
   
    IdentifierReference sourceVar =
        ReferencesFactory.eINSTANCE.createIdentifierReference();
    sourceVar.setTarget(source.getVariable());
    cs.setExpression(ce);
    ce.setChild(sourceVar);
    ce.setConnectionOperator(OperatorsFactory.eINSTANCE.createConnector());
   
    IdentifierReference variableRef =
        ReferencesFactory.eINSTANCE.createIdentifierReference();
    IdentifierReference inputRef =
        ReferencesFactory.eINSTANCE.createIdentifierReference();
   
    variableRef.setTarget(targetVariable);
    inputRef.setTarget(targetInput);
    variableRef.setNext(inputRef);
   
    ce.setValue(variableRef);

    //Add statement to model
View Full Code Here

        .getObjectsByType(res.getAllContents(),
            StatementsPackage.eINSTANCE.getSubmitStatement());

    if (submits.size() == 0) {

      IdentifierReference r = ReferencesFactory.eINSTANCE
          .createIdentifierReference();
      r.setTarget(lvs.getVariable());
      SubmitStatement s = StatementsFactory.eINSTANCE.
          createSubmitStatement();
      s.getReference().add(r);
      pck.getStatements().add(s);
   
View Full Code Here

    EObject proxy = (EObject) nsClassifierReference
      .getClassifierReferences().get(0).eGet(TypesPackage.Literals.CLASSIFIER_REFERENCE__TARGET, false);
   
    EReference targetReference = ReferencesPackage.Literals.ELEMENT_REFERENCE__TARGET;
   
    IdentifierReference mainIdReference = ReferencesFactory.eINSTANCE.createIdentifierReference();
   
    mainIdReference.eSet(
        targetReference, proxy);
    String id = ((InternalEObject)proxy).eProxyURI().fragment();
    id = id.substring("EMFTEXT_INTERNAL_URI_FRAGMENT_".length());
    id = id.substring(id.indexOf("_") + 1);
   
    registerContextDependentProxy(resource, mainIdReference,
        targetReference, id, proxy);
   
    IdentifierReference rootIdRef = mainIdReference;
    IdentifierReference prevIdRef = null;
   
    //namespace needs to be converted into reference chain
    for(String nsPart : nsClassifierReference.getNamespaces()) {
      IdentifierReference idRef = ReferencesFactory.eINSTANCE.createIdentifierReference();
      InternalEObject newProxy = (InternalEObject) EcoreUtil.copy(proxy);
     
      String newFragment = newProxy.eProxyURI().fragment();
      newFragment = newFragment.substring(0,newFragment.indexOf("_") + 1) + nsPart;
     
      URI newURI = newProxy.eProxyURI().trimFragment().appendFragment(newFragment);
      newProxy.eSetProxyURI(newURI);
     
      idRef.setTarget((ReferenceableElement) newProxy);
     
      registerContextDependentProxy(resource,
          idRef,
          targetReference,
          nsPart,
View Full Code Here

    EObject container;

    if (getSource() instanceof Output && getTarget() instanceof Input) {

      IdentifierReference src1 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      IdentifierReference src2 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      src1.setNext(src2);

      src2.setTarget((Output) getSource());

      Output out = (Output) getSource();

      fnc = out.getContainingMethod();

      container = out.eContainer();

      if (container instanceof ProcessingElementInstance) {

        ProcessingElementInstance pei = (ProcessingElementInstance) container;

        Collection<LocalVariable> variables = DispelEObjectUtil
            .getObjectsByType(fnc.eAllContents(),
                VariablesPackage.eINSTANCE.getLocalVariable());

        for (LocalVariable var : variables) {

          if (var.getValue() != null && var.getValue().equals(pei)) {

            src1.setTarget(var);
          }
        }

      }

      /*******************************/

      IdentifierReference dst1 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      IdentifierReference dst2 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      dst1.setNext(dst2);

      dst2.setTarget((Input) getTarget());

      Input in = (Input) getTarget();

      container = in.eContainer();

      if (container instanceof ProcessingElementInstance) {

        ProcessingElementInstance pei = (ProcessingElementInstance) container;

        Collection<LocalVariable> variables = DispelEObjectUtil
            .getObjectsByType(fnc.eAllContents(),
                VariablesPackage.eINSTANCE.getLocalVariable());

        for (LocalVariable var : variables) {

          if (var.getValue() != null && var.getValue().equals(pei)) {

            dst1.setTarget(var);
          }
        }

      }

      newElement.setChild(src1);
      newElement.setValue(dst1);

    }

    //TODO iFO following might be buggy!   

    if (getSource() instanceof ConnectionInitialization
        && getTarget() instanceof Input) {

      IdentifierReference dst1 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      IdentifierReference dst2 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      dst1.setNext(dst2);

      dst2.setTarget((Input) getTarget());

      Input in = (Input) getTarget();

      fnc = in.getContainingMethod();

      container = in.eContainer();

      if (container instanceof ProcessingElementInstance) {

        ProcessingElementInstance pei = (ProcessingElementInstance) container;

        Collection<LocalVariable> variables = DispelEObjectUtil
            .getObjectsByType(fnc.eAllContents(),
                VariablesPackage.eINSTANCE.getLocalVariable());

        for (LocalVariable var : variables) {

          if (var.getValue() != null && var.getValue().equals(pei)) {

            dst1.setTarget(var);
          }
        }

      }

      newElement.setChild(getSource());
      newElement.setValue(dst1);
    }

    if (getSource() instanceof Output
        && getTarget() instanceof LocalVariable) {

      IdentifierReference src1 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      IdentifierReference src2 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      src1.setNext(src2);

      src2.setTarget((Output) getSource());

      Output out = (Output) getSource();

      fnc = out.getContainingMethod();

      container = out.eContainer();

      if (container instanceof ProcessingElementInstance) {

        ProcessingElementInstance pei = (ProcessingElementInstance) container;

        Collection<LocalVariable> variables = DispelEObjectUtil
            .getObjectsByType(fnc.eAllContents(),
                VariablesPackage.eINSTANCE.getLocalVariable());

        for (LocalVariable var : variables) {

          if (var.getValue() != null && var.getValue().equals(pei)) {

            src1.setTarget(var);
          }
        }
      }

      IdentifierReference dst1 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      dst1.setTarget((LocalVariable) getTarget());

      newElement.setChild(src1);
      newElement.setValue(dst1);

    }

    if (getSource() instanceof LocalVariable
        && getTarget() instanceof Input) {

      IdentifierReference dst1 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      IdentifierReference dst2 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      dst1.setNext(dst2);

      dst2.setTarget((Input) getTarget());

      Input in = (Input) getTarget();

      container = in.eContainer();

      if (container instanceof ProcessingElementInstance) {

        ProcessingElementInstance pei = (ProcessingElementInstance) container;

        LocalVariable inVar = (LocalVariable) getSource();
        fnc = inVar.getContainingMethod();

        Collection<LocalVariable> variables = DispelEObjectUtil
            .getObjectsByType(fnc.eAllContents(),
                VariablesPackage.eINSTANCE.getLocalVariable());

        for (LocalVariable var : variables) {

          if (var.getValue() != null && var.getValue().equals(pei)) {

            dst1.setTarget(var);
          }
        }

      }

      ConnectionInitialization src = InstantiationsFactory.eINSTANCE
          .createConnectionInitialization();

      IdentifierReference ir = ReferencesFactory.eINSTANCE
          .createIdentifierReference();
      ir.setTarget((LocalVariable) getSource());

      src.setInitialValue(ir);

      newElement.setChild(src);
      newElement.setValue(dst1);
View Full Code Here

    for (ConnectionExpression exp : expressions) {
     
   
      if (exp.getChild() instanceof IdentifierReference) {

        IdentifierReference ref = (IdentifierReference) exp.getChild();

        if (ref.getNext() instanceof IdentifierReference) {

          IdentifierReference ref2 = (IdentifierReference) ref
              .getNext();

         
          if (ref2.getTarget() instanceof NamedElement) {

            NamedElement el = (NamedElement) ref2.getTarget();

            String name = el.getName();

            LocalVariable var = (LocalVariable) ref.getTarget();

            if (var.getValue() instanceof ProcessingElementInstance) {

              ProcessingElementInstance inst = (ProcessingElementInstance) var
                  .getValue();

              if (inst != null) {

                for (ProcessingElementParameter pp : inst
                    .getProcessingElementParameters()) {

                  if (pp.getName().equals(name)
                      && pp instanceof Output) {

                    ref2.setTarget(pp);
                  }
                }
              }
            }
          }
        }
      }
         
     
   
      if (exp.getValue() instanceof IdentifierReference) {

        IdentifierReference ref = (IdentifierReference) exp.getValue();

        if (ref.getNext() instanceof IdentifierReference) {

          IdentifierReference ref2 = (IdentifierReference) ref
              .getNext();
         
          if (ref2.getTarget() instanceof NamedElement) {

            NamedElement el = (NamedElement) ref2.getTarget();

            String name = el.getName();

            LocalVariable var = (LocalVariable) ref.getTarget();

            if (var.getValue() instanceof ProcessingElementInstance) {

              ProcessingElementInstance inst = (ProcessingElementInstance) var
                  .getValue();

              if (inst != null) {

                for (ProcessingElementParameter pp : inst
                    .getProcessingElementParameters()) {

                  if (pp.getName().equals(name)
                      && pp instanceof Input) {

                    ref2.setTarget(pp);
                  }
                }
              }
            }
          }
View Full Code Here

      if (ref1.getTarget() instanceof LocalVariable
          && ref1.getNext() instanceof IdentifierReference) {

        LocalVariable var = (LocalVariable) ref1.getTarget();

        IdentifierReference ref2 = (IdentifierReference) ref1.getNext();

        if (ref2.getTarget() instanceof ProcessingElementParameter) {

          ProcessingElementParameter par = (ProcessingElementParameter) ref2
              .getTarget();

          String parameterName = par.getName();

          if (var.getValue() instanceof ProcessingElementInstance) {

            ProcessingElementInstance peiIn = (ProcessingElementInstance) var
                .getValue();

            if (peiIn != null) {

              boolean isThere = false;

              for (ProcessingElementParameter param : peiIn
                  .getProcessingElementParameters()) {
                // TODO
                if (param.getName().equals(parameterName)) {

                  ref2.setTarget(param);
                  isThere = true;
                }

              }

              if (!isThere) {

                ref2.setTarget(null);
              }

            }

          }
View Full Code Here

    //    System.out.println("SRT:  " + src +"  -> DST: "+ dst );

    if (dst instanceof IdentifierReference
        && src instanceof IdentifierReference) {

      IdentifierReference dst_i = (IdentifierReference) dst;
      IdentifierReference src_i = (IdentifierReference) src;

      if (src_i.getNext() instanceof IdentifierReference
          && dst_i.getNext() instanceof IdentifierReference) {

        IdentifierReference src_n = (IdentifierReference) src_i
            .getNext();

        IdentifierReference dst_n = (IdentifierReference) dst_i
            .getNext();

        if (src_n.getTarget() instanceof Output
            && dst_n.getTarget() instanceof Input) {
          result.add(new DispelLinkDescriptor(((Output) src_n
              .getTarget()), ((Input) dst_n.getTarget()), link,
              DispelElementTypes.ConnectionExpression_4001,
              ConnectionExpressionEditPart.VISUAL_ID));
        }

      }

      /* PE2.out => var  */

      if (src_i.getNext() instanceof IdentifierReference
          && dst_i.getNext() == null) {

        IdentifierReference src_n = (IdentifierReference) src_i
            .getNext();

        if (src_n.getTarget() instanceof ProcessingElementParameter
            && dst_i.getTarget() instanceof LocalVariable)
          result.add(new DispelLinkDescriptor(
              ((ProcessingElementParameter) src_n.getTarget()),
              (LocalVariable) dst_i.getTarget(), link,
              DispelElementTypes.ConnectionExpression_4001,
              ConnectionExpressionEditPart.VISUAL_ID));
      }

      /* var  => PE2.in  */

      if (dst_i.getNext() instanceof IdentifierReference
          && src_i.getNext() == null) {

        IdentifierReference dst_n = (IdentifierReference) dst_i
            .getNext();

        if (dst_n.getTarget() instanceof ProcessingElementParameter
            && src_i.getTarget() instanceof LocalVariable)
          result.add(new DispelLinkDescriptor(((LocalVariable) src_i
              .getTarget()), (ProcessingElementParameter) dst_n
              .getTarget(), link,
              DispelElementTypes.ConnectionExpression_4001,
              ConnectionExpressionEditPart.VISUAL_ID));
      }

    }

    if (src instanceof ConnectionInitialization
        && dst instanceof IdentifierReference) {

      IdentifierReference dst_i = (IdentifierReference) dst;
      ConnectionInitialization src_i = (ConnectionInitialization) src;

      /* |- X -| => PE2.in */

      if (src_i.getConnectionElement() instanceof IdentifierReference
          && dst_i.getNext() != null
          && dst_i.getNext() instanceof IdentifierReference) {

        IdentifierReference ir = (IdentifierReference) src_i
            .getConnectionElement();
        IdentifierReference dst_n = (IdentifierReference) dst_i
            .getNext();

        if (dst_n.getTarget() instanceof ProcessingElementParameter
            && ir.getTarget() instanceof LocalVariable) {

          result.add(new DispelLinkDescriptor(((LocalVariable) ir
              .getTarget()), ((ProcessingElementParameter) dst_n
              .getTarget()), link,
              DispelElementTypes.ConnectionExpression_4001,
              ConnectionExpressionEditPart.VISUAL_ID));

        }
      }

      /* |- 100 -| => PE2.in */

      if (src_i.getConnectionElement() instanceof Literal
          && dst_i.getNext() != null
          && dst_i.getNext() instanceof IdentifierReference) {

        IdentifierReference dst_n = (IdentifierReference) dst_i
            .getNext();

        if (dst_n.getTarget() instanceof ProcessingElementParameter) {

          result.add(new DispelLinkDescriptor(src,
              ((ProcessingElementParameter) dst_n.getTarget()),
              link, DispelElementTypes.ConnectionExpression_4001,
              ConnectionExpressionEditPart.VISUAL_ID));

        }
      }

      /* |- "A" -| => PE2.in */

      if (src_i.getConnectionElement() instanceof StringReference
          && dst_i.getNext() != null
          && dst_i.getNext() instanceof IdentifierReference) {

        IdentifierReference dst_n = (IdentifierReference) dst_i
            .getNext();

        if (dst_n.getTarget() instanceof ProcessingElementParameter) {

          result.add(new DispelLinkDescriptor(src,
              ((ProcessingElementParameter) dst_n.getTarget()),
              link, DispelElementTypes.ConnectionExpression_4001,
              ConnectionExpressionEditPart.VISUAL_ID));

        }
      }

      /* |- ["A","B"] -| => PE2.in */

      if (src_i.getConnectionElement() instanceof ArrayInitializationByElements
          && dst_i.getNext() != null
          && dst_i.getNext() instanceof IdentifierReference) {

        IdentifierReference dst_n = (IdentifierReference) dst_i
            .getNext();

        if (dst_n.getTarget() instanceof ProcessingElementParameter) {

          result.add(new DispelLinkDescriptor(src,
              ((ProcessingElementParameter) dst_n.getTarget()),
              link, DispelElementTypes.ConnectionExpression_4001,
              ConnectionExpressionEditPart.VISUAL_ID));

        }
      }
View Full Code Here

    EObject container;

    if (getSource() instanceof Output && getTarget() instanceof Input) {

      IdentifierReference src1 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      IdentifierReference src2 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      src1.setNext(src2);

      src2.setTarget((Output) getSource());

      Output out = (Output) getSource();

      container = out.eContainer();

      if (container instanceof ProcessingElementInstance) {

        ProcessingElementInstance pei = (ProcessingElementInstance) container;

        Collection<LocalVariable> variables = DispelEObjectUtil
            .getObjectsByType(pck.eAllContents(),
                VariablesPackage.eINSTANCE.getLocalVariable());

        for (LocalVariable var : variables) {

          if (var.getValue() != null && var.getValue().equals(pei)) {

            src1.setTarget(var);
          }
        }

      }

      /*******************************/

      IdentifierReference dst1 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      IdentifierReference dst2 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      dst1.setNext(dst2);

      dst2.setTarget((Input) getTarget());

      Input in = (Input) getTarget();

      container = in.eContainer();

      if (container instanceof ProcessingElementInstance) {

        ProcessingElementInstance pei = (ProcessingElementInstance) container;

        Collection<LocalVariable> variables = DispelEObjectUtil
            .getObjectsByType(pck.eAllContents(),
                VariablesPackage.eINSTANCE.getLocalVariable());

        for (LocalVariable var : variables) {

          if (var.getValue() != null && var.getValue().equals(pei)) {

            dst1.setTarget(var);
          }
        }

      }

      newElement.setChild(src1);
      newElement.setValue(dst1);

    }

    //TODO iFO following might be buggy!   

    if (getSource() instanceof ConnectionInitialization
        && getTarget() instanceof Input) {

      IdentifierReference dst1 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      IdentifierReference dst2 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      dst1.setNext(dst2);

      dst2.setTarget((Input) getTarget());

      Input in = (Input) getTarget();

      container = in.eContainer();

      if (container instanceof ProcessingElementInstance) {

        ProcessingElementInstance pei = (ProcessingElementInstance) container;

        Collection<LocalVariable> variables = DispelEObjectUtil
            .getObjectsByType(pck.eAllContents(),
                VariablesPackage.eINSTANCE.getLocalVariable());

        for (LocalVariable var : variables) {

          if (var.getValue() != null && var.getValue().equals(pei)) {

            dst1.setTarget(var);
          }
        }

      }

      newElement.setChild(getSource());
      newElement.setValue(dst1);
    }

    if (getSource() instanceof Output
        && getTarget() instanceof LocalVariable) {

      IdentifierReference src1 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      IdentifierReference src2 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      src1.setNext(src2);

      src2.setTarget((Output) getSource());

      Output out = (Output) getSource();

      container = out.eContainer();

      if (container instanceof ProcessingElementInstance) {

        ProcessingElementInstance pei = (ProcessingElementInstance) container;

        Collection<LocalVariable> variables = DispelEObjectUtil
            .getObjectsByType(pck.eAllContents(),
                VariablesPackage.eINSTANCE.getLocalVariable());

        for (LocalVariable var : variables) {

          if (var.getValue() != null && var.getValue().equals(pei)) {

            src1.setTarget(var);
          }
        }
      }

      IdentifierReference dst1 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      dst1.setTarget((LocalVariable) getTarget());

      newElement.setChild(src1);
      newElement.setValue(dst1);

    }

    if (getSource() instanceof LocalVariable
        && getTarget() instanceof Input) {

      IdentifierReference dst1 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      IdentifierReference dst2 = ReferencesFactory.eINSTANCE
          .createIdentifierReference();

      dst1.setNext(dst2);

      dst2.setTarget((Input) getTarget());

      Input in = (Input) getTarget();

      container = in.eContainer();

      if (container instanceof ProcessingElementInstance) {

        ProcessingElementInstance pei = (ProcessingElementInstance) container;

        LocalVariable inVar = (LocalVariable) getSource();
        pck = inVar.getContainingPackage();

        Collection<LocalVariable> variables = DispelEObjectUtil
            .getObjectsByType(pck.eAllContents(),
                VariablesPackage.eINSTANCE.getLocalVariable());

        for (LocalVariable var : variables) {

          if (var.getValue() != null && var.getValue().equals(pei)) {

            dst1.setTarget(var);
          }
        }

      }

      ConnectionInitialization src = InstantiationsFactory.eINSTANCE
          .createConnectionInitialization();

      IdentifierReference ir = ReferencesFactory.eINSTANCE
          .createIdentifierReference();
      ir.setTarget((LocalVariable) getSource());

      src.setInitialValue(ir);

      newElement.setChild(src);
      newElement.setValue(dst1);
View Full Code Here

TOP

Related Classes of eu.admire.dispel.references.IdentifierReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.