コード例 #1
0
  @Override
  public EList<Model> execute(EList<Model> actualParameters) throws Exception {

    EList<Model> result = super.execute(actualParameters);
    KleisliBinaryModelRel kTraceModelRel = (KleisliBinaryModelRel) result.get(1);
    Model modelPivot = kTraceModelRel.getSourceModel();
    kTraceModelRel.setSourceModel(kTraceModelRel.getTargetModel());
    kTraceModelRel.setTargetModel(modelPivot);
    kTraceModelRel.getModelEndpoints().move(1, 0);
    kTraceModelRel.getModelEndpointRefs().move(1, 0);
    for (Link kLink : kTraceModelRel.getLinks()) {
      kLink.getModelElemEndpoints().move(1, 0);
      kLink.getModelElemEndpointRefs().move(1, 0);
    }
    for (LinkReference kLinkRef : kTraceModelRel.getLinkRefs()) {
      kLinkRef.getModelElemEndpointRefs().move(1, 0);
      ModelElementReference modelElemRefPivot =
          ((BinaryLinkReference) kLinkRef).getSourceModelElemRef();
      ((BinaryLinkReference) kLinkRef)
          .setSourceModelElemRef(((BinaryLinkReference) kLinkRef).getTargetModelElemRef());
      ((BinaryLinkReference) kLinkRef).setTargetModelElemRef(modelElemRefPivot);
    }

    return result;
  }
コード例 #2
0
  /** {@inheritDoc} */
  @Override
  public Object[] getChildren(Object parentElement) {

    if (parentElement instanceof ModelRel) {
      List<LinkReference> linkTypeRefs = new ArrayList<LinkReference>();
      for (LinkReference linkTypeRef : ((ModelRel) parentElement).getLinkRefs()) {
        if (allowedLinkTypeUris == null || allowedLinkTypeUris.contains(linkTypeRef.getUri())) {
          linkTypeRefs.add(linkTypeRef);
        }
      }
      return linkTypeRefs.toArray();
    }

    return new Object[] {};
  }