From e69ad4d08fc31ceb58b6aac369b12de19c1609df Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Wed, 6 Jun 2012 15:53:07 +0200 Subject: [PATCH] Made Vector Comparable. --- src/main/java/com/sk89q/worldedit/Vector.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/sk89q/worldedit/Vector.java b/src/main/java/com/sk89q/worldedit/Vector.java index b1563e657..56cf29e4c 100644 --- a/src/main/java/com/sk89q/worldedit/Vector.java +++ b/src/main/java/com/sk89q/worldedit/Vector.java @@ -23,7 +23,7 @@ package com.sk89q.worldedit; * * @author sk89q */ -public class Vector { +public class Vector implements Comparable { protected final double x, y, z; /** @@ -691,6 +691,14 @@ public class Vector { return other.x == this.x && other.y == this.y && other.z == this.z; } + @Override + public int compareTo(BlockVector other) { + if (y != other.y) return Double.compare(y, other.y); + if (z != other.z) return Double.compare(z, other.z); + if (x != other.x) return Double.compare(x, other.x); + return 0; + } + /** * Gets the hash code. *