예제 #1
0
 /**
  * shell-function: {@code print(message)}
  *
  * @param cx the execution context
  * @param messages the string to print
  */
 @Function(name = "print", arity = 1)
 public void print(ExecutionContext cx, String... messages) {
   PrintWriter writer = cx.getRuntimeContext().getConsole().writer();
   writer.println(Strings.concatWith(' ', messages));
 }
예제 #2
0
 /**
  * shell-function: {@code readline()}
  *
  * @param cx the execution context
  * @return the read line from stdin
  */
 @Function(name = "readline", arity = 0)
 public String readline(ExecutionContext cx) {
   return cx.getRuntimeContext().getConsole().readLine();
 }