@Test public void testCreate() throws Exception { Variable bool = Variable.create(Type.BOOL, "boolean", "true"); assertEquals(Type.BOOL, bool.getType()); assertEquals("boolean", bool.getId()); assertEquals(true, bool.getInitialValue()); Variable integer = Variable.create(Type.INT, "integer", "42"); assertEquals(Type.INT, integer.getType()); assertEquals("integer", integer.getId()); assertEquals(42, integer.getInitialValue()); Variable character = Variable.create(Type.CHAR, "character", "b"); assertEquals(Type.CHAR, character.getType()); assertEquals("character", character.getId()); assertEquals('b', character.getInitialValue()); }
public static Variable create(final Type type, final String id, final String initialValue) { Variable var; switch (type) { case BOOL: Boolean bool = initialValue == null ? null : Boolean.parseBoolean(initialValue); var = new Variable<Boolean>(type, id, bool); break; case INT: Integer integer = initialValue == null ? null : Integer.parseInt(initialValue); var = new Variable<Integer>(type, id, integer); break; case CHAR: Character character = initialValue == null ? null : initialValue.charAt(0); var = new Variable<Character>(type, id, character); break; default: throw new NotImplementedException(); } return var; }
Variable extends Element implements TypedElement { public static Variable create(final Type type, final String id, final String initialValue) { Variable var; switch (type) { case BOOL: Boolean bool = initialValue == null ? null : Boolean.parseBoolean(initialValue); var = new Variable<Boolean>(type, id, bool); break; case INT: Integer integer = initialValue == null ? null : Integer.parseInt(initialValue); var = new Variable<Integer>(type, id, integer); break; case CHAR: Character character = initialValue == null ? null : initialValue.charAt(0); var = new Variable<Character>(type, id, character); break; default: throw new NotImplementedException(); } return var; } }
Variable extends Element implements TypedElement { public static Variable create(final Type type, final String id, final String initialValue) { Variable var; switch (type) { case BOOL: Boolean bool = initialValue == null ? null : Boolean.parseBoolean(initialValue); var = new Variable<Boolean>(type, id, bool); break; case INT: Integer integer = initialValue == null ? null : Integer.parseInt(initialValue); var = new Variable<Integer>(type, id, integer); break; case CHAR: Character character = initialValue == null ? null : initialValue.charAt(0); var = new Variable<Character>(type, id, character); break; default: throw new NotImplementedException(); } return var; } protected  Variable(final Type type, final String id, final T initialValue);  Variable(final Type type, final String id); }
Variable extends Element implements TypedElement { public static Variable create(final Type type, final String id, final String initialValue) { Variable var; switch (type) { case BOOL: Boolean bool = initialValue == null ? null : Boolean.parseBoolean(initialValue); var = new Variable<Boolean>(type, id, bool); break; case INT: Integer integer = initialValue == null ? null : Integer.parseInt(initialValue); var = new Variable<Integer>(type, id, integer); break; case CHAR: Character character = initialValue == null ? null : initialValue.charAt(0); var = new Variable<Character>(type, id, character); break; default: throw new NotImplementedException(); } return var; } protected  Variable(final Type type, final String id, final T initialValue);  Variable(final Type type, final String id); final String getId(); final Type getType(); final T getInitialValue(); final VariableAssignment createVariableAssignment(final Variable<T> source); final ValueAssignment<T> createValueAssignment(final T value); static Variable create(final Type type, final String id, final String initialValue); @Override final String toString(); }
Variable extends Element implements TypedElement { public static Variable create(final Type type, final String id, final String initialValue) { Variable var; switch (type) { case BOOL: Boolean bool = initialValue == null ? null : Boolean.parseBoolean(initialValue); var = new Variable<Boolean>(type, id, bool); break; case INT: Integer integer = initialValue == null ? null : Integer.parseInt(initialValue); var = new Variable<Integer>(type, id, integer); break; case CHAR: Character character = initialValue == null ? null : initialValue.charAt(0); var = new Variable<Character>(type, id, character); break; default: throw new NotImplementedException(); } return var; } protected  Variable(final Type type, final String id, final T initialValue);  Variable(final Type type, final String id); final String getId(); final Type getType(); final T getInitialValue(); final VariableAssignment createVariableAssignment(final Variable<T> source); final ValueAssignment<T> createValueAssignment(final T value); static Variable create(final Type type, final String id, final String initialValue); @Override final String toString();  }