From: <chr...@us...> - 2006-10-21 14:34:40
|
Revision: 560 http://svn.sourceforge.net/gridarta/?rev=560&view=rev Author: christianhujer Date: 2006-10-21 07:34:35 -0700 (Sat, 21 Oct 2006) Log Message: ----------- Improved error behaviour. Modified Paths: -------------- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2006-10-21 14:26:58 UTC (rev 559) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2006-10-21 14:34:35 UTC (rev 560) @@ -48,6 +48,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ +@SuppressWarnings({"HardcodedFileSeparator"}) public final class AnimationObjects extends NamedObjects<AnimationObject> implements net.sf.gridarta.gameobject.anim.AnimationObjects<AnimationObject> { /** @@ -127,7 +128,8 @@ final StringBuilder animText = new StringBuilder(); String line; //noinspection ForLoopThatDoesntUseLoopVariable - for (int lineNumber = 1; (line = in.readLine()) != null; lineNumber++) { + int lineNumber; + for (lineNumber = 1; (line = in.readLine()) != null; lineNumber++) { if (line.startsWith("#")) { /* ignore comment lines. */ } else if (line.startsWith("anim ")) { @@ -150,7 +152,9 @@ animText.append(line).append('\n'); } } - assert !inAnim; + if (!inAnim) { + throw new AnimationParseException("mina", null, lineNumber); + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-21 19:17:43
|
Revision: 566 http://svn.sourceforge.net/gridarta/?rev=566&view=rev Author: christianhujer Date: 2006-10-21 12:17:35 -0700 (Sat, 21 Oct 2006) Log Message: ----------- Fixed bug. Modified Paths: -------------- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2006-10-21 17:47:27 UTC (rev 565) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2006-10-21 19:17:35 UTC (rev 566) @@ -152,7 +152,7 @@ animText.append(line).append('\n'); } } - if (!inAnim) { + if (inAnim) { throw new AnimationParseException("mina", null, lineNumber); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-10-22 00:22:08
|
Revision: 568 http://svn.sourceforge.net/gridarta/?rev=568&view=rev Author: christianhujer Date: 2006-10-21 17:22:03 -0700 (Sat, 21 Oct 2006) Log Message: ----------- Clarified comment. Modified Paths: -------------- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2006-10-21 20:05:35 UTC (rev 567) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2006-10-22 00:22:03 UTC (rev 568) @@ -115,7 +115,7 @@ * supplied <var>reader</var> with a BufferedReader if the supplied reader * isn't already a BufferedReader itself. * @param reader Reader to load animations from - * @param path Path relative to the arch directory + * @param path Path relative to the arch directory, used to create tree information * @throws IOException in case of I/O errors * @throws AnimationParseException in case parsing the animation reveals errors * @throws DuplicateAnimationException in case an animation was not unique @@ -127,7 +127,6 @@ String animName = null; final StringBuilder animText = new StringBuilder(); String line; - //noinspection ForLoopThatDoesntUseLoopVariable int lineNumber; for (lineNumber = 1; (line = in.readLine()) != null; lineNumber++) { if (line.startsWith("#")) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-02-04 15:51:02
|
Revision: 1806 http://svn.sourceforge.net/gridarta/?rev=1806&view=rev Author: christianhujer Date: 2007-02-04 07:51:00 -0800 (Sun, 04 Feb 2007) Log Message: ----------- Split collection of animations and animtree into separate methods. Modified Paths: -------------- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2007-02-04 15:46:25 UTC (rev 1805) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2007-02-04 15:51:00 UTC (rev 1806) @@ -204,32 +204,58 @@ * The tree information for the editor is written to "animtree". */ public void collect(@NotNull final Progress progress, @NotNull final File dir) throws IOException { + progress.setLabel(ACTION_FACTORY.getString("archCollectAnimations"), size()); + collectAnims(progress, dir); + collectAnimTree(progress, dir); + } + + /** + * Collects the animation data into the file "animations". + * @param progress Progress to report progress to. + * @param dir Destination directory to collect data to. + * @throws IOException in case of I/O problems during collection + */ + private void collectAnims(@NotNull final Progress progress, @NotNull final File dir) throws IOException { final BufferedWriter animations = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(dir, "animations")), IOUtils.MAP_ENCODING)); try { - final BufferedWriter animtree = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(new File(dir, IGUIConstants.CONFIG_DIR), IGUIConstants.ANIMTREE_FILE)), IOUtils.MAP_ENCODING)); - try { - progress.setLabel(ACTION_FACTORY.getString("archCollectAnimations"), size()); - int counter = 0; // counter for progress bar - for (final AnimationObject anim : this) { - animations - .append("anim ") - .append(anim.getAnimName()) - .append('\n') - .append(anim.getAnimList()) - .append("mina\n"); - animtree - .append(anim.getPath()) - .append('\n'); - if (++counter % 128 == 0) { - progress.setValue(counter); - } + int counter = 0; // counter for progress bar + for (final AnimationObject anim : this) { + animations + .append("anim ") + .append(anim.getAnimName()) + .append('\n') + .append(anim.getAnimList()) + .append("mina\n"); + if (counter++ % 128 == 0) { + progress.setValue(counter); } - } finally { - animtree.close(); } } finally { animations.close(); } } + /** + * Collects the animation data into the file "animations". + * @param progress Progress to report progress to. + * @param dir Destination directory to collect data to. + * @throws IOException in case of I/O problems during collection + */ + private void collectAnimTree(@NotNull final Progress progress, @NotNull final File dir) throws IOException { + final BufferedWriter animtree = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(new File(dir, IGUIConstants.CONFIG_DIR), IGUIConstants.ANIMTREE_FILE)), IOUtils.MAP_ENCODING)); + try { + int counter = 0; // counter for progress bar + for (final AnimationObject anim : this) { + animtree + .append(anim.getPath()) + .append('\n'); + if (counter++ % 128 == 0) { + progress.setValue(counter); + } + } + } finally { + animtree.close(); + } + } + } // class AnimationObjects This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-05-20 10:42:15
|
Revision: 2671 http://svn.sourceforge.net/gridarta/?rev=2671&view=rev Author: christianhujer Date: 2007-05-20 03:42:17 -0700 (Sun, 20 May 2007) Log Message: ----------- Removed a warning. Modified Paths: -------------- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2007-05-20 10:38:22 UTC (rev 2670) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationObjects.java 2007-05-20 10:42:17 UTC (rev 2671) @@ -176,7 +176,7 @@ * @throws FileNotFoundException in case the file couldn't be opened */ public void loadAnimTree(final File animTreeFile) throws FileNotFoundException, IOException { - final Reader in = new InputStreamReader(new FileInputStream(animTreeFile), IOUtils.MAP_ENCODING); + final BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(animTreeFile), IOUtils.MAP_ENCODING)); try { loadAnimTree(in); } finally { @@ -189,9 +189,8 @@ * @param reader Input stream * @throws IOException in case of I/O errors */ - public void loadAnimTree(final Reader reader) throws IOException { - final BufferedReader in = reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader); - for (String line; (line = in.readLine()) != null;) { + private void loadAnimTree(final BufferedReader reader) throws IOException { + for (String line; (line = reader.readLine()) != null;) { final int index = line.lastIndexOf('/'); final String name = line.substring(index + 1); addAnimPath(name, line); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |