Change a StreamableIntIntMap into a more standard StreamableHashMap

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@920 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Mike Thomas
2010-06-08 01:42:12 +00:00
parent 5959f4e2d9
commit 9e9ac7f2d3
2 changed files with 8 additions and 8 deletions
@@ -21,7 +21,7 @@
package com.threerings.stage.data; package com.threerings.stage.data;
import com.threerings.util.StreamableIntIntMap; import com.threerings.util.StreamableHashMap;
import com.threerings.whirled.data.SceneModel; import com.threerings.whirled.data.SceneModel;
import com.threerings.whirled.spot.data.SpotSceneModel; import com.threerings.whirled.spot.data.SpotSceneModel;
@@ -44,7 +44,7 @@ public class StageSceneModel extends SceneModel
/** If non-null, contains default colorizations to use for objects /** If non-null, contains default colorizations to use for objects
* that do not have colorizations defined. */ * that do not have colorizations defined. */
public StreamableIntIntMap defaultColors; public StreamableHashMap<Integer, Integer> defaultColors;
/** /**
* Get the default color to use for the specified colorization * Get the default color to use for the specified colorization
@@ -74,7 +74,7 @@ public class StageSceneModel extends SceneModel
} else { } else {
if (defaultColors == null) { if (defaultColors == null) {
defaultColors = new StreamableIntIntMap(); defaultColors = StreamableHashMap.newMap();
} }
defaultColors.put(classId, colorId); defaultColors.put(classId, colorId);
} }
@@ -21,6 +21,8 @@
package com.threerings.stage.tools.xml; package com.threerings.stage.tools.xml;
import java.util.Map;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl; import org.xml.sax.helpers.AttributesImpl;
@@ -65,14 +67,12 @@ public class StageSceneWriter extends SceneWriter
StageSceneModel sscene = (StageSceneModel)scene; StageSceneModel sscene = (StageSceneModel)scene;
if (sscene.defaultColors != null) { if (sscene.defaultColors != null) {
writer.startElement("zations"); writer.startElement("zations");
int[] keys = sscene.defaultColors.getKeys(); for (Map.Entry<Integer, Integer> entry : sscene.defaultColors.entrySet()) {
for (int key : keys) {
int value = sscene.defaultColors.get(key);
AttributesImpl attrs = new AttributesImpl(); AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "classId", "", "", attrs.addAttribute("", "classId", "", "",
String.valueOf(key)); String.valueOf(entry.getKey()));
attrs.addAttribute("", "colorId", "", "", attrs.addAttribute("", "colorId", "", "",
String.valueOf(value)); String.valueOf(entry.getValue()));
writer.emptyElement("", "zation", "", attrs); writer.emptyElement("", "zation", "", attrs);
} }
writer.endElement("zations"); writer.endElement("zations");