commit 476bbc81f177f4e92f1e1722a5a73c8bdea3556a
Author: Leszek Koltunski <leszek@distorted.org>
Date:   Mon Jun 13 23:19:04 2016 +0100

    Bugfix for removeByType

diff --git a/src/main/java/org/distorted/library/DistortedObject.java b/src/main/java/org/distorted/library/DistortedObject.java
index 885b042..ffb242b 100644
--- a/src/main/java/org/distorted/library/DistortedObject.java
+++ b/src/main/java/org/distorted/library/DistortedObject.java
@@ -386,18 +386,18 @@ public abstract class DistortedObject
  * Aborts a single Effect.
  * 
  * @param id ID of the Effect we want to abort.
- * @return <code>true</code> if the Effect was found and successfully aborted.
+ * @return number of Effects aborted. Always either 0 or 1.
  */
-    public boolean abortEffect(long id)
+    public int abortEffect(long id)
       {
       int type = (int)(id&EffectTypes.MASK);
 
-      if( type==EffectTypes.MATRIX.type   )  return mM.removeByID(id>>EffectTypes.LENGTH);
-      if( type==EffectTypes.VERTEX.type   )  return mV.removeByID(id>>EffectTypes.LENGTH);
-      if( type==EffectTypes.FRAGMENT.type )  return mF.removeByID(id>>EffectTypes.LENGTH);
-      if( type==EffectTypes.OTHER.type    )  return mO.removeByID(id>>EffectTypes.LENGTH);
+      if( type==EffectTypes.MATRIX.type   ) return mM.removeByID(id>>EffectTypes.LENGTH);
+      if( type==EffectTypes.VERTEX.type   ) return mV.removeByID(id>>EffectTypes.LENGTH);
+      if( type==EffectTypes.FRAGMENT.type ) return mF.removeByID(id>>EffectTypes.LENGTH);
+      if( type==EffectTypes.OTHER.type    ) return mO.removeByID(id>>EffectTypes.LENGTH);
 
-      return false;
+      return 0;
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -405,9 +405,9 @@ public abstract class DistortedObject
  * Abort all Effects of a given type, for example all rotations.
  * 
  * @param name one of the constants defined in {@link EffectNames}
- * @return <code>true</code> if a single Effect of type effectType has been found and aborted. 
+ * @return number of Effects aborted.
  */
-    public boolean abortEffects(EffectNames name)
+    public int abortEffects(EffectNames name)
       {
       switch(name.getType())
         {
@@ -415,7 +415,7 @@ public abstract class DistortedObject
         case VERTEX  : return mV.removeByType(name);
         case FRAGMENT: return mF.removeByType(name);
         case OTHER   : return mO.removeByType(name);
-        default      : return false;
+        default      : return 0;
         }
       }
     
diff --git a/src/main/java/org/distorted/library/EffectNames.java b/src/main/java/org/distorted/library/EffectNames.java
index 3e00247..e4a5367 100644
--- a/src/main/java/org/distorted/library/EffectNames.java
+++ b/src/main/java/org/distorted/library/EffectNames.java
@@ -1,8 +1,10 @@
 package org.distorted.library;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
-
-enum EffectNames 
+/**
+ * Names of Effects one can apply to DistortedObjects.
+ */
+public enum EffectNames
   {
   // EFFECT NAME /////// EFFECT TYPE ////////////// UNITY /////////////////////////
    
@@ -83,14 +85,7 @@ enum EffectNames
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
-  
-  public EffectTypes getType()
-    {
-    return type;  
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// yes, I know we could have used values(i)
+// yes, I know we could have used values(i) but that allocates a new copy each time!
 
   static EffectTypes getType(int ordinal)
     {
@@ -146,7 +141,17 @@ enum EffectNames
    
     return false;
     }
-  }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
-
+// PUBLIC API
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * Returns the Type of an individual Effect. For example, EffectNames.ROTATION.getType() will
+ * return EffectTypes.MATRIX.
+ * @return type of the effect.
+ */
+  public EffectTypes getType()
+    {
+    return type;
+    }
+  }
\ No newline at end of file
diff --git a/src/main/java/org/distorted/library/EffectQueue.java b/src/main/java/org/distorted/library/EffectQueue.java
index 4b34561..26a9aaf 100644
--- a/src/main/java/org/distorted/library/EffectQueue.java
+++ b/src/main/java/org/distorted/library/EffectQueue.java
@@ -132,24 +132,24 @@ abstract class EffectQueue
  
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  synchronized boolean removeByID(long id)
+  synchronized int removeByID(long id)
     {
     int i = getEffectIndex(id);
    
     if( i>=0 ) 
       {
       remove(i);
-      return true;
+      return 1;
       }
    
-    return false; 
+    return 0;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  synchronized boolean removeByType(EffectNames effect)
+  synchronized int removeByType(EffectNames effect)
     {
-    boolean ret = false;  
+    int ret = 0;
     int ord = effect.ordinal();  
      
     for(int i=0; i<mNumEffects; i++)
@@ -157,8 +157,8 @@ abstract class EffectQueue
       if( mType[i]==ord )
         {
         remove(i);
-        // TODO: don't we have to do a 'i--' here? Check this.
-        ret = true;
+        i--;
+        ret++;
         }
       }
    
