Code example for Queue

Methods: offer, removeAll, size

0
	 * @throws IOException 
	 */ 
	public synchronized boolean changeAcceleration(int value, int servo) throws IOException{
		String command = "ACC;"+servo+";"+value+"\r\n";
		this.notifyAll();
		if(this.commandQueue.size()>=MAX_SIZE)
			this.commandQueue.removeAll(this.commandQueue);
		return this.commandQueue.offer(command);
	} 
 
	/** 
	 * Change the position of the servo motor identified by its position. 
	 * @param value The new position value. 
	 * @param servo The servo motor's position. 
	 * @return The command has been added to the command queue. 
	 * @throws IOException 
	 */ 
	public synchronized boolean changePosition(int value, int servo) throws IOException{
		String command = "MOVE;"+servo+";"+value+"\r\n";
		this.notifyAll();
		if(this.commandQueue.size()>=MAX_SIZE)