@Test public void testNoArgsCall() throws Exception { MakeConstantSymbol mcs = new MakeConstantSymbol(); StringSymbol result = (StringSymbol) mcs.execute(rhsFuncContext, new ArrayList<Symbol>()); assertNotNull(result); assertEquals("constant", result.getValue()); result = (StringSymbol) mcs.execute(rhsFuncContext, new ArrayList<Symbol>()); assertNotNull(result); assertEquals("constant1", result.getValue()); result = (StringSymbol) mcs.execute(rhsFuncContext, new ArrayList<Symbol>()); assertNotNull(result); assertEquals("constant2", result.getValue()); }
@Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { final SymbolFactory syms = context.getSymbols(); final String prefix = arguments.isEmpty() ? "constant" : Concat.concat(arguments); final StringSymbol result = syms.findString(prefix); if(result == null) { return syms.createString(prefix); } return syms.generateUniqueString(prefix, counter); }
MakeConstantSymbol extends AbstractRhsFunctionHandler { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { final SymbolFactory syms = context.getSymbols(); final String prefix = arguments.isEmpty() ? "constant" : Concat.concat(arguments); final StringSymbol result = syms.findString(prefix); if(result == null) { return syms.createString(prefix); } return syms.generateUniqueString(prefix, counter); } }
MakeConstantSymbol extends AbstractRhsFunctionHandler { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { final SymbolFactory syms = context.getSymbols(); final String prefix = arguments.isEmpty() ? "constant" : Concat.concat(arguments); final StringSymbol result = syms.findString(prefix); if(result == null) { return syms.createString(prefix); } return syms.generateUniqueString(prefix, counter); } MakeConstantSymbol(); }
MakeConstantSymbol extends AbstractRhsFunctionHandler { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { final SymbolFactory syms = context.getSymbols(); final String prefix = arguments.isEmpty() ? "constant" : Concat.concat(arguments); final StringSymbol result = syms.findString(prefix); if(result == null) { return syms.createString(prefix); } return syms.generateUniqueString(prefix, counter); } MakeConstantSymbol(); @Override Symbol execute(RhsFunctionContext context, List<Symbol> arguments); }
MakeConstantSymbol extends AbstractRhsFunctionHandler { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { final SymbolFactory syms = context.getSymbols(); final String prefix = arguments.isEmpty() ? "constant" : Concat.concat(arguments); final StringSymbol result = syms.findString(prefix); if(result == null) { return syms.createString(prefix); } return syms.generateUniqueString(prefix, counter); } MakeConstantSymbol(); @Override Symbol execute(RhsFunctionContext context, List<Symbol> arguments);  }