edu.jas.util
Class DistributedList

java.lang.Object
  extended by edu.jas.util.DistributedList

public class DistributedList
extends java.lang.Object

Distributed version of a List. Implemented with a SortedMap / TreeMap to keep the sequence order of elements.


Field Summary
protected  edu.unima.ky.parallel.ChannelFactory cf
           
protected  edu.unima.ky.parallel.SocketChannel channel
           
protected  Listener listener
           
protected  java.util.SortedMap theList
           
 
Constructor Summary
DistributedList(edu.unima.ky.parallel.ChannelFactory cf, java.lang.String host, int port)
           
DistributedList(edu.unima.ky.parallel.SocketChannel sc)
           
DistributedList(java.lang.String host)
          Constructs a new DistributedList
DistributedList(java.lang.String host, int port)
           
 
Method Summary
 void add(java.lang.Object o)
          Add object to the list and distribute to other lists.
 void clear()
          Clear the List caveat: must be called on all clients
 java.util.List getList()
          Get the internal list, convert from Collection
 boolean isEmpty()
          Is the List empty?
 java.util.Iterator iterator()
          List iterator
 int size()
          Size of the (local) list
 void terminate()
          Terminate the list thread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theList

protected final java.util.SortedMap theList

cf

protected final edu.unima.ky.parallel.ChannelFactory cf

channel

protected edu.unima.ky.parallel.SocketChannel channel

listener

protected Listener listener
Constructor Detail

DistributedList

public DistributedList(java.lang.String host)
Constructs a new DistributedList

Parameters:
host - Name or IP of server host

DistributedList

public DistributedList(java.lang.String host,
                       int port)

DistributedList

public DistributedList(edu.unima.ky.parallel.ChannelFactory cf,
                       java.lang.String host,
                       int port)

DistributedList

public DistributedList(edu.unima.ky.parallel.SocketChannel sc)
Method Detail

getList

public java.util.List getList()
Get the internal list, convert from Collection


size

public int size()
Size of the (local) list


add

public void add(java.lang.Object o)
Add object to the list and distribute to other lists. Blocks until the object is send and received from the server (actually it blocks until some object is received).


terminate

public void terminate()
Terminate the list thread


clear

public void clear()
Clear the List caveat: must be called on all clients


isEmpty

public boolean isEmpty()
Is the List empty?


iterator

public java.util.Iterator iterator()
List iterator