Add associates() method to state objects

Change-Id: Ie62455b7b73424502ac01e2534482a3db99225ff
diff --git a/dev/js/spec/stateSpec.js b/dev/js/spec/stateSpec.js
index 865691e..6a2f32a 100644
--- a/dev/js/spec/stateSpec.js
+++ b/dev/js/spec/stateSpec.js
@@ -34,14 +34,17 @@
           this.x = value;
         }
       };
-      
+
+      expect(s.associates()).toEqual(0);
       expect(s.get()).toBeFalsy();
       expect(obj1.x).toBeFalsy();
       expect(obj2.x).toBeTruthy();
 
       // Associate object with state
       s.associate(obj1);
+      expect(s.associates()).toEqual(1);
       s.associate(obj2);
+      expect(s.associates()).toEqual(2);
 
       expect(s.get()).toBeFalsy();
       expect(obj1.x).toBeFalsy();
diff --git a/dev/js/src/state.js b/dev/js/src/state.js
index 013ae10..d561a8b 100644
--- a/dev/js/src/state.js
+++ b/dev/js/src/state.js
@@ -6,6 +6,12 @@
  *
  * @author Nils Diewald
  */
+/*
+ * TODO:
+ *   Add a "roll" parameter, like "roll":["left","right","center"]
+ *   and a roll() method, that will switch through the states in the list
+ *   for flexible toggling.
+ */
 define(function () {
 
   "use strict";
@@ -59,6 +65,14 @@
      */
     get : function () {
       return this.value;
+    },
+
+
+    /**
+     * Get the number of associated objects
+     */
+    associates : function () {
+      return this._assoc.length;
     }
   }
 });