Ejemplo n.º 1
0
  /**
   * To call side-effect free methods of an object, invoke this method with the method name as
   * String and the appropriate parameters. This method does not enforce that only side-effect free
   * methods are called.
   *
   * <p>If an exception occurs in the called method or in accessing it, an undefined value is
   * returned.
   */
  public OclRoot getFeature(String methodName, Object[] params) {
    Object[] javaParams = new Object[params.length];
    for (int i = 0; i < params.length; i++) {
      javaParams[i] = Ocl.reconvert(Object.class, (OclRoot) params[i]);
    }

    Instance newInstance = null;
    try {
      newInstance = instance.navigateParameterized(methodName, javaParams);
    } catch (IllegalAccessException e) {
      return new OclAnyImpl(0, e.getMessage());

      // throw new OclException(e.getMessage());
    }

    if (newInstance == null) {
      return null;
    } else {
      return Ocl.getOclRepresentationFor(newInstance);
    }
  }
Ejemplo n.º 2
0
  /**
   * The attributes of application objects can be queried through this method. Due to restrictions
   * of the Java language, only <CODE>public</CODE> fields can be queried.
   *
   * @param attributeName the name of the feature, as a java.lang.String
   */
  public OclRoot getFeatureQualified(String attributeName, Object qualifier) {
    Assert.assertTrue(qualifier == null);

    Instance newInstance = null;
    try {
      newInstance = instance.navigateQualified(attributeName, null);
    } catch (IllegalAccessException e) {
      return new OclAnyImpl(0, e.getMessage());

      // throw new OclException(e.getMessage());
    }

    if (newInstance == null) {
      return null;
    } else {
      return Ocl.getOclRepresentationFor(newInstance);
    }
  }
Ejemplo n.º 3
0
 public void defaultIn(Node n) {
   if (node != n) {
     subnodes.add(Ocl.getOclRepresentationFor(n));
   }
 }