From 68e4faf5607ef8c074d5c99f1c55e12dc7282e7d Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Fri, 20 Aug 2004 08:58:50 +0000 Subject: [PATCH] Replaced assertion with proper exception in Vector.java --- src/java/org/lwjgl/util/vector/Vector.java | 42 +++++++++++----------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/java/org/lwjgl/util/vector/Vector.java b/src/java/org/lwjgl/util/vector/Vector.java index 73287f71..16222fdf 100644 --- a/src/java/org/lwjgl/util/vector/Vector.java +++ b/src/java/org/lwjgl/util/vector/Vector.java @@ -64,12 +64,12 @@ public abstract class Vector implements Serializable, ReadableVector { */ public abstract float lengthSquared(); - /** - * Load this vector from a FloatBuffer - * @param buf The buffer to load it from, at the current position - * @return this - */ - public abstract Vector load(FloatBuffer buf); + /** + * Load this vector from a FloatBuffer + * @param buf The buffer to load it from, at the current position + * @return this + */ + public abstract Vector load(FloatBuffer buf); /** * Negate a vector @@ -87,27 +87,25 @@ public abstract class Vector implements Serializable, ReadableVector { if (len != 0.0f) { float l = 1.0f / len; return scale(l); - } else { - assert false; - return this; - } + } else + throw new IllegalStateException("Zero length vector"); } - /** - * Store this vector in a FloatBuffer - * @param buf The buffer to store it in, at the current position - * @return this - */ - public abstract Vector store(FloatBuffer buf); + /** + * Store this vector in a FloatBuffer + * @param buf The buffer to store it in, at the current position + * @return this + */ + public abstract Vector store(FloatBuffer buf); - /** - * Scale this vector - * @param scale The scale factor - * @return this - */ - public abstract Vector scale(float scale); + /** + * Scale this vector + * @param scale The scale factor + * @return this + */ + public abstract Vector scale(float scale);