Files
narya/src/java/com/threerings/miso/client/Cluster.java
T
Walter Korman 8d7c2fc4e9 Fixed bug in saving clusters to XML. Added checkbox to editor to
allow display of locations and cluster indexes.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@212 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-08-10 21:17:07 +00:00

88 lines
1.9 KiB
Java

//
// $Id: Cluster.java,v 1.2 2001/08/10 21:17:07 shaper Exp $
package com.threerings.miso.scene;
import java.util.ArrayList;
import com.samskivert.util.StringUtil;
/**
* A <code>Cluster</code> is a gathering of <code>Location</code> objects
* that represent a logical grouping for the purposes of display and
* interaction in a scene.
*
* <p> This class is currently just a wrapper around an
* <code>ArrayList</code>, but the theory is that we may soon want
* more useful functionality encapsulated herein, and the
* <code>Cluster</code> nomenclature is useful in any case.
*/
public class Cluster
{
/**
* Construct a <code>Cluster</code> object.
*/
public Cluster ()
{
_locations = new ArrayList();
}
/**
* Add a location to the cluster.
*
* @param loc the location.
*/
public void add (Location loc)
{
_locations.add(loc);
}
/**
* Return whether the cluster contains the given location.
*
* @param loc the location.
*/
public boolean contains (Location loc)
{
return _locations.contains(loc);
}
/**
* Removes the location from the cluster if present, and returns true
* if the location was present, false if not.
*
* @param loc the location.
*/
public boolean remove (Location loc)
{
return _locations.remove(loc);
}
/**
* Return the number of locations in the cluster.
*/
public int size ()
{
return _locations.size();
}
/**
* Return the list of locations that the cluster is made up of.
*/
public ArrayList getLocations ()
{
return _locations;
}
/**
* Return a string representation of this object.
*/
public String toString ()
{
return StringUtil.toString(_locations);
}
/** The list of locations in this cluster. */
protected ArrayList _locations;
}