コード例 #1
0
 public boolean evaluate(Object inst) {
   RequiredOperation_c selected = (RequiredOperation_c) inst;
   return selected.getName().equals(m_p);
 }
コード例 #2
0
  private void populateInterfaceOperationInstances(
      Component_c comp, String portName, boolean Required) {

    Port_c[] ports = Port_c.getManyC_POsOnR4010(comp);
    for (int i = 0; i < ports.length; ++i) {
      if (ports[i].getName().equalsIgnoreCase(portName)) {
        // BirdgePoint support only single interface reference for a
        // port
        // so select One interface reference only
        InterfaceReference_c intRef = InterfaceReference_c.getOneC_IROnR4016(ports[i]);

        Requirement_c req = Requirement_c.getOneC_ROnR4009(intRef);
        Provision_c prov = Provision_c.getOneC_POnR4009(intRef);
        String[] interfaceOperations;
        if (req != null && Required) { // Required Interface
          RequiredExecutableProperty_c[] REPs =
              RequiredExecutableProperty_c.getManySPR_REPsOnR4500(req);
          for (int j = 0; j < funcs.length; ++j) {

            class ReqOperation_test1_c implements ClassQueryInterface_c {
              ReqOperation_test1_c(String p) {
                m_p = p;
              }

              private String m_p;

              public boolean evaluate(Object inst) {
                RequiredOperation_c selected = (RequiredOperation_c) inst;
                return selected.getName().equals(m_p);
              }
            }

            RequiredOperation_c testOpr =
                RequiredOperation_c.getOneSPR_ROOnR4502(REPs, new ReqOperation_test1_c(funcs[j]));
            if (testOpr != null) {
              if (m_testReqOpr[j] == null) {
                m_testReqOpr[j] = testOpr;
              }
            } else fail("Missing Interface Operation " + m_testReqOpr[j]); // $NON-NLS-1$
          }
          return;
        } else if (prov != null && !Required) { // Provided Interface
          ProvidedExecutableProperty_c[] PEPs =
              ProvidedExecutableProperty_c.getManySPR_PEPsOnR4501(prov);
          for (int j = 0; j < funcs.length; ++j) {

            class ProvOperation_test1_c implements ClassQueryInterface_c {
              ProvOperation_test1_c(String p) {
                m_p = p;
              }

              private String m_p;

              public boolean evaluate(Object inst) {
                ProvidedOperation_c selected = (ProvidedOperation_c) inst;
                return selected.getName().equals(m_p);
              }
            }

            ProvidedOperation_c testOpr =
                ProvidedOperation_c.getOneSPR_POOnR4503(PEPs, new ProvOperation_test1_c(funcs[j]));
            if (testOpr != null) {
              if (m_testProvOpr[j] == null) {
                m_testProvOpr[j] = testOpr;
              }
            } else fail("Missing Interface Operation " + m_testReqOpr[j]); // $NON-NLS-1$
          }
          return;
        } else {
          fail(
              "Port"
                  + portName
                  + "is defined as"
                  + (Required ? "Provided" : "Required")
                  + "interface."); //$NON-NLS-1$
        }
      }
    }
    fail("Can not find port " + portName); // $NON-NLS-1$	
  }