@Test public void testConvertsIdentifierToString() throws Exception { final StringRhsFunction f = new StringRhsFunction(); final Identifier id = syms.createIdentifier('T'); final Symbol result = f.execute(rhsFuncContext, Symbols.asList(syms, id)); assertEquals(id.toString(), result.asString().getValue()); }
@Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkArgumentCount(this, arguments); final SymbolFactory syms = context.getSymbols(); if(arguments.size() == 0) { return syms.createString(""); } else { final Symbol arg = arguments.get(0); return arg.asString() != null ? arg : syms.createString(arg.toString()); } }
StringRhsFunction extends AbstractRhsFunctionHandler { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkArgumentCount(this, arguments); final SymbolFactory syms = context.getSymbols(); if(arguments.size() == 0) { return syms.createString(""); } else { final Symbol arg = arguments.get(0); return arg.asString() != null ? arg : syms.createString(arg.toString()); } } }
StringRhsFunction extends AbstractRhsFunctionHandler { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkArgumentCount(this, arguments); final SymbolFactory syms = context.getSymbols(); if(arguments.size() == 0) { return syms.createString(""); } else { final Symbol arg = arguments.get(0); return arg.asString() != null ? arg : syms.createString(arg.toString()); } } StringRhsFunction(); }
StringRhsFunction extends AbstractRhsFunctionHandler { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkArgumentCount(this, arguments); final SymbolFactory syms = context.getSymbols(); if(arguments.size() == 0) { return syms.createString(""); } else { final Symbol arg = arguments.get(0); return arg.asString() != null ? arg : syms.createString(arg.toString()); } } StringRhsFunction(); @Override Symbol execute(RhsFunctionContext context, List<Symbol> arguments); }
StringRhsFunction extends AbstractRhsFunctionHandler { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkArgumentCount(this, arguments); final SymbolFactory syms = context.getSymbols(); if(arguments.size() == 0) { return syms.createString(""); } else { final Symbol arg = arguments.get(0); return arg.asString() != null ? arg : syms.createString(arg.toString()); } } StringRhsFunction(); @Override Symbol execute(RhsFunctionContext context, List<Symbol> arguments);  }