commit cacc63de893a79a5454d2c921e311077c4db92ef
Author: Leszek Koltunski <leszek@distorted.org>
Date:   Thu Dec 15 23:37:52 2016 +0000

    Fix Lint warnings, correct a lot of comments, adjust EffectListener interface.

diff --git a/src/main/java/org/distorted/library/Distorted.java b/src/main/java/org/distorted/library/Distorted.java
index 3a7e7f7..c145de2 100644
--- a/src/main/java/org/distorted/library/Distorted.java
+++ b/src/main/java/org/distorted/library/Distorted.java
@@ -37,47 +37,41 @@ import org.distorted.library.exception.*;
 public class Distorted 
   {
   /**
-   * When creating an instance of a DistortedObject from another instance, do not clone anything.
+   * When creating an instance of a DistortedTexture (or Tree) from another instance, do not clone anything.
    * Used in the copy constructor.
    */
   public static final int CLONE_NOTHING = 0x0;
   /**
-   * When creating an instance of a DistortedObject from another instance, clone the Bitmap that's
-   * backing up our DistortedObject. 
+   * When creating an instance of a DistortedTexture from another instance, clone the Bitmap that's
+   * backing up our DistortedTexture.
    * <p>
-   * This way we can have two DistortedObjects, both backed up by the same Bitmap, to which we can 
+   * This way we can have two DistortedTextures, both backed up by the same Bitmap, to which we can
    * apply different effects. Used in the copy constructor.
    */
   public static final int CLONE_BITMAP  = 0x1;
   /**
-   * When creating an instance of a DistortedObject from another instance, clone the Matrix Effects.
+   * When creating an instance of a DistortedEffects from another instance, clone the Matrix Effects.
    * <p>
-   * This way we can have two different DistortedObjects with different Bitmaps behind them, both 
-   * always displayed in exactly the same place on the screen. Applying any matrix-based effect to 
-   * one of them automatically applies the effect to the other. Used in the copy constructor.
+   * This way we can have two different DistortedEffects sharing the MATRIX queue.
    */
   public static final int CLONE_MATRIX = 0x2;
   /**
-   * When creating an instance of a DistortedObject from another instance, clone the Vertex Effects.
+   * When creating an instance of a DistortedEffects from another instance, clone the Vertex Effects.
    * <p>
-   * This way we can have two different DistortedObjects with different Bitmaps behind them, both 
-   * always with the same Vertex effects. Applying any vertex-based effect to one of them automatically 
-   * applies the effect to the other. Used in the copy constructor.
+   * This way we can have two different DistortedEffects sharing the VERTEX queue.
    */
   public static final int CLONE_VERTEX  = 0x4;
   /**
-   * When creating an instance of a DistortedObject from another instance, clone the Fragment Effects.
+   * When creating an instance of a DistortedEffects from another instance, clone the Fragment Effects.
    * <p>
-   * This way we can have two different DistortedObjects with different Bitmaps behind them, both 
-   * always with the same Fragment effects. Applying any fragment-based effect to one of them automatically 
-   * applies the effect to the other. Used in the copy constructor.
+   * This way we can have two different DistortedEffects sharing the FRAGMENT queue.
    */
   public static final int CLONE_FRAGMENT= 0x8;
   /**
    * When creating an instance of a DistortedTree from another instance, clone the children Nodes.
    * <p>
-   * This is mainly useful for creating many similar sub-trees of Bitmaps and rendering then at different places
-   * on the screen, with (optionally) different effects of the top-level root Bitmap.   
+   * This is mainly useful for creating many similar sub-trees and rendering then at different places
+   * on the screen with (optionally) different Effects.
    */
   public static final int CLONE_CHILDREN= 0x10;
 
@@ -391,14 +385,14 @@ public class Distorted
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
- * Sets the maximum number of Matrix effects that can be applied to a single DistortedObject at one time.
+ * Sets the maximum number of Matrix effects that can be stored in a single EffectQueue at one time.
  * This can fail if:
  * <ul>
  * <li>the value of 'max' is outside permitted range (0 &le; max &le; Byte.MAX_VALUE)
  * <li>We try to increase the value of 'max' when it is too late to do so already. It needs to be called
  *     before the Vertex Shader gets compiled, i.e. before the call to {@link #onSurfaceCreated}. After this
  *     time only decreasing the value of 'max' is permitted.
- * <li>Furthermore, this needs to be called before any DistortedObject gets created.
+ * <li>Furthermore, this needs to be called before any DistortedEffects gets created.
  * </ul>
  * 
  * @param max new maximum number of simultaneous Matrix Effects. Has to be a non-negative number not greater
@@ -412,14 +406,14 @@ public class Distorted
   
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
- * Sets the maximum number of Vertex effects that can be applied to a single DistortedObject at one time.
+ * Sets the maximum number of Vertex effects that can be stored in a single EffectQueue at one time.
  * This can fail if:
  * <ul>
  * <li>the value of 'max' is outside permitted range (0 &le; max &le; Byte.MAX_VALUE)
  * <li>We try to increase the value of 'max' when it is too late to do so already. It needs to be called 
  *     before the Vertex Shader gets compiled, i.e. before the call to {@link #onSurfaceCreated}. After this
  *     time only decreasing the value of 'max' is permitted.
-* <li>Furthermore, this needs to be called before any DistortedObject gets created.
+* <li>Furthermore, this needs to be called before any DistortedEffects get created.
  * </ul>
  * 
  * @param max new maximum number of simultaneous Vertex Effects. Has to be a non-negative number not greater
@@ -433,14 +427,14 @@ public class Distorted
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
- * Sets the maximum number of Fragment effects that can be applied to a single DistortedObject at one time.
+ * Sets the maximum number of Fragment effects that can be stored in a single EffectQueue at one time.
  * This can fail if:
  * <ul>
  * <li>the value of 'max' is outside permitted range (0 &le; max &le; Byte.MAX_VALUE)
  * <li>We try to increase the value of 'max' when it is too late to do so already. It needs to be called 
  *     before the Fragment Shader gets compiled, i.e. before the call to {@link #onSurfaceCreated}. After this
  *     time only decreasing the value of 'max' is permitted.
- * <li>Furthermore, this needs to be called before any DistortedObject gets created.
+ * <li>Furthermore, this needs to be called before any DistortedEffects get created.
  * </ul>
  * 
  * @param max new maximum number of simultaneous Fragment Effects. Has to be a non-negative number not greater
diff --git a/src/main/java/org/distorted/library/EffectMessageSender.java b/src/main/java/org/distorted/library/EffectMessageSender.java
index 41ca82f..8f8bda6 100644
--- a/src/main/java/org/distorted/library/EffectMessageSender.java
+++ b/src/main/java/org/distorted/library/EffectMessageSender.java
@@ -35,16 +35,14 @@ final class EffectMessageSender extends Thread
     long mEffectID;
     int mEffectName;
     long mBitmapID;
-    String mStr;
 
-    Message(EffectListener l, EffectMessage m, long id, int name, long bmpID, String str)
+    Message(EffectListener l, EffectMessage m, long id, int name, long bmpID)
       {
       mListener   = l;
       mMessage    = m;
       mEffectID   = id;
       mEffectName = name;
       mBitmapID   = bmpID;
-      mStr        = str;
       }
     }
   
@@ -108,8 +106,7 @@ final class EffectMessageSender extends Thread
       while( mList.size()>0 )
         {
         tmp = mList.remove(0);
-        tmp.mListener.effectMessage(tmp.mMessage, tmp.mEffectID, EffectNames.getName(tmp.mEffectName),
-                                    tmp.mBitmapID, tmp.mStr);
+        tmp.mListener.effectMessage(tmp.mMessage, tmp.mEffectID, EffectNames.getName(tmp.mEffectName),tmp.mBitmapID);
         }
 
       synchronized(mThis)
@@ -131,9 +128,9 @@ final class EffectMessageSender extends Thread
   
 ///////////////////////////////////////////////////////////////////////////////////////////////////
         
-  static void newMessage(EffectListener l, EffectMessage m, long id, int name, long bmpID, String str)
+  static void newMessage(EffectListener l, EffectMessage m, long id, int name, long bmpID)
     {
-    Message msg = mThis.new Message(l,m,id,name,bmpID,str);
+    Message msg = mThis.new Message(l,m,id,name,bmpID);
     mList.add(msg);
 
     synchronized(mThis)
diff --git a/src/main/java/org/distorted/library/EffectNames.java b/src/main/java/org/distorted/library/EffectNames.java
index 54ed9b5..148d51d 100644
--- a/src/main/java/org/distorted/library/EffectNames.java
+++ b/src/main/java/org/distorted/library/EffectNames.java
@@ -21,7 +21,7 @@ package org.distorted.library;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
- * Names of Effects one can apply to DistortedObjects.
+ * Names of Effects one can add to the DistortedEffects queues.
  * <p>
  * Effect's 'Type' is one of the constants defined in {@link EffectTypes}.
  * </p>
@@ -144,7 +144,7 @@ public enum EffectNames
   SWIRL            ( EffectTypes.VERTEX  ,   new float[] {0.0f}           , 1, true, true ),
   /**
    * Directional sinusoidal wave effect. The direction of the wave is given by the 'angle'
-   * parameters. Details: {@link DistortedObject#wave(org.distorted.library.type.Data5D,org.distorted.library.type.Data3D)}
+   * parameters. Details: {@link DistortedEffects#wave(org.distorted.library.type.Data5D,org.distorted.library.type.Data3D)}
    * <p>
    * Uniforms: (amplitude,length,phase,angleAlpha,
    *            angleBeta, centerX,centerY,centerZ,
diff --git a/src/main/java/org/distorted/library/EffectQueue.java b/src/main/java/org/distorted/library/EffectQueue.java
index 53daa58..20063ad 100644
--- a/src/main/java/org/distorted/library/EffectQueue.java
+++ b/src/main/java/org/distorted/library/EffectQueue.java
@@ -92,8 +92,9 @@ abstract class EffectQueue
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
-// Only max Byte.MAX_VALUE concurrent effects per DistortedObject.
+// Only max Byte.MAX_VALUE concurrent effects per DistortedEffects object.
 // If you want more, change type of the mNumEffects, mIDIndex and mFreeIndexes variables to shorts.
+// (although probably this many uniforms will not fit in the shaders anyway!)
 
   static boolean setMax(int index, int m)
     {
@@ -216,8 +217,7 @@ abstract class EffectQueue
                                           EffectMessage.EFFECT_REMOVED,
                                           (removedID<<EffectTypes.LENGTH)+EffectNames.getType(removedName).type,
                                           removedName,
-                                          mObjectID,
-                                          null);
+                                          mObjectID);
         }
       }
 
@@ -266,8 +266,7 @@ abstract class EffectQueue
                                       EffectMessage.EFFECT_REMOVED,
                                       (removedID<<EffectTypes.LENGTH)+EffectNames.getType(removedName).type,
                                       removedName,
-                                      mObjectID,
-                                      null);
+                                      mObjectID);
     }
   
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/library/EffectQueueFragment.java b/src/main/java/org/distorted/library/EffectQueueFragment.java
index 4473222..5a136fe 100644
--- a/src/main/java/org/distorted/library/EffectQueueFragment.java
+++ b/src/main/java/org/distorted/library/EffectQueueFragment.java
@@ -76,8 +76,7 @@ class EffectQueueFragment extends EffectQueue
                                           EffectMessage.EFFECT_FINISHED,
                                           (mID[i]<<EffectTypes.LENGTH)+EffectTypes.FRAGMENT.type,
                                           mName[i],
-                                          mObjectID,
-                                          null);
+                                          mObjectID);
       
         if( EffectNames.isUnity(mName[i], mUniforms, NUM_UNIFORMS*i) )
           {
diff --git a/src/main/java/org/distorted/library/EffectQueueMatrix.java b/src/main/java/org/distorted/library/EffectQueueMatrix.java
index 8b8d48f..542153f 100644
--- a/src/main/java/org/distorted/library/EffectQueueMatrix.java
+++ b/src/main/java/org/distorted/library/EffectQueueMatrix.java
@@ -115,8 +115,7 @@ class EffectQueueMatrix extends EffectQueue
                                           EffectMessage.EFFECT_FINISHED,
                                          (mID[i]<<EffectTypes.LENGTH)+EffectTypes.MATRIX.type,
                                           mName[i],
-                                          mObjectID,
-                                          null);
+                                          mObjectID);
 
         if( EffectNames.isUnity(mName[i], mUniforms, NUM_UNIFORMS*i) )
           {
diff --git a/src/main/java/org/distorted/library/EffectQueueVertex.java b/src/main/java/org/distorted/library/EffectQueueVertex.java
index 2df6cc8..a27d577 100644
--- a/src/main/java/org/distorted/library/EffectQueueVertex.java
+++ b/src/main/java/org/distorted/library/EffectQueueVertex.java
@@ -86,8 +86,7 @@ class EffectQueueVertex extends EffectQueue
                                             EffectMessage.EFFECT_FINISHED,
                                            (mID[i]<<EffectTypes.LENGTH)+EffectTypes.VERTEX.type,
                                             mName[i],
-                                            mObjectID,
-                                            null);
+                                            mObjectID);
 
           if( EffectNames.isUnity(mName[i], mUniforms, NUM_UNIFORMS*i) )
             {
diff --git a/src/main/java/org/distorted/library/EffectTypes.java b/src/main/java/org/distorted/library/EffectTypes.java
index 898d78f..db14ae5 100644
--- a/src/main/java/org/distorted/library/EffectTypes.java
+++ b/src/main/java/org/distorted/library/EffectTypes.java
@@ -21,7 +21,7 @@ package org.distorted.library;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
- * Types of Effects one can apply to DistortedObjects.
+ * Types of Effects one can add to the DistortedEffects queues.
  * <p>
  * Each effect type goes to an independent queue; the queues get executed one-by-one
  * and are each a class descendant from EffectQueue.
diff --git a/src/main/java/org/distorted/library/GridCubes.java b/src/main/java/org/distorted/library/GridCubes.java
index 4555312..bb90cf5 100644
--- a/src/main/java/org/distorted/library/GridCubes.java
+++ b/src/main/java/org/distorted/library/GridCubes.java
@@ -162,7 +162,6 @@ public class GridCubes extends GridObject
      }   
 */
 ///////////////////////////////////////////////////////////////////////////////////////////////////
-// desc is guaranteed to be padded with 0s in the end (DistortedCubes constructor does it)
 
    private void prepareDataStructures(int cols, String desc, boolean frontOnly)
      {
diff --git a/src/main/java/org/distorted/library/GridFlat.java b/src/main/java/org/distorted/library/GridFlat.java
index 51a6c95..5f1c71a 100644
--- a/src/main/java/org/distorted/library/GridFlat.java
+++ b/src/main/java/org/distorted/library/GridFlat.java
@@ -30,8 +30,7 @@ public class GridFlat extends GridObject
   private int remainingVert;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
-// Create a flat, full grid. cols and rows is guaranteed (by DistortedBitmap constructor)
-// to be in 1,2,...,256.
+// Create a flat, full grid.
 
    private void computeNumberOfVertices(int cols, int rows)
      {
diff --git a/src/main/java/org/distorted/library/message/EffectListener.java b/src/main/java/org/distorted/library/message/EffectListener.java
index ebd9d13..84f5644 100644
--- a/src/main/java/org/distorted/library/message/EffectListener.java
+++ b/src/main/java/org/distorted/library/message/EffectListener.java
@@ -25,7 +25,7 @@ import org.distorted.library.EffectNames;
 
 /**
  * This interface lets users of the Distorted library get notified when something happens to one of the effects.
- * To receive the notifications, we first have to register with a call to {@link org.distorted.library.DistortedObject#addEventListener(EffectListener)}.
+ * To receive the notifications, we first have to register with a call to {@link org.distorted.library.DistortedEffects#registerForMessages(EffectListener)}.
  * List of all possible events that can happen is defined in {@link EffectMessage}
  */
 
@@ -36,17 +36,15 @@ public interface EffectListener
  * 
  * @param eventType  Type of event that happened.
  * @param effectID   ID of the effect the event happened to. This ID must have been previously returned by one
- *                   of the DistortedObject.{deform,distort,move,...} functions.
+ *                   of the DistortedEffects.{deform,distort,move,...} functions.
  * @param effectName Name of the effect as defined by EffectNames.
- * @param objectID   the ID of the DistortedObject object, as returned by {@link org.distorted.library.DistortedObject#getID()},
- *                   this event happened to. If the Object has been created using a copy constructor
- *                   from another instance of DistortedObject, the ID here will be the one of the original object.
- * @param message    Any message string associated with it. 'Failed' event types have one.
+ * @param objectID   the ID of the DistortedEffects object, as returned by {@link org.distorted.library.DistortedEffects#getID()},
+ *                   this event happened to.
  * @see EffectMessage
  * @see EffectNames
  */
    
-  void effectMessage(final EffectMessage eventType, final long effectID, final EffectNames effectName, final long objectID, final String message);
+  void effectMessage(final EffectMessage eventType, final long effectID, final EffectNames effectName, final long objectID);
   }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/library/message/EffectMessage.java b/src/main/java/org/distorted/library/message/EffectMessage.java
index 1e7f4ee..a1ec8b1 100644
--- a/src/main/java/org/distorted/library/message/EffectMessage.java
+++ b/src/main/java/org/distorted/library/message/EffectMessage.java
@@ -30,7 +30,7 @@ public enum EffectMessage
 /**
  * The effect has been removed. This can happen if:
  * <ul>
- * <li> someone explicitly removed the effect with a call to {@link org.distorted.library.DistortedObject#abortEffect(long)}
+ * <li> someone explicitly removed the effect with a call to {@link org.distorted.library.DistortedEffects#abortEffect(long)}
  *      (or one of the other 'abort' methods)
  * <li> the interpolation of the effect has finished and the end result is equal to the effect's unity.
  * </ul>    
@@ -49,14 +49,7 @@ public enum EffectMessage
  * If then the end effect is equal to the effect's unity, then immediately after this message you
  * will also get a EFFECT_REMOVED message.
  */
-  EFFECT_FINISHED,
-
-  /**
- * The effect has failed to properly execute.
- * <p>
- * Currently only OTHER effects (saving to PNG file and to a MP4 movie) can fail.
- */
-  EFFECT_FAILED
+  EFFECT_FINISHED
   }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/library/type/Dynamic3D.java b/src/main/java/org/distorted/library/type/Dynamic3D.java
index 1257e34..1de10b1 100644
--- a/src/main/java/org/distorted/library/type/Dynamic3D.java
+++ b/src/main/java/org/distorted/library/type/Dynamic3D.java
@@ -31,14 +31,7 @@ public class Dynamic3D extends Dynamic implements Data3D
   {
   private Vector<Static3D> vv;
   private Static3D prev, curr, next;
-/*
-private float a0,a1,a2;
-private float f0, f1;
-private float b00,b01,b02;
-private float b10,b11,b12;
-private float b20,b21,b22;
-private float oldTime;
-*/
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // no array bounds checking!
   
diff --git a/src/main/java/org/distorted/library/type/DynamicQuat.java b/src/main/java/org/distorted/library/type/DynamicQuat.java
index 3687a7c..2be4329 100644
--- a/src/main/java/org/distorted/library/type/DynamicQuat.java
+++ b/src/main/java/org/distorted/library/type/DynamicQuat.java
@@ -37,7 +37,7 @@ public class DynamicQuat extends Dynamic implements Data4D
 // omega, sinOmega, cosOmega - angle between pair of quaternions, its sinus and cosinus.
 //  
 // (vx,vy,vz,vw) is the original vector from vv (copied here so when interpolating we can see if it is 
-// still valid and if not - rebuild the Cache
+// still valid and if not - rebuild the Cache.
   
   private class VectorCacheQuat
     {
@@ -398,5 +398,3 @@ public class DynamicQuat extends Dynamic implements Data4D
     }  
 
   }
-///////////////////////////////////////////////////////////////////////////////////////////////////
-//
diff --git a/src/main/java/org/distorted/library/type/Static1D.java b/src/main/java/org/distorted/library/type/Static1D.java
index 8ee36e0..c7cc7b7 100644
--- a/src/main/java/org/distorted/library/type/Static1D.java
+++ b/src/main/java/org/distorted/library/type/Static1D.java
@@ -22,7 +22,7 @@ package org.distorted.library.type;
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * A 1-dimensional data structure containing a single float. The float has no particular meaning; 
- * when this data structure is used in Interpolators, we can think of it as a 1-dimensional Point 
+ * when this data structure is used in Dynamics, we can think of it as a 1-dimensional Point
  * a few of which the Dynamic interpolates between.
  */
 
@@ -106,7 +106,5 @@ public class Static1D implements Data1D
     {
     return x;  
     }
-  
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// end of class   
+
   }
diff --git a/src/main/java/org/distorted/library/type/Static2D.java b/src/main/java/org/distorted/library/type/Static2D.java
index c5b15c9..6ceb1e1 100644
--- a/src/main/java/org/distorted/library/type/Static2D.java
+++ b/src/main/java/org/distorted/library/type/Static2D.java
@@ -22,7 +22,7 @@ package org.distorted.library.type;
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * A 2-dimensional data structure containing two floats. The floats have no particular meaning; 
- * when this data structure is used in Interpolators, we can think of it as a 2-dimensional Point 
+ * when this data structure is used in Dynamics, we can think of it as a 2-dimensional Point
  * a few of which the Dynamic interpolates between.
  */
 
@@ -115,6 +115,4 @@ public class Static2D extends Static1D implements Data2D
     return y;  
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// end of class   
   }
diff --git a/src/main/java/org/distorted/library/type/Static3D.java b/src/main/java/org/distorted/library/type/Static3D.java
index c405264..ece8690 100644
--- a/src/main/java/org/distorted/library/type/Static3D.java
+++ b/src/main/java/org/distorted/library/type/Static3D.java
@@ -22,7 +22,7 @@ package org.distorted.library.type;
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * A 3-dimensional data structure containing three floats. The floats have no particular meaning; 
- * when this data structure is used in Interpolators, we can think of it as a 3-dimensional Point 
+ * when this data structure is used in Dynamics, we can think of it as a 3-dimensional Point
  * a few of which the Dynamic interpolates between.
  */
 
@@ -120,7 +120,5 @@ public class Static3D extends Static2D  implements Data3D
     {
     return z;  
     }
-  
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// end of class   
+
   }
diff --git a/src/main/java/org/distorted/library/type/Static4D.java b/src/main/java/org/distorted/library/type/Static4D.java
index d33af6c..1f3c4a4 100644
--- a/src/main/java/org/distorted/library/type/Static4D.java
+++ b/src/main/java/org/distorted/library/type/Static4D.java
@@ -126,7 +126,5 @@ public class Static4D extends Static3D implements Data4D
     {
     return w;  
     }
-  
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// end of class   
+
   }
diff --git a/src/main/java/org/distorted/library/type/Static5D.java b/src/main/java/org/distorted/library/type/Static5D.java
index 3f859af..77979ac 100644
--- a/src/main/java/org/distorted/library/type/Static5D.java
+++ b/src/main/java/org/distorted/library/type/Static5D.java
@@ -132,7 +132,5 @@ public class Static5D extends Static4D implements Data5D
     {
     return v;
     }
-  
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// end of class   
+
   }
