Some cleanup/fixup, although we're probably not going to use this...

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@268 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Ray Greenwell
2007-04-02 21:24:07 +00:00
parent 744127a192
commit a36376ccc2
@@ -34,9 +34,15 @@ import com.threerings.presents.dobj.DSet_Entry;
/** /**
* Contains information on clusters. * Contains information on clusters.
*/ */
public class Cluster extends Rectangle public class Cluster
implements DSet_Entry, Streamable /*, Hashable */ implements DSet_Entry, Streamable, Hashable
{ {
/** The bounding rectangle of this cluster. */
public var x :int;
public var y :int;
public var width :int;
public var height :int;
/** A unique identifier for this cluster (also the distributed object /** A unique identifier for this cluster (also the distributed object
* id of the cluster chat object). */ * id of the cluster chat object). */
public var clusterOid :int; public var clusterOid :int;
@@ -46,18 +52,25 @@ public class Cluster extends Rectangle
// nothing needed // nothing needed
} }
// documentation inherited // from Hashable
public function hashCode () :int public function hashCode () :int
{ {
return clusterOid; return clusterOid;
} }
// from Hashable
public function equals (o :Object) :Boolean
{
return (o is Cluster) && ((o as Cluster).clusterOid == this.clusterOid);
}
/** /**
* Generates a string representation of this instance. * Generates a string representation of this instance.
*/ */
override public function toString () :String public function toString () :String
{ {
return super.toString() + ", clusterOid=" + clusterOid; return "x=" + x + ", y=" + y + ", width=" + width + ", height=" + height +
", clusterOid=" + clusterOid;
} }
// documentation inherited from interface DSet_Entry // documentation inherited from interface DSet_Entry
@@ -69,16 +82,23 @@ public class Cluster extends Rectangle
// documentation inherited from interface Streamable // documentation inherited from interface Streamable
public function readObject (ins :ObjectInputStream) :void public function readObject (ins :ObjectInputStream) :void
{ {
x = ins.readInt();
y = ins.readInt();
width = ins.readInt();
height = ins.readInt();
clusterOid = ins.readInt(); clusterOid = ins.readInt();
} }
// documentation inherited from interface Streamable // documentation inherited from interface Streamable
public function writeObject (out :ObjectOutputStream) :void public function writeObject (out :ObjectOutputStream) :void
{ {
out.writeInt(x);
out.writeInt(y);
out.writeInt(width);
out.writeInt(height);
out.writeInt(clusterOid); out.writeInt(clusterOid);
} }
/** Used for {@link #getKey}. */
protected var _key :int;
} }
} }