Beispiel #1
0
  private static void update_method_signature(
      Operation operation,
      String method_name,
      String method_return_type,
      String[] s_param_names,
      String[] s_return_types) {
    Project project = ProjectManager.getManager().getCurrentProject();
    List<Parameter> param_list = operation.getParameter();

    operation.setName(method_name);
    Object data_type = project.findType(method_return_type, false);
    if (data_type == null) {
      data_type = project.findType(method_return_type, true);
    }

    Parameter return_param = param_list.get(0);
    return_param.setType((Classifier) data_type);

    for (int i = 1; i < param_list.size(); i++) {
      Parameter param = param_list.get(i);
      param.setName(s_param_names[i - 1]);

      data_type = project.findType(s_return_types[i - 1], false);
      if (data_type == null) {
        data_type = project.findType(s_return_types[i - 1], true);
      }

      param.setType((Classifier) data_type);
    }
  }
Beispiel #2
0
  /*
   * @see tudresden.ocl.check.types.ModelFacade#getClassifier(java.lang.String)
   */
  public Any getClassifier(String name) {
    Project p = ProjectManager.getManager().getCurrentProject();

    if (target != null && Model.getFacade().getName(target).equals(name)) {
      return new ArgoAny(target);
    }
    Object classifier = p.findTypeInModel(name, p.getModel());
    if (classifier == null) {
      /** Added search in defined types 2001-10-18 STEFFEN ZSCHALER. */
      classifier = p.findType(name, false);
      if (classifier == null) {
        throw new OclTypeException("cannot find classifier: " + name);
      }
    }
    return new ArgoAny(classifier);
  }