Пример #1
0
  // end declare accessors
  public static void checkClassConsistency(ModelRoot modelRoot) {
    Ooaofooa.log.println(
        ILogger.OPERATION,
        "Component in Component", //$NON-NLS-1$
        " Operation entered: Component in Component::checkClassConsistency"); //$NON-NLS-1$
    if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == false) { // $NON-NLS-1$
      return;
    }
    ComponentInComponent_c[] objs =
        ComponentInComponent_c.ComponentInComponentInstances(modelRoot, null, false);

    for (int i = 0; i < objs.length; i++) {
      objs[i].checkConsistency();
    }
  }
Пример #2
0
  public boolean checkConsistency() {
    Ooaofooa.log.println(
        ILogger.OPERATION,
        "Component in Component", //$NON-NLS-1$
        " Operation entered: Component in Component::checkConsistency"); //$NON-NLS-1$
    if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == false) { // $NON-NLS-1$
      return true;
    }
    ModelRoot modelRoot = getModelRoot();
    boolean retval = true;
    class ComponentInComponent_c_test55677_c implements ClassQueryInterface_c {
      ComponentInComponent_c_test55677_c(java.util.UUID p55678) {
        m_p55678 = p55678;
      }

      private java.util.UUID m_p55678;

      public boolean evaluate(Object candidate) {
        ComponentInComponent_c selected = (ComponentInComponent_c) candidate;
        boolean retval = false;
        retval = (selected.getId().equals(m_p55678));
        return retval;
      }
    }

    ComponentInComponent_c[] objs55676 =
        ComponentInComponent_c.ComponentInComponentInstances(
            modelRoot, new ComponentInComponent_c_test55677_c(getId()));

    if (((objs55676.length) == 0)) {

      if (CorePlugin.getDefault().isDebugging()) {
        Ooaofooa.log.println(
            ILogger.CONSISTENCY,
            "Component in Component", //$NON-NLS-1$
            "Consistency: Object: Component in Component: Cardinality of an identifier is zero. " //$NON-NLS-1$
                + "Actual Value: "
                + Integer.toString(objs55676.length)); // $NON-NLS-1$
      } else {
        Exception e = new Exception();
        CorePlugin.logError(
            "Consistency: Object: Component in Component: Cardinality of an identifier is zero. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs55676.length),
            e);
      }
      retval = false;
    }

    if (((objs55676.length) > 1)) {

      if (CorePlugin.getDefault().isDebugging()) {
        Ooaofooa.log.println(
            ILogger.CONSISTENCY,
            "Component in Component", //$NON-NLS-1$
            "Consistency: Object: Component in Component: Cardinality of an identifier is greater than 1. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs55676.length)
                + " Id: "
                + "Not Printable"); //$NON-NLS-1$
      } else {
        Exception e = new Exception();
        CorePlugin.logError(
            "Consistency: Object: Component in Component: Cardinality of an identifier is greater than 1. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs55676.length)
                + " Id: "
                + "Not Printable",
            e); //$NON-NLS-1$
      }
      retval = false;
    }

    // Component in Component is a referring class in association: rel.Numb = 4202
    // The participating class is: Component
    class Component_c_test55682_c implements ClassQueryInterface_c {
      Component_c_test55682_c(java.util.UUID p55683) {
        m_p55683 = p55683;
      }

      private java.util.UUID m_p55683;

      public boolean evaluate(Object candidate) {
        Component_c selected = (Component_c) candidate;
        boolean retval = false;
        retval = (selected.getId().equals(m_p55683));
        return retval;
      }
    }

    Component_c[] objs55681 =
        Component_c.ComponentInstances(modelRoot, new Component_c_test55682_c(getParent_id()));

    // The participant is unconditional
    // The multiplicity of the participant is one
    if (((objs55681.length) != 1)) {

      if (CorePlugin.getDefault().isDebugging()) {
        Ooaofooa.log.println(
            ILogger.CONSISTENCY,
            "Component in Component", //$NON-NLS-1$
            "Consistency: Object: Component in Component: Association: 4202: Cardinality of a participant is not equal to 1. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs55681.length)
                + " Parent_Id: "
                + "Not Printable"); //$NON-NLS-1$
      } else {
        Exception e = new Exception();
        CorePlugin.logError(
            "Consistency: Object: Component in Component: Association: 4202: Cardinality of a participant is not equal to 1. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs55681.length)
                + " Parent_Id: "
                + "Not Printable",
            e); //$NON-NLS-1$
      }
      retval = false;
    }

    // Component in Component is a participating class in association: rel.Numb = 4203
    // Object: Component
    class Component_c_test55685_c implements ClassQueryInterface_c {
      Component_c_test55685_c(java.util.UUID p55686) {
        m_p55686 = p55686;
      }

      private java.util.UUID m_p55686;

      public boolean evaluate(Object candidate) {
        Component_c selected = (Component_c) candidate;
        boolean retval = false;
        retval = (selected.getNestedcomponent_id().equals(m_p55686));
        return retval;
      }
    }

    Component_c[] objs55684 =
        Component_c.ComponentInstances(modelRoot, new Component_c_test55685_c(getId()));

    if (((objs55684.length) != 1)) {

      if (CorePlugin.getDefault().isDebugging()) {
        Ooaofooa.log.println(
            ILogger.CONSISTENCY,
            "Component in Component", //$NON-NLS-1$
            "Consistency: Object: Component in Component: Association: 4203: Cardinality of a formalizer is not equal to one. " //$NON-NLS-1$
                + "Actual Value: "
                + Integer.toString(objs55684.length)); // $NON-NLS-1$
      } else {
        Exception e = new Exception();
        CorePlugin.logError(
            "Consistency: Object: Component in Component: Association: 4203: Cardinality of a formalizer is not equal to one. " //$NON-NLS-1$
                + "Actual Value: " //$NON-NLS-1$
                + Integer.toString(objs55684.length),
            e);
      }
      retval = false;
    }

    return retval;
  }