Implement clone().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@456 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: DSet.java,v 1.9 2001/10/12 00:29:34 mdb Exp $
|
// $Id: DSet.java,v 1.10 2001/10/12 20:11:00 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.presents.dobj;
|
package com.threerings.presents.dobj;
|
||||||
|
|
||||||
@@ -38,7 +38,8 @@ import com.threerings.presents.io.Streamable;
|
|||||||
* removal event to save network bandwidth. Lastly, the object returned by
|
* removal event to save network bandwidth. Lastly, the object returned by
|
||||||
* <code>getKey()</code> must be a valid distributed object type.
|
* <code>getKey()</code> must be a valid distributed object type.
|
||||||
*/
|
*/
|
||||||
public class DSet implements Streamable
|
public class DSet
|
||||||
|
implements Streamable, Cloneable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Elements of the set must implement this interface.
|
* Elements of the set must implement this interface.
|
||||||
@@ -336,6 +337,18 @@ public class DSet implements Streamable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a shallow copy of this object.
|
||||||
|
*/
|
||||||
|
public Object clone ()
|
||||||
|
{
|
||||||
|
DSet nset = new DSet(_elementType);
|
||||||
|
nset._elements = new Element[_elements.length];
|
||||||
|
System.arraycopy(_elements, 0, nset._elements, 0, _elements.length);
|
||||||
|
nset._size = _size;
|
||||||
|
return nset;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a string representation of this set instance.
|
* Generates a string representation of this set instance.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user