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
public Object clone ()
public GameConfig clone ()
{
try {
return super.clone();
return (GameConfig) super.clone();
} catch (CloneNotSupportedException cnse) {
throw new RuntimeException(cnse);
throw new AssertionError(cnse);
}
}
}
@@ -420,7 +420,7 @@ public abstract class RatingDelegate extends GameManagerDelegate
modified = false;
return rating;
} 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);
@Override
public Object clone ()
public Board clone ()
{
try {
Board board = (Board)super.clone();
board._rando = (BoardRandom)_rando.clone();
board._rando = _rando.clone();
return board;
} catch (CloneNotSupportedException cnse) {
throw new RuntimeException(cnse);
throw new AssertionError(cnse);
}
}
@@ -162,11 +162,11 @@ public abstract class Board
}
@Override
public Object clone () {
public BoardRandom clone () {
try {
return super.clone();
return (BoardRandom) super.clone();
} catch (CloneNotSupportedException cnse) {
throw new RuntimeException(cnse);
throw new AssertionError(cnse);
}
}
@@ -687,7 +687,7 @@ public class DropBoard extends Board
}
@Override
public Object clone ()
public DropBoard clone ()
{
DropBoard board = (DropBoard)super.clone();
board._board = _board.clone();
@@ -74,7 +74,7 @@ public class StageLocation extends SimpleStreamableObject
// documentation inherited from interface Location
public Location getOpposite ()
{
StageLocation opp = (StageLocation) clone();
StageLocation opp = clone();
opp.orient = (byte) DirectionUtil.getOpposite(orient);
return opp;
}
@@ -113,12 +113,12 @@ public class StageLocation extends SimpleStreamableObject
}
@Override
public Object clone ()
public StageLocation clone ()
{
try {
return super.clone();
return (StageLocation) super.clone();
} catch (CloneNotSupportedException cnse) {
throw new RuntimeException(cnse);
throw new AssertionError(cnse);
}
}
}
@@ -153,7 +153,7 @@ public class StageScene extends SceneImpl
}
@Override
public Object clone ()
public StageScene clone ()
throws CloneNotSupportedException
{
// create a new scene with a clone of our model
+4 -4
View File
@@ -194,12 +194,12 @@ public abstract class Stat
}
@Override
public Object clone ()
public Stat clone ()
{
try {
return super.clone();
} catch (Exception e) {
throw new RuntimeException("Clone failed", e);
return (Stat) super.clone();
} catch (CloneNotSupportedException e) {
throw new AssertionError(e);
}
}
@@ -31,6 +31,6 @@ public interface AuxModel extends Streamable, Cloneable
/**
* Creates a clone of this auxiliary model.
*/
public Object clone ()
public AuxModel clone ()
throws CloneNotSupportedException;
}
@@ -61,13 +61,13 @@ public class SceneModel extends SimpleStreamableObject
}
@Override
public Object clone ()
public SceneModel clone ()
throws CloneNotSupportedException
{
SceneModel model = (SceneModel)super.clone();
model.auxModels = new AuxModel[auxModels.length];
for (int ii = 0; ii < auxModels.length; ii++) {
model.auxModels[ii] = (AuxModel)auxModels[ii].clone();
model.auxModels[ii] = auxModels[ii].clone();
}
return model;
}
@@ -51,5 +51,5 @@ public interface Location extends Streamable, Cloneable
/**
* Locations are cloneable.
*/
public Object clone ();
public Location clone ();
}
@@ -57,7 +57,7 @@ public class Portal extends SimpleStreamableObject
*/
public Location getLocation ()
{
return (Location) loc.clone();
return loc.clone();
}
/**
@@ -85,12 +85,12 @@ public class Portal extends SimpleStreamableObject
}
@Override
public Object clone ()
public Portal clone ()
{
try {
return super.clone();
return (Portal) super.clone();
} catch (CloneNotSupportedException cnse) {
throw new RuntimeException(cnse);
throw new AssertionError(cnse);
}
}
@@ -64,14 +64,14 @@ public class SpotSceneModel extends SimpleStreamableObject
}
@Override
public Object clone ()
public SpotSceneModel clone ()
throws CloneNotSupportedException
{
SpotSceneModel model = (SpotSceneModel)super.clone();
// clone our portals individually
model.portals = new Portal[portals.length];
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;
}