3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-09 21:10:05 +01:00

Make regions Cloneable

Dieser Commit ist enthalten in:
aumgn 2012-03-20 15:14:41 +01:00 committet von zml2008
Ursprung 56a8574129
Commit 842c469285
6 geänderte Dateien mit 29 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -66,4 +66,12 @@ public abstract class AbstractRegion implements Region {
expand(change); expand(change);
contract(change); contract(change);
} }
public AbstractRegion clone() {
try {
return (AbstractRegion) super.clone();
} catch (CloneNotSupportedException exc) {
return null;
}
}
} }

Datei anzeigen

@ -434,4 +434,8 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
public String toString() { public String toString() {
return getMinimumPoint() + " - " + getMaximumPoint(); return getMinimumPoint() + " - " + getMaximumPoint();
} }
public CuboidRegion clone() {
return (CuboidRegion) super.clone();
}
} }

Datei anzeigen

@ -388,4 +388,8 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion {
public String toString() { public String toString() {
return center + " - " + radius; return center + " - " + radius;
} }
public CylinderRegion clone() {
return (CylinderRegion) super.clone();
}
} }

Datei anzeigen

@ -275,4 +275,8 @@ public class EllipsoidRegion extends AbstractRegion {
public void extendRadius(Vector minRadius) { public void extendRadius(Vector minRadius) {
setRadius(Vector.getMaximum(minRadius, getRadius())); setRadius(Vector.getMaximum(minRadius, getRadius()));
} }
public EllipsoidRegion clone() {
return (EllipsoidRegion) super.clone();
}
} }

Datei anzeigen

@ -519,4 +519,10 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion {
sb.append(" * (" + minY + " - " + maxY + ")"); sb.append(" * (" + minY + " - " + maxY + ")");
return sb.toString(); return sb.toString();
} }
public Polygonal2DRegion clone() {
Polygonal2DRegion clone = (Polygonal2DRegion) super.clone();
clone.points = new ArrayList<BlockVector2D>(points);
return clone;
}
} }

Datei anzeigen

@ -29,7 +29,7 @@ import java.util.Set;
* *
* @author sk89q * @author sk89q
*/ */
public interface Region extends Iterable<BlockVector> { public interface Region extends Iterable<BlockVector>, Cloneable {
/** /**
* Get the lower point of a region. * Get the lower point of a region.
* *
@ -151,4 +151,6 @@ public interface Region extends Iterable<BlockVector> {
* @return * @return
*/ */
public void setWorld(LocalWorld world); public void setWorld(LocalWorld world);
public Region clone();
} }