From 25a657d7c63c777c6a35a9b1e27d61388fb63b4b Mon Sep 17 00:00:00 2001 From: Tom Conkling Date: Thu, 24 Jul 2008 20:11:41 +0000 Subject: [PATCH] apparently we already have a StreamableArrayIntSet; use that instead. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@676 c613c5cb-e716-0410-b11b-feb51c14d237 --- .../com/threerings/stats/data/IntSetStat.java | 36 ++----------------- 1 file changed, 3 insertions(+), 33 deletions(-) diff --git a/src/java/com/threerings/stats/data/IntSetStat.java b/src/java/com/threerings/stats/data/IntSetStat.java index a9379868..4c4a061d 100644 --- a/src/java/com/threerings/stats/data/IntSetStat.java +++ b/src/java/com/threerings/stats/data/IntSetStat.java @@ -5,11 +5,10 @@ package com.threerings.stats.data; import java.io.IOException; -import com.samskivert.util.ArrayIntSet; -import com.samskivert.util.IntSet; import com.samskivert.util.StringUtil; import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectOutputStream; +import com.threerings.util.StreamableArrayIntSet; /** * Used to track a statistic comprised of a bounded set of integers. @@ -80,7 +79,7 @@ public class IntSetStat extends Stat { _maxSize = ((int)in.readByte()) + 128; int numValues = ((int)in.readByte()) + 128; - _intSet = new ArrayIntSet(numValues); + _intSet = new StreamableArrayIntSet(numValues); for (int ii = 0; ii < numValues; ii++) { _intSet.add(in.readInt()); } @@ -93,37 +92,8 @@ public class IntSetStat extends Stat return StringUtil.toString(_intSet); } - /** Writes our custom streamable fields. */ - @Override // from Stat - public void writeObject (ObjectOutputStream out) - throws IOException - { - super.writeObject(out); - - out.writeInt(_intSet.size()); - for (int val : _intSet) { - out.writeInt(val); - } - } - - /** Reads our custom streamable fields. */ - @Override // from Stat - public void readObject (ObjectInputStream in) - throws IOException, ClassNotFoundException - { - super.readObject(in); - - int setSize = in.readInt(); - _intSet = new ArrayIntSet(setSize); - for (int ii = 0; ii < setSize; ii++) { - _intSet.add(in.readInt()); - } - } - protected int _maxSize; - - /** ArrayIntSet is not Streamable, so we implement writeObject() and readObject() ourselves. */ - protected transient IntSet _intSet = new ArrayIntSet(); + protected StreamableArrayIntSet _intSet = new StreamableArrayIntSet(); protected static final int MAX_MAX_SIZE = 255;