//
// $Id: Cluster.java,v 1.5 2003/03/26 23:42:41 mdb Exp $

package com.threerings.whirled.spot.data;

import java.awt.Rectangle;

import com.threerings.io.SimpleStreamableObject;
import com.threerings.presents.dobj.DSet;

/**
 * Contains information on clusters.
 */
public class Cluster extends SimpleStreamableObject
    implements DSet.Entry
{
    /** A unique identifier for this cluster (also the distributed object
     * id of the cluster chat object). */
    public int clusterOid;

    /** The bounds of the cluster in the scene. */
    public int x, y, width, height;

    /**
     * Returns the "footprint" of this cluster in tile coordinates.
     */
    public Rectangle getFootprint ()
    {
        return new Rectangle(x, y, width, height);
    }

    // documentation inherited
    public Comparable getKey ()
    {
        if (_key == null) {
            _key = new Integer(clusterOid);
        }
        return _key;
    }

    // documentation inherited
    public boolean equals (Object other)
    {
        if (other instanceof Cluster) {
            return ((Cluster)other).clusterOid == clusterOid;
        } else {
            return false;
        }
    }

    // documentation inherited
    public int hashCode ()
    {
        return clusterOid;
    }

    /** Used for {@link #geyKey}. */
    protected transient Integer _key;
}

@@ -25,9 +25,9 @@
 v 1.
-5
+6
  200
@@ -36,18 +36,18 @@
 03/2
-6 23:42:41
+7 15:57:47
  mdb
@@ -125,16 +125,56 @@
 angle;%0A%0A
+import com.samskivert.util.StringUtil;%0A%0A
 import c
@@ -214,16 +214,54 @@
 Object;%0A
+import com.threerings.io.Streamable;%0A%0A
 import c
@@ -369,38 +369,25 @@
 extends 
-SimpleStreamableObject
+Rectangle
 %0A    imp
@@ -404,16 +404,28 @@
 et.Entry
+, Streamable
 %0A%7B%0A    /
@@ -567,281 +567,8 @@
 d;%0A%0A
-    /** The bounds of the cluster in the scene. */%0A    public int x, y, width, height;%0A%0A    /**%0A     * Returns the %22footprint%22 of this cluster in tile coordinates.%0A     */%0A    public Rectangle getFootprint ()%0A    %7B%0A        return new Rectangle(x, y, width, height);%0A    %7D%0A%0A
     
@@ -1038,32 +1038,32 @@
 shCode ()%0A    %7B%0A
-
         return c
@@ -1076,24 +1076,190 @@
 Oid;%0A    %7D%0A%0A
+    /**%0A     * Generates a string representation of this instance.%0A     */%0A    public String toString ()%0A    %7B%0A        return StringUtil.fieldsToString(this);%0A    %7D%0A%0A
     /** Used

Make cluster extend Rectangle so that we get all of its lovely methods.