public String toJsonLocked(){
  StringBuilder sb=new StringBuilder();
  boolean first=true;
  sb.append("[");
  int count=0;
  for (  Gesture g : mGestures) {
    if (!g.isComplete())     continue;
    if (!first)     sb.append(",");
    first=false;
    sb.append(g.toJson());
    count++;
  }
  mLastSaveLen=count;
  sb.append("]");
  return sb.toString();
}

public String toJsonLocked ( ) { StringBuilder sb = new StringBuilder ( ) ; boolean first = true ; sb . append ( "[" ) ; int count = 0 ; for ( Gesture g : mGestures ) { if ( ! g . isComplete ( ) ) continue ; if ( ! first ) sb . append ( "," ) ; first = false ; sb . append ( g . toJson ( ) ) ; count ++ ; } mLastSaveLen = count ; sb . append ( "]" ) ; return sb . toString ( ) ; }
generates a json string capturing all completed gestures . not threadsafe ; call with a lock .
