gt: 			float raccel = ((Float)args[10]).floatValue();
context: /*
   * Copyright (c) 2005-2009 Martin Kaltenbrunner <mkalten@iua.upf.edu>
   * Copyright (c) 2011 Miguel Ceriani <miguel.ceriani@gmail.com>
  
   * This file is part of Semantic Web Open datatafloW System (SWOWS).
   * It's based on TUIO Java backend - part of the reacTIVision project
  http://reactivision.sourceforge.net/
  
   * SWOWS (as well as TUIO Java backend) is free software: you can redistribute it and/or modify
   * it under the terms of the GNU Affero General Public License as
   * published by the Free Software Foundation, either version 3 of
   * the License, or (at your option) any later version.
  
   * SWOWS is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU Affero General Public License for more details.
  
   * You should have received a copy of the GNU Affero General
   * Public License along with SWOWS.  If not, see <http://www.gnu.org/licenses/>.
  */
  package org.swows.tuio;
  
  import java.util.Date;
  import java.util.Enumeration;
  import java.util.Hashtable;
  import java.util.Timer;
  import java.util.TimerTask;
  import java.util.Vector;
  
  import org.swows.runnable.LocalTimer;
  
  import com.illposed.osc.OSCListener;
  import com.illposed.osc.OSCMessage;
  import com.illposed.osc.OSCPortIn;
  
  import TUIO.TuioCursor;
  import TUIO.TuioListener;
  import TUIO.TuioObject;
  import TUIO.TuioTime;
  
  /**
  * The TuioClient class is the central TUIO protocol decoder component. It provides a simple callback infrastructure using the {@link TuioListener} interface.
  * In order to receive and decode TUIO messages an instance of TuioClient needs to be created. The TuioClient instance then generates TUIO events
  * which are broadcasted to all registered classes that implement the {@link TuioListener} interface.<P> 
  * <code>
  * TuioClient client = new TuioClient();<br/>
  * client.addTuioListener(myTuioListener);<br/>
  * client.connect();<br/>
  * </code>
  *
  * @author Martin Kaltenbrunner
  * @version 1.4
  */ 
  public class TuioClient implements OSCListener {
  	
  	private static final int DEFAULT_PORT = 3333;
  
  	private boolean autoRefresh;
  	
  private int port;
  private OSCPortIn oscPort;
  private boolean connected = false;
  private Hashtable<Long,TuioObject> objectList = new Hashtable<Long,TuioObject>();
  private Vector<Long> aliveObjectList = new Vector<Long>();
  private Vector<Long> newObjectList = new Vector<Long>();
  private Hashtable<Long,TuioCursor> cursorList = new Hashtable<Long,TuioCursor>();
  private Vector<Long> aliveCursorList = new Vector<Long>();
  private Vector<Long> newCursorList = new Vector<Long>();
  
  private Vector<TuioObject> frameObjects = new Vector<TuioObject>();
  private Vector<TuioCursor> frameCursors = new Vector<TuioCursor>();
  
  private Vector<TuioCursor> freeCursorList = new Vector<TuioCursor>();
  private int maxCursorID = -1;
  
  private long currentFrame = 0;
  private TuioTime currentTime;
  
  private Vector<TuioListener> listenerList = new Vector<TuioListener>();
  
  /**
   * The default constructor creates a client that listens to the default TUIO port 3333
   */
  public TuioClient() {
  	this(DEFAULT_PORT);	
  }
  
  /**
   * This constructor creates a client that listens to the default TUIO port 3333 with provided refresh mode
   *
   * @param  autoRefresh  if set to true this object will regularly send refresh to listeners even if no new messages have been received
   */
  public TuioClient(boolean autoRefresh) {
  	this(DEFAULT_PORT, autoRefresh);
  }
  	
  /**
   * This constructor creates a client that listens to the provided port
   *
   * @param  port  the listening port number
   */
  public TuioClient(int port) {
  	this(port, false);
  }
  	
  /**
   * This constructor creates a client that listens to the provided port with provided refresh mode
   *
   * @param  port  the listening port number
   * @param  autoRefresh  if set to true this object will regularly send refresh to listeners even if no new messages have been received
   */
  public TuioClient(int port, boolean autoRefresh) {
  	this.port = port;
  	this.autoRefresh = autoRefresh;
  }
  	
  /**
   * The TuioClient starts listening to TUIO messages on the configured UDP port
   * All reveived TUIO messages are decoded and the resulting TUIO events are broadcasted to all registered TuioListeners
   */
  public void connect() {
  
  	TuioTime.initSession();
  	currentTime = new TuioTime();
  	currentTime.reset();
  
  	if (autoRefresh) {
  //		Timer updateTimer = new Timer();
  		Timer updateTimer = LocalTimer.get();
  		updateTimer.schedule( new TimerTask() {
  			@Override
  			public void run() {
  				synchronized(TuioClient.this) {
  					for (int i=0;i<listenerList.size();i++) {
  						TuioListener listener = (TuioListener)listenerList.elementAt(i);
  						if (listener!=null)
  							listener.refresh(TuioTime.getSessionTime());
  					}
  				}
  			}
  		}, 25, 25);
  //		Thread refresherThread =
  //				(new Thread() {
  //					@Override
  //					public void run() {
  //						while(true) {
  //							Thread.yield();
  //							synchronized(TuioClient.this) {
  //								for (int i=0;i<listenerList.size();i++) {
  //									TuioListener listener = (TuioListener)listenerList.elementAt(i);
  //									if (listener!=null) listener.refresh(TuioTime.getSessionTime());
  //								}
  //							}
  //						}
  //					}
  //				});
  //		refresherThread.setPriority(Thread.MIN_PRIORITY);
  //		refresherThread.start();
  	}
  	
  	try {
  		oscPort = new OSCPortIn(port);
  		oscPort.addListener("/tuio/2Dobj",this);
  		oscPort.addListener("/tuio/2Dcur",this);
  		oscPort.startListening();
  		connected = true;
  	} catch (Exception e) {
  		System.out.println("TuioClient: failed to connect to port "+port);
  		connected = false;
  	}		
  }
  
  /**
   * The TuioClient stops listening to TUIO messages on the configured UDP port
   */
  public void disconnect() {
  	oscPort.stopListening();
  	try { Thread.sleep(100); }
  	catch (Exception e) {};
  	oscPort.close();
  	connected = false;
  }
  
  /**
   * Returns true if this TuioClient is currently connected.
   * @return	true if this TuioClient is currently connected
   */
  public boolean isConnected() { return connected; }
  
  /**
   * Adds the provided TuioListener to the list of registered TUIO event listeners
   *
   * @param  listener  the TuioListener to add
   */
  public void addTuioListener(TuioListener listener) {
  	listenerList.addElement(listener);
  }
  
  /**
   * Removes the provided TuioListener from the list of registered TUIO event listeners
   *
   * @param  listener  the TuioListener to remove
   */
  public void removeTuioListener(TuioListener listener) {	
  	listenerList.removeElement(listener);
  }
  
  /**
   * Removes all TuioListener from the list of registered TUIO event listeners
   */
  public void removeAllTuioListeners() {	
  	listenerList.clear();
  }
  
  /**
   * Returns a Vector of all currently active TuioObjects
   *
   * @return  a Vector of all currently active TuioObjects
   */
  public Vector<TuioObject> getTuioObjects() {
  	return new Vector<TuioObject>(objectList.values());
  }
  
  /**
   * Returns a Vector of all currently active TuioCursors
   *
   * @return  a Vector of all currently active TuioCursors
   */
  public Vector<TuioCursor> getTuioCursors() {
  	return new Vector<TuioCursor>(cursorList.values());
  }	
  
  /**
   * Returns the TuioObject corresponding to the provided Session ID
   * or NULL if the Session ID does not refer to an active TuioObject
   *
   * @return  an active TuioObject corresponding to the provided Session ID or NULL
   */
  public TuioObject getTuioObject(long s_id) {
  	return objectList.get(s_id);
  }
  
  /**
   * Returns the TuioCursor corresponding to the provided Session ID
   * or NULL if the Session ID does not refer to an active TuioCursor
   *
   * @return  an active TuioCursor corresponding to the provided Session ID or NULL
   */
  public TuioCursor getTuioCursor(long s_id) {
  	return cursorList.get(s_id);
  }	
  
  /**
   * The OSC callback method where all TUIO messages are received and decoded
   * and where the TUIO event callbacks are dispatched
   *
   * @param  date	the time stamp of the OSC bundle
   * @param  message	the received OSC message
   */
  public synchronized void acceptMessage(Date date, OSCMessage message) {
  
  	Object[] args = message.getArguments();
  	String command = (String)args[0];
  	String address = message.getAddress();
  
  	if (address.equals("/tuio/2Dobj")) {
  
  		if (command.equals("set")) {
  			
  			long s_id  = ((Integer)args[1]).longValue();
  			int c_id  = ((Integer)args[2]).intValue();
  			float xpos = ((Float)args[3]).floatValue();
  			float ypos = ((Float)args[4]).floatValue();
  			float angle = ((Float)args[5]).floatValue();
  			float xspeed = ((Float)args[6]).floatValue();
  			float yspeed = ((Float)args[7]).floatValue();
  			float rspeed = ((Float)args[8]).floatValue();
  			float maccel = ((Float)args[9]).floatValue();
  