clone() modernization.

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@889 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Ray Greenwell
2010-01-13 18:41:00 +00:00
parent 364659116b
commit 1a254f9e1d
12 changed files with 30 additions and 30 deletions
@@ -151,12 +151,12 @@ public abstract class GameConfig extends PlaceConfig
} }
@Override @Override
public Object clone () public GameConfig clone ()
{ {
try { try {
return super.clone(); return (GameConfig) super.clone();
} catch (CloneNotSupportedException cnse) { } catch (CloneNotSupportedException cnse) {
throw new RuntimeException(cnse); throw new AssertionError(cnse);
} }
} }
} }
@@ -420,7 +420,7 @@ public abstract class RatingDelegate extends GameManagerDelegate
modified = false; modified = false;
return rating; return rating;
} catch (CloneNotSupportedException cnse) { } catch (CloneNotSupportedException cnse) {
throw new RuntimeException(cnse); throw new AssertionError(cnse);
} }
} }
@@ -48,14 +48,14 @@ public abstract class Board
public abstract boolean equals (Board other); public abstract boolean equals (Board other);
@Override @Override
public Object clone () public Board clone ()
{ {
try { try {
Board board = (Board)super.clone(); Board board = (Board)super.clone();
board._rando = (BoardRandom)_rando.clone(); board._rando = _rando.clone();
return board; return board;
} catch (CloneNotSupportedException cnse) { } catch (CloneNotSupportedException cnse) {
throw new RuntimeException(cnse); throw new AssertionError(cnse);
} }
} }
@@ -162,11 +162,11 @@ public abstract class Board
} }
@Override @Override
public Object clone () { public BoardRandom clone () {
try { try {
return super.clone(); return (BoardRandom) super.clone();
} catch (CloneNotSupportedException cnse) { } catch (CloneNotSupportedException cnse) {
throw new RuntimeException(cnse); throw new AssertionError(cnse);
} }
} }
@@ -687,7 +687,7 @@ public class DropBoard extends Board
} }
@Override @Override
public Object clone () public DropBoard clone ()
{ {
DropBoard board = (DropBoard)super.clone(); DropBoard board = (DropBoard)super.clone();
board._board = _board.clone(); board._board = _board.clone();
@@ -74,7 +74,7 @@ public class StageLocation extends SimpleStreamableObject
// documentation inherited from interface Location // documentation inherited from interface Location
public Location getOpposite () public Location getOpposite ()
{ {
StageLocation opp = (StageLocation) clone(); StageLocation opp = clone();
opp.orient = (byte) DirectionUtil.getOpposite(orient); opp.orient = (byte) DirectionUtil.getOpposite(orient);
return opp; return opp;
} }
@@ -113,12 +113,12 @@ public class StageLocation extends SimpleStreamableObject
} }
@Override @Override
public Object clone () public StageLocation clone ()
{ {
try { try {
return super.clone(); return (StageLocation) super.clone();
} catch (CloneNotSupportedException cnse) { } catch (CloneNotSupportedException cnse) {
throw new RuntimeException(cnse); throw new AssertionError(cnse);
} }
} }
} }
@@ -153,7 +153,7 @@ public class StageScene extends SceneImpl
} }
@Override @Override
public Object clone () public StageScene clone ()
throws CloneNotSupportedException throws CloneNotSupportedException
{ {
// create a new scene with a clone of our model // create a new scene with a clone of our model
+4 -4
View File
@@ -194,12 +194,12 @@ public abstract class Stat
} }
@Override @Override
public Object clone () public Stat clone ()
{ {
try { try {
return super.clone(); return (Stat) super.clone();
} catch (Exception e) { } catch (CloneNotSupportedException e) {
throw new RuntimeException("Clone failed", e); throw new AssertionError(e);
} }
} }
@@ -31,6 +31,6 @@ public interface AuxModel extends Streamable, Cloneable
/** /**
* Creates a clone of this auxiliary model. * Creates a clone of this auxiliary model.
*/ */
public Object clone () public AuxModel clone ()
throws CloneNotSupportedException; throws CloneNotSupportedException;
} }
@@ -61,13 +61,13 @@ public class SceneModel extends SimpleStreamableObject
} }
@Override @Override
public Object clone () public SceneModel clone ()
throws CloneNotSupportedException throws CloneNotSupportedException
{ {
SceneModel model = (SceneModel)super.clone(); SceneModel model = (SceneModel)super.clone();
model.auxModels = new AuxModel[auxModels.length]; model.auxModels = new AuxModel[auxModels.length];
for (int ii = 0; ii < auxModels.length; ii++) { for (int ii = 0; ii < auxModels.length; ii++) {
model.auxModels[ii] = (AuxModel)auxModels[ii].clone(); model.auxModels[ii] = auxModels[ii].clone();
} }
return model; return model;
} }
@@ -51,5 +51,5 @@ public interface Location extends Streamable, Cloneable
/** /**
* Locations are cloneable. * Locations are cloneable.
*/ */
public Object clone (); public Location clone ();
} }
@@ -57,7 +57,7 @@ public class Portal extends SimpleStreamableObject
*/ */
public Location getLocation () public Location getLocation ()
{ {
return (Location) loc.clone(); return loc.clone();
} }
/** /**
@@ -85,12 +85,12 @@ public class Portal extends SimpleStreamableObject
} }
@Override @Override
public Object clone () public Portal clone ()
{ {
try { try {
return super.clone(); return (Portal) super.clone();
} catch (CloneNotSupportedException cnse) { } catch (CloneNotSupportedException cnse) {
throw new RuntimeException(cnse); throw new AssertionError(cnse);
} }
} }
@@ -64,14 +64,14 @@ public class SpotSceneModel extends SimpleStreamableObject
} }
@Override @Override
public Object clone () public SpotSceneModel clone ()
throws CloneNotSupportedException throws CloneNotSupportedException
{ {
SpotSceneModel model = (SpotSceneModel)super.clone(); SpotSceneModel model = (SpotSceneModel)super.clone();
// clone our portals individually // clone our portals individually
model.portals = new Portal[portals.length]; model.portals = new Portal[portals.length];
for (int ii = 0, ll = portals.length; ii < ll; ii++) { for (int ii = 0, ll = portals.length; ii < ll; ii++) {
model.portals[ii] = (Portal)portals[ii].clone(); model.portals[ii] = portals[ii].clone();
} }
return model; return model;
} }