ami
Class AMIResultTable

java.lang.Object
  |
  +--ami.AMIResultTable

public class AMIResultTable
extends Object

Manages results for an AR

Singleton

Version:
1.0
Author:
Bertrand Florat

Field Summary
private static AMIResultTable art
          Self instance used for signleton pattern
static AMISubject asub
          A subject ( see observer pattern )
private static Hashtable h
          The hashtable key is arid; the AR id and it contains an Object array with: max (Integer) : max nb of results for this AR retrieved (Integer) : nb of restrieved results for this AR results (Vector) : results themselves
 
Constructor Summary
private AMIResultTable()
          Default constructor
 
Method Summary
(package private) static boolean addResult(String sArid, AMIPublicKey apk)
          Add a result
(package private) static boolean addSearch(String sArid, Integer iMax)
          Notify a search
(package private) static boolean contains(String sArid)
          Returns true if the search exists
(package private) static boolean dropSearch(String sArid)
          Drop a search
static AMIResultTable getInstance()
          Return an instance of the Result Table Implementation of the singleton pattern
static Vector getResult(String sArid)
          Returns the existing results for a given AR.
static String getString()
          Returns a string representation of the result table
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

h

private static Hashtable h
The hashtable key is arid; the AR id and it contains an Object array with:

art

private static AMIResultTable art
Self instance used for signleton pattern

asub

public static AMISubject asub
A subject ( see observer pattern )
Constructor Detail

AMIResultTable

private AMIResultTable()
Default constructor
Method Detail

getInstance

public static AMIResultTable getInstance()
Return an instance of the Result Table

Implementation of the singleton pattern


addSearch

static boolean addSearch(String sArid,
                         Integer iMax)
Notify a search
Parameters:
sArid - the AR id
iMax - max number of replies for this AR
Returns:
true if the search is correctly added, false if search already exists

addResult

static boolean addResult(String sArid,
                         AMIPublicKey apk)
Add a result
Parameters:
sArid - AR id
apk - found peer pu
Returns:
false if the search doesn't exist

dropSearch

static boolean dropSearch(String sArid)
Drop a search
Parameters:
sArid - AR id
Returns:
true if ok

getResult

public static Vector getResult(String sArid)
Returns the existing results for a given AR. Returns null if AR doesn't exit

contains

static boolean contains(String sArid)
Returns true if the search exists

getString

public static String getString()
Returns a string representation of the result table