Logo Search packages:      
Sourcecode: jmk version File versions  Download package

Value edu::neu::ccs::jmk::ReverseFunction::invoke ( Value[]  args,
StringList  list 
) throws Exception [inline]

Invoke the reverse function.

Parameters:
args parameters to the function
list a string list
Returns:
result of invocation appended to the list (if list is non-null, result must be a string list)
Exceptions:
Exception if invocation failed

Implements edu::neu::ccs::jmk::Function.

Definition at line 52 of file ReverseFunction.java.

References getName(), edu::neu::ccs::jmk::StringList::getRest(), and edu::neu::ccs::jmk::StringList::getString().

  {
    if (args.length == nargs) {
      if (StringList.isStringList(args[0])) {
      StringList sl = (StringList)args[0];
      for (; sl != null; sl = sl.getRest())
        list = new StringList(sl.getString(), list);
      return list;
      }
      else {
      String msg = getName()
        + ": the argument is not a string list";
      throw new StringListCastException(msg);
      }
    }
    else {
      String msg = "Arg count error: " + getName() + " expecting " + nargs +
      " but got " + args.length + " arguments";
      throw new WrongArgCountException(msg);
    }
  }


Generated by  Doxygen 1.6.0   Back to index