From 8e2c6ece61e662260c0c4998b4d7dad4d7e254b2 Mon Sep 17 00:00:00 2001 From: sk89q Date: Sat, 2 Oct 2010 15:12:45 -0700 Subject: [PATCH] Updated com.sk89q.worldedit.Point to use generics. --- src/EditSession.java | 14 +++++++------- src/com/sk89q/worldedit/Point.java | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/EditSession.java b/src/EditSession.java index fd0965fc3..7a66f86b7 100644 --- a/src/EditSession.java +++ b/src/EditSession.java @@ -29,8 +29,8 @@ public class EditSession { /** * Stores the original blocks before modification. */ - private HashMap original = new HashMap(); - private HashMap current = new HashMap(); + private HashMap,Integer> original = new HashMap,Integer>(); + private HashMap,Integer> current = new HashMap,Integer>(); /** * Sets a block without changing history. @@ -55,7 +55,7 @@ public class EditSession { * @return Whether the block changed */ public boolean setBlock(int x, int y, int z, int blockType) { - Point pt = new Point(x, y, z); + Point pt = new Point(x, y, z); if (!original.containsKey(pt)) { original.put(pt, getBlock(x, y, z)); } @@ -79,9 +79,9 @@ public class EditSession { * Restores all blocks to their initial state. */ public void undo() { - for (Map.Entry entry : original.entrySet()) { + for (Map.Entry,Integer> entry : original.entrySet()) { Point pt = (Point)entry.getKey(); - rawSetBlock((int)pt.getX(), (int)pt.getY(),(int)pt.getZ(), + rawSetBlock((Integer)pt.getX(), (Integer)pt.getY(),(Integer)pt.getZ(), (int)entry.getValue()); } } @@ -90,9 +90,9 @@ public class EditSession { * Sets to new state. */ public void redo() { - for (Map.Entry entry : current.entrySet()) { + for (Map.Entry,Integer> entry : current.entrySet()) { Point pt = (Point)entry.getKey(); - rawSetBlock((int)pt.getX(), (int)pt.getY(),(int)pt.getZ(), + rawSetBlock((Integer)pt.getX(), (Integer)pt.getY(),(Integer)pt.getZ(), (int)entry.getValue()); } } diff --git a/src/com/sk89q/worldedit/Point.java b/src/com/sk89q/worldedit/Point.java index 2d9ce5dec..5f14962c9 100644 --- a/src/com/sk89q/worldedit/Point.java +++ b/src/com/sk89q/worldedit/Point.java @@ -25,10 +25,10 @@ import org.apache.commons.lang3.builder.HashCodeBuilder; * * @author Albert */ -public final class Point { - private final double x, y, z; +public final class Point { + private final T x, y, z; - public Point(double x, double y, double z) { + public Point(T x, T y, T z) { this.x = x; this.y = y; this.z = z; @@ -37,7 +37,7 @@ public final class Point { /** * @return the x */ - public double getX() { + public T getX() { return x; } @@ -45,14 +45,14 @@ public final class Point { /** * @return the y */ - public double getY() { + public T getY() { return y; } /** * @return the z */ - public double getZ() { + public T getZ() { return z; }