From 55f054a63e471c4a539a515e30a28b25ac897be5 Mon Sep 17 00:00:00 2001 From: Jason Long Date: Thu, 14 Aug 2014 11:52:58 -0400 Subject: [PATCH] TileImage: refactor: s/readTileImage/readTileImageM this method is called in the context of the parent tag; it reads all tags that are children of the current tag and only returns one of them --- src/micropolisj/graphics/TileImage.java | 10 +++++++--- src/micropolisj/gui/TileImages.java | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/micropolisj/graphics/TileImage.java b/src/micropolisj/graphics/TileImage.java index dbc91b8..a90b196 100644 --- a/src/micropolisj/graphics/TileImage.java +++ b/src/micropolisj/graphics/TileImage.java @@ -109,7 +109,7 @@ public abstract class TileImage BufferedImage getImage(String name); } - public static SimpleTileImage readSimpleImage(XMLStreamReader in, LoaderContext ctx) + static SimpleTileImage readSimpleImage(XMLStreamReader in, LoaderContext ctx) throws XMLStreamException { SimpleTileImage img = new SimpleTileImage(); @@ -142,7 +142,7 @@ public abstract class TileImage } } - public static AnimatedTile readAnimation(XMLStreamReader in, LoaderContext ctx) + static AnimatedTile readAnimation(XMLStreamReader in, LoaderContext ctx) throws XMLStreamException { assert in.getLocalName().equals("animation"); @@ -162,7 +162,11 @@ public abstract class TileImage return anim; } - public static TileImage readTileImage(XMLStreamReader in, LoaderContext ctx) + /** + * @param in an XML stream reader with the parent tag of the tag to be read + * still selected + */ + public static TileImage readTileImageM(XMLStreamReader in, LoaderContext ctx) throws XMLStreamException { TileImage img = null; diff --git a/src/micropolisj/gui/TileImages.java b/src/micropolisj/gui/TileImages.java index cc64a56..59ca245 100644 --- a/src/micropolisj/gui/TileImages.java +++ b/src/micropolisj/gui/TileImages.java @@ -100,7 +100,7 @@ public class TileImages } String tileName = in.getAttributeValue(null, "name"); - TileImage img = readTileImage(in, ctx); + TileImage img = readTileImageM(in, ctx); assert tileName != null; assert img != null;