From: Gerardo H. <ma...@us...> - 2007-03-01 00:50:41
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv1255/src/org/jrman/parser Modified Files: Global.java ObjectInstanceList.java Parser.java Tokenizer.java World.java Log Message: Compiles for Java 1.5 with -Xlint without any warning. Index: World.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/World.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** World.java 26 Feb 2007 19:35:48 -0000 1.4 --- World.java 1 Mar 2007 00:50:28 -0000 1.5 *************** *** 27,38 **** public class World { ! private Map lights; public World() { ! lights = new HashMap(); } public World(World other) { ! lights = new HashMap(other.lights); } --- 27,38 ---- public class World { ! private Map<Integer, LightShader> lights; public World() { ! lights = new HashMap<Integer, LightShader>(); } public World(World other) { ! lights = new HashMap<Integer, LightShader>(other.lights); } *************** *** 42,47 **** public LightShader getLight(int sequenceNumber) { ! LightShader light = (LightShader) ! lights.get(new Integer(sequenceNumber)); if (light == null) throw new IllegalArgumentException("no such light: " + --- 42,46 ---- public LightShader getLight(int sequenceNumber) { ! LightShader light = lights.get(sequenceNumber); if (light == null) throw new IllegalArgumentException("no such light: " + Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -d -r1.111 -r1.112 *** Parser.java 26 Feb 2007 19:35:47 -0000 1.111 --- Parser.java 1 Mar 2007 00:50:28 -0000 1.112 *************** *** 104,108 **** "org.jrman.parser.keywords.Keyword"; ! private final static Map fullFileNames = new HashMap(); private String currentDirectory; --- 104,109 ---- "org.jrman.parser.keywords.Keyword"; ! private final static Map<String, String> fullFileNames = ! new HashMap<String, String>(); private String currentDirectory; *************** *** 118,122 **** private Renderer renderer; ! private Map keywordParsers = new HashMap(); private MutableAttributes currentAttributes; --- 119,124 ---- private Renderer renderer; ! private Map<String, KeywordParser> keywordParsers = ! new HashMap<String, KeywordParser>(); private MutableAttributes currentAttributes; *************** *** 124,136 **** private Attributes currentImmutableAttributes; ! private Stack attributeStack = new Stack(); ! private Stack transformStack = new Stack(); ! private Stack worldStack = new Stack(); ! private Stack frameStack = new Stack(); ! private Stack stateStack = new Stack(); private State state = State.OUTSIDE; --- 126,139 ---- private Attributes currentImmutableAttributes; ! private Stack<MutableAttributes> attributeStack = ! new Stack<MutableAttributes>(); ! private Stack<Transform> transformStack = new Stack<Transform>(); ! private Stack<World> worldStack = new Stack<World>(); ! private Stack<Frame> frameStack = new Stack<Frame>(); ! private Stack<State> stateStack = new Stack<State>(); private State state = State.OUTSIDE; *************** *** 138,142 **** private String currentOperation; // Just now to avoid compiler warnings... ! private Map objectInstanceLists = new HashMap(); private ObjectInstanceList currentObjectInstanceList; --- 141,146 ---- private String currentOperation; // Just now to avoid compiler warnings... ! private Map<Integer, ObjectInstanceList> objectInstanceLists = ! new HashMap<Integer, ObjectInstanceList>(); private ObjectInstanceList currentObjectInstanceList; *************** *** 219,223 **** public void parse(String filename) throws Exception { if (currentDirectory != null) { ! String fullFileName = (String) fullFileNames.get(filename); if (fullFileName == null) { fullFileName = currentDirectory + File.separator + filename; --- 223,227 ---- public void parse(String filename) throws Exception { if (currentDirectory != null) { ! String fullFileName = fullFileNames.get(filename); if (fullFileName == null) { fullFileName = currentDirectory + File.separator + filename; *************** *** 282,288 **** private KeywordParser getKeyWordParser(String keyword) throws Exception { ! KeywordParser kp = (KeywordParser) keywordParsers.get(keyword); if (kp == null) ! kp = (KeywordParser) keywordParsers.get(keyword.toLowerCase()); if (kp == null) { char c = keyword.charAt(0); --- 286,292 ---- private KeywordParser getKeyWordParser(String keyword) throws Exception { ! KeywordParser kp = keywordParsers.get(keyword); if (kp == null) ! kp = keywordParsers.get(keyword.toLowerCase()); if (kp == null) { char c = keyword.charAt(0); *************** *** 304,308 **** private void popState() { ! state = (State) stateStack.pop(); } --- 308,312 ---- private void popState() { ! state = stateStack.pop(); } *************** *** 318,322 **** public void popAttributes() { ! currentAttributes = (MutableAttributes) attributeStack.pop(); currentAttributes.setModified(true); } --- 322,326 ---- public void popAttributes() { ! currentAttributes = attributeStack.pop(); currentAttributes.setModified(true); } *************** *** 333,343 **** private void newObjectInstanceList(int sequenceNumber) { currentObjectInstanceList = new ObjectInstanceList(); ! objectInstanceLists.put(new Integer(sequenceNumber), ! currentObjectInstanceList); } private ObjectInstanceList getObjectInstanceList(int sequenceNumber) { ! ObjectInstanceList result = (ObjectInstanceList) ! objectInstanceLists.get(new Integer(sequenceNumber)); if (result == null) throw new IllegalArgumentException("Unknown instance: " + --- 337,345 ---- private void newObjectInstanceList(int sequenceNumber) { currentObjectInstanceList = new ObjectInstanceList(); ! objectInstanceLists.put(sequenceNumber, currentObjectInstanceList); } private ObjectInstanceList getObjectInstanceList(int sequenceNumber) { ! ObjectInstanceList result = objectInstanceLists.get(sequenceNumber); if (result == null) throw new IllegalArgumentException("Unknown instance: " + *************** *** 363,367 **** public void transformEnd() { ! currentAttributes.setTransform((Transform) transformStack.pop()); popState(); } --- 365,369 ---- public void transformEnd() { ! currentAttributes.setTransform(transformStack.pop()); popState(); } *************** *** 487,492 **** public void frameEnd() { popAttributes(); ! world = (World) worldStack.pop(); ! frame = (Frame) frameStack.pop(); popState(); } --- 489,494 ---- public void frameEnd() { popAttributes(); ! world = worldStack.pop(); ! frame = frameStack.pop(); popState(); } *************** *** 557,562 **** renderer.render(); renderer = null; ! world = (World) worldStack.pop(); ! frame = (Frame) frameStack.pop(); popState(); popAttributes(); --- 559,564 ---- renderer.render(); renderer = null; ! world = worldStack.pop(); ! frame = frameStack.pop(); popState(); popAttributes(); *************** *** 801,805 **** private void turnOnLight(LightShader light) { ! Set lightSources = new HashSet(currentAttributes.getLightSources()); lightSources.add(light); currentAttributes.setLightSources(lightSources); --- 803,808 ---- private void turnOnLight(LightShader light) { ! Set<LightShader> lightSources = ! new HashSet<LightShader>(currentAttributes.getLightSources()); lightSources.add(light); currentAttributes.setLightSources(lightSources); *************** *** 807,811 **** private void turnOffLight(LightShader light) { ! Set lightSources = new HashSet(currentAttributes.getLightSources()); lightSources.remove(light); currentAttributes.setLightSources(lightSources); --- 810,815 ---- private void turnOffLight(LightShader light) { ! Set<LightShader> lightSources = ! new HashSet<LightShader>(currentAttributes.getLightSources()); lightSources.remove(light); currentAttributes.setLightSources(lightSources); Index: Tokenizer.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Tokenizer.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Tokenizer.java 26 Feb 2007 19:35:48 -0000 1.6 --- Tokenizer.java 1 Mar 2007 00:50:28 -0000 1.7 *************** *** 72,89 **** } ! /* ! * ! * private static boolean matches(char[] buffer, int pos, String s) { if ! * (s.length() != pos) return false; for (int i = 0; i < pos; i++) if ! * (buffer[i] != s.charAt(i)) return false; return true; } ! * ! * private String bufferToString() { for (int i = 0; i < strings.size(); ! * i++) { String s = (String) strings.get(i); if (matches(buffer, pos, s)) ! * return s; } String s = new String(buffer, 0, pos); strings.add(s); return ! * s; } ! * ! */ ! ! private Comparator comparator = new Comparator() { public int compare(Object o1, Object o2) { String s = (String) o1; --- 72,76 ---- } ! private Comparator<Object> comparator = new Comparator<Object>() { public int compare(Object o1, Object o2) { String s = (String) o1; Index: Global.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Global.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Global.java 26 Feb 2007 19:35:47 -0000 1.14 --- Global.java 1 Mar 2007 00:50:28 -0000 1.15 *************** *** 28,34 **** public class Global { ! private static Map transforms = new HashMap(); ! private static Map declarations = new HashMap(); static { --- 28,36 ---- public class Global { ! private static Map<String, Transform> transforms = ! new HashMap<String, Transform>(); ! private static Map<String, Declaration> declarations = ! new HashMap<String, Declaration>(); static { *************** *** 106,110 **** public static Transform getTransform(String name) { ! Transform result = (Transform) transforms.get(name); if (result == null) throw new IllegalArgumentException("no such coordinate system: " + --- 108,112 ---- public static Transform getTransform(String name) { ! Transform result = transforms.get(name); if (result == null) throw new IllegalArgumentException("no such coordinate system: " + *************** *** 118,122 **** public static Declaration getDeclaration(String name) { ! return (Declaration) declarations.get(name); } --- 120,124 ---- public static Declaration getDeclaration(String name) { ! return declarations.get(name); } Index: ObjectInstanceList.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/ObjectInstanceList.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ObjectInstanceList.java 26 Feb 2007 19:35:47 -0000 1.2 --- ObjectInstanceList.java 1 Mar 2007 00:50:28 -0000 1.3 *************** *** 32,36 **** public class ObjectInstanceList { ! private List primitiveCreators = new ArrayList(); private BoundingVolume boundingVolume; --- 32,37 ---- public class ObjectInstanceList { ! private List<PrimitiveCreator> primitiveCreators = ! new ArrayList<PrimitiveCreator>(); private BoundingVolume boundingVolume; |