Sun SPOT API
Green Release  


com.sun.spot.peripheral.radio
Class Queue

java.lang.Object
  extended by com.sun.spot.peripheral.radio.Queue

public class Queue
extends Object

Implements a fully synchronised FIFO queue of Objects.


Constructor Summary
Queue()
           
 
Method Summary
 void empty()
          Drop the contents of the queue.
 Object get()
          Answer an element from the receiver.
 Object get(long timeout)
          Answer an element from the receiver.
 boolean isEmpty()
          Answer whether the receiver is empty.
 void put(Object o)
          Add an element to the receiver.
 int size()
          Answer the number of elements in the receiver.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Queue

public Queue()
Method Detail

isEmpty

public boolean isEmpty()
Answer whether the receiver is empty.

Returns:
- whether the receiver is empty.

size

public int size()
Answer the number of elements in the receiver.

Returns:
-- the number of elements in the receiver.

put

public void put(Object o)
Add an element to the receiver.

Parameters:
o - -- the Object to add

get

public Object get(long timeout)
Answer an element from the receiver. If the receiver is empty, block until either an element becomes available, or for timeout milliseconds. In the event of timeout, return null.

Parameters:
timeout - -- number of milliseconds to wait
Returns:
-- either the first element from the receiver or null after a timeout.

get

public Object get()
Answer an element from the receiver. If the receiver is empty, block (possibly forever) until an element becomes available.

Returns:
-- the first element from the receiver.

empty

public void empty()
Drop the contents of the queue.


Sun SPOT API
Green Release  


Copyright © 2006 Sun Microsystems, Inc. All Rights Reserved.