コード例 #1
0
  private NonRootModelElement getDestination(NonRootModelElement rto) {
    if (rto instanceof InterfaceReference_c && getMethodName().contains("C1")) {
      // need the package for the parent component
      return rto.getFirstParentComponent().getFirstParentPackage();
    }
    if (rto instanceof Port_c && getMethodName().contains("C1")) {
      // need the package for the parent component
      return rto.getFirstParentComponent().getFirstParentPackage();
    }
    if (getMethodName().contains("C1")) {
      return rto.getFirstParentPackage();
    } else if (getMethodName().contains("C2")) {
      return Package_c.getOneEP_PKGOnR1401(inscopeOtherProject);
    } else if (getMethodName().contains("C3")) {
      return Package_c.getOneEP_PKGOnR1401(
          m_sys,
          new ClassQueryInterface_c() {

            @Override
            public boolean evaluate(Object candidate) {
              Package_c pkg = (Package_c) candidate;
              PackageableElement_c pe = PackageableElement_c.getOnePE_PEOnR8001(pkg);
              if (pe.getVisibility() == Visibility_c.Private) {
                return true;
              }
              return false;
            }
          });
    } else {
      return Package_c.getOneEP_PKGOnR1401(outOfScopeOtherProject);
    }
  }
コード例 #2
0
  private Object[] getCuttableElements(NonRootModelElement rto) {
    List<Object> elements = new ArrayList<Object>();
    if (rto instanceof InterfaceReference_c) {
      // need to include self and the parent component
      elements.add(rto.getFirstParentComponent());
      // and add the provision or requirement
      Provision_c pro = Provision_c.getOneC_POnR4009((InterfaceReference_c) rto);
      Requirement_c req = Requirement_c.getOneC_ROnR4009((InterfaceReference_c) rto);
      if (pro != null) {
        elements.add(pro);
      } else {
        elements.add(req);
      }
    }

    if (rto instanceof Port_c) {
      // need to include self and the parent component
      elements.add(rto.getFirstParentComponent());
      // and add the provision or requirement
      Provision_c pro =
          Provision_c.getOneC_POnR4009(InterfaceReference_c.getOneC_IROnR4016((Port_c) rto));
      Requirement_c req =
          Requirement_c.getOneC_ROnR4009(InterfaceReference_c.getOneC_IROnR4016((Port_c) rto));
      if (pro != null) {
        elements.add(pro);
      } else {
        elements.add(req);
      }
    } else if (rto instanceof ExecutableProperty_c) {
      // need to cut the interface
      Interface_c iface = Interface_c.getOneC_IOnR4003((ExecutableProperty_c) rto);
      elements.add(iface);
    } else {
      elements.add(getSelectableElement(rto));
    }
    return elements.toArray();
  }