@Test public void testCreateWithNewIdCreatesANewIdentifier() { final Symbol s = Symbols.create(syms, Symbols.NEW_ID); assertNotNull(s.asIdentifier()); }
public static Symbol create(SymbolFactory factory, Object value) { Arguments.checkNotNull(factory, "factory"); if(value == NEW_ID) { return factory.createIdentifier('Z'); } if(value instanceof Symbol) { return (Symbol) value; } if(value instanceof Character || value instanceof String) { return factory.createString(value.toString()); } if(value instanceof Double || value instanceof Float) { return factory.createDouble(((Number) value).doubleValue()); } if(value instanceof Integer || value instanceof Long || value instanceof Short || value instanceof Byte || value instanceof AtomicInteger || value instanceof AtomicLong) { return factory.createInteger(((Number) value).longValue()); } if(WARN_ON_JAVA_SYMBOLS) { logger.warn("A Java symbol with value '" + value + "' is being created. " + "Are you sure this is what you want to do? " + "Disable this message with -Djsoar.warnOnJavaSymbols=false."); } return factory.createJavaSymbol(value); }
Symbols { public static Symbol create(SymbolFactory factory, Object value) { Arguments.checkNotNull(factory, "factory"); if(value == NEW_ID) { return factory.createIdentifier('Z'); } if(value instanceof Symbol) { return (Symbol) value; } if(value instanceof Character || value instanceof String) { return factory.createString(value.toString()); } if(value instanceof Double || value instanceof Float) { return factory.createDouble(((Number) value).doubleValue()); } if(value instanceof Integer || value instanceof Long || value instanceof Short || value instanceof Byte || value instanceof AtomicInteger || value instanceof AtomicLong) { return factory.createInteger(((Number) value).longValue()); } if(WARN_ON_JAVA_SYMBOLS) { logger.warn("A Java symbol with value '" + value + "' is being created. " + "Are you sure this is what you want to do? " + "Disable this message with -Djsoar.warnOnJavaSymbols=false."); } return factory.createJavaSymbol(value); } }
Symbols { public static Symbol create(SymbolFactory factory, Object value) { Arguments.checkNotNull(factory, "factory"); if(value == NEW_ID) { return factory.createIdentifier('Z'); } if(value instanceof Symbol) { return (Symbol) value; } if(value instanceof Character || value instanceof String) { return factory.createString(value.toString()); } if(value instanceof Double || value instanceof Float) { return factory.createDouble(((Number) value).doubleValue()); } if(value instanceof Integer || value instanceof Long || value instanceof Short || value instanceof Byte || value instanceof AtomicInteger || value instanceof AtomicLong) { return factory.createInteger(((Number) value).longValue()); } if(WARN_ON_JAVA_SYMBOLS) { logger.warn("A Java symbol with value '" + value + "' is being created. " + "Are you sure this is what you want to do? " + "Disable this message with -Djsoar.warnOnJavaSymbols=false."); } return factory.createJavaSymbol(value); } private  Symbols(); }
Symbols { public static Symbol create(SymbolFactory factory, Object value) { Arguments.checkNotNull(factory, "factory"); if(value == NEW_ID) { return factory.createIdentifier('Z'); } if(value instanceof Symbol) { return (Symbol) value; } if(value instanceof Character || value instanceof String) { return factory.createString(value.toString()); } if(value instanceof Double || value instanceof Float) { return factory.createDouble(((Number) value).doubleValue()); } if(value instanceof Integer || value instanceof Long || value instanceof Short || value instanceof Byte || value instanceof AtomicInteger || value instanceof AtomicLong) { return factory.createInteger(((Number) value).longValue()); } if(WARN_ON_JAVA_SYMBOLS) { logger.warn("A Java symbol with value '" + value + "' is being created. " + "Are you sure this is what you want to do? " + "Disable this message with -Djsoar.warnOnJavaSymbols=false."); } return factory.createJavaSymbol(value); } private  Symbols(); static int getSymbolType(Symbol sym); static Symbol create(SymbolFactory factory, Object value); static Object valueOf(Symbol sym); static List<Symbol> asList(SymbolFactory factory, Object... objects); static char getFirstLetter(Object attr); static Identifier parseIdentifier(SymbolFactory symbols, String idString); static Symbol readAttributeFromString(Agent agent, String s); static double asDouble(Symbol sym); static boolean equalByValue(Symbol s1, Symbol s2); }
Symbols { public static Symbol create(SymbolFactory factory, Object value) { Arguments.checkNotNull(factory, "factory"); if(value == NEW_ID) { return factory.createIdentifier('Z'); } if(value instanceof Symbol) { return (Symbol) value; } if(value instanceof Character || value instanceof String) { return factory.createString(value.toString()); } if(value instanceof Double || value instanceof Float) { return factory.createDouble(((Number) value).doubleValue()); } if(value instanceof Integer || value instanceof Long || value instanceof Short || value instanceof Byte || value instanceof AtomicInteger || value instanceof AtomicLong) { return factory.createInteger(((Number) value).longValue()); } if(WARN_ON_JAVA_SYMBOLS) { logger.warn("A Java symbol with value '" + value + "' is being created. " + "Are you sure this is what you want to do? " + "Disable this message with -Djsoar.warnOnJavaSymbols=false."); } return factory.createJavaSymbol(value); } private  Symbols(); static int getSymbolType(Symbol sym); static Symbol create(SymbolFactory factory, Object value); static Object valueOf(Symbol sym); static List<Symbol> asList(SymbolFactory factory, Object... objects); static char getFirstLetter(Object attr); static Identifier parseIdentifier(SymbolFactory symbols, String idString); static Symbol readAttributeFromString(Agent agent, String s); static double asDouble(Symbol sym); static boolean equalByValue(Symbol s1, Symbol s2); static final int IDENTIFIER_SYMBOL_TYPE; static final int SYM_CONSTANT_SYMBOL_TYPE; static final int INT_CONSTANT_SYMBOL_TYPE; static final int FLOAT_CONSTANT_SYMBOL_TYPE; static final Object NEW_ID; }