Examples of RutaParseException


Examples of org.apache.uima.ruta.extensions.RutaParseException

  }

  public TypeFunctionExpression createTypeFunction(String name, List<RutaExpression> args)
          throws RutaParseException {
    if (args == null || args.size() != 1 || !(args.get(0) instanceof AbstractStringExpression)) {
      throw new RutaParseException("ExampleTypeFunction accepts only one StringExpression as argument!");
    }
    return new ExampleTypeFunction((AbstractStringExpression) args.get(0));
  }
View Full Code Here

Examples of org.apache.uima.ruta.extensions.RutaParseException

  }

  public ExampleBooleanFunction createBooleanFunction(String name, List<RutaExpression> args)
          throws RutaParseException {
    if (args == null || args.size() != 1 || !(args.get(0) instanceof TypeExpression)) {
      throw new RutaParseException(
              "ExampleBooleanFunction accepts only one TypeExpression as argument!");
    }
    return new ExampleBooleanFunction((TypeExpression) args.get(0));
  }
View Full Code Here

Examples of org.apache.uima.ruta.extensions.RutaParseException

  }

  public ExampleStringFunction createStringFunction(String name, List<RutaExpression> args)
          throws RutaParseException {
    if (args == null || args.size() != 1 || !(args.get(0) instanceof TypeExpression)) {
      throw new RutaParseException("ExampleStringFunction accepts only one TypeExpression as argument!");
    }
    return new ExampleStringFunction((TypeExpression) args.get(0));
  }
View Full Code Here

Examples of org.apache.uima.ruta.extensions.RutaParseException

    if (args != null) {
      for (RutaExpression each : args) {
        if (each instanceof INumberExpression) {
          arguments.add((INumberExpression) each);
        } else {
          throw new RutaParseException("ExampleAction accepts only NumberExpressions as arguments");
        }
      }
    }
    return new ExampleAction(arguments);
  }
View Full Code Here

Examples of org.apache.uima.ruta.extensions.RutaParseException

  }

  public NumberFunctionExpression createNumberFunction(String name, List<RutaExpression> args)
          throws RutaParseException {
    if (args == null || args.size() != 1 || !(args.get(0) instanceof TypeExpression)) {
      throw new RutaParseException("ExampleNumberFunction accepts only one TypeExpression as argument!");
    }
    return new ExampleNumberFunction((TypeExpression) args.get(0));
  }
View Full Code Here

Examples of org.apache.uima.ruta.extensions.RutaParseException

      if (!(args.get(0) instanceof AbstractStringExpression)) {
      }
      if (!(args.get(1) instanceof AbstractStringExpression)) {
      }
    } else {
      throw new RutaParseException(
              "ExampleCondition accepts exactly two StringExpressions as arguments");
    }
    return new ExampleCondition((AbstractStringExpression) args.get(0), (AbstractStringExpression) args.get(1));
  }
View Full Code Here

Examples of org.apache.uima.ruta.extensions.RutaParseException

  }

  public StringFunctionExpression createStringFunction(String name, List<RutaExpression> args)
          throws RutaParseException {
    if (args == null  || !(args.get(0) instanceof IStringExpression)) {
      throw new RutaParseException("You have to specify StringExpressions to use these Functions !");
    }

    // ToUpperCase  [0] is the String to change
    if (name.equals(knownExtensions[0])) {
      return new ToUpperCaseStringFunction((IStringExpression) args.get(0));
    }

    // ToLowerCase Function
    else if (name.equals(knownExtensions[1])) {
      return new ToLowerCaseStringFunction((IStringExpression) args.get(0));
    }

    // FirstCharToUppercase
    else if (name.equals(knownExtensions[5])) {
      return new FirstCharToUpperCaseStringFunction((IStringExpression) args.get(0));
    }
   
    if(args.size()!=3){
      throw new RutaParseException("You need 3 Arguments to use ReplaceFirst, ReplaceAll, Substring");
    }
    // ReplaceFirst [0] is the String where stuff is to be replaced, [1] is the search term [2] is the replacement
     if (name.equals(knownExtensions[2])) {
      return new ReplaceFirstStringFunction((IStringExpression) args.get(0),(IStringExpression) args.get(1),(IStringExpression) args.get(2));
    }
View Full Code Here

Examples of org.apache.uima.ruta.extensions.RutaParseException

  @Override
  public BooleanFunctionExpression createBooleanFunction(String name, List<RutaExpression> args)
          throws RutaParseException {
    if(args ==null ){
      throw new RutaParseException("You have to specify at least 1 Argument to use these Functions !");
    }
   
    if (name.equals(knownExtensions[5])) {
      return new IsEmptyBooleanFunction((IStringExpression) args.get(0));
    }
   
    if (args == null || args.size()<2) {
      throw new RutaParseException("You have to specify at least 2 Arguments to use these Functions !");
    }

    if (name.equals(knownExtensions[0])) {
      return new ContainsBooleanFunction((IStringExpression) args.get(0), (IStringExpression) args.get(1));
    }
View Full Code Here

Examples of org.apache.uima.ruta.extensions.RutaParseException

      if (!(args.get(0) instanceof StringExpression)) {
      }
      if (!(args.get(1) instanceof StringExpression)) {
      }
    } else {
      throw new RutaParseException(
              "ExampleCondition accepts exactly two StringExpressions as arguments");
    }
    return new ExampleCondition((StringExpression) args.get(0), (StringExpression) args.get(1));
  }
View Full Code Here

Examples of org.apache.uima.ruta.extensions.RutaParseException

  }

  public TypeFunctionExpression createTypeFunction(String name, List<RutaExpression> args)
          throws RutaParseException {
    if (args == null || args.size() != 1 || !(args.get(0) instanceof StringExpression)) {
      throw new RutaParseException("ExampleTypeFunction accepts only one StringExpression as argument!");
    }
    return new ExampleTypeFunction((StringExpression) args.get(0));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.