PaP
Class RoleSessionCollection

java.lang.Object
  |
  +--PaP.RoleSessionCollection
All Implemented Interfaces:
java.io.Serializable

public class RoleSessionCollection
extends java.lang.Object
implements java.io.Serializable

RoleSessionCollection is a collection of all the RoleSessions for an Actor. It contains methods for adding, retrieving and removing rolesessions from the collection, as well as utility methods for searching for a specified rolesession and listing all the rolesession in the collection.

See Also:
RoleSession, Serialized Form

Field Summary
private  java.util.Vector vRS
           
 
Constructor Summary
RoleSessionCollection()
          Creates a new RoleSessionCollection.
 
Method Summary
 void addRoleSession(RoleSession pRS)
          Adds the specified RoleSession to the collection.
 RoleSession findRoleSession(java.lang.String pRSId)
          Searches through the collection for the specified rolesession and returns it if it is found.
 int getCollectionSize()
          Returns the number of rolesessions in this collection.
 RoleSession initialRoleSession()
          Returns the first rolesession in the collection.
 boolean lastRoleSession()
          Returns wether there is only one more rolesession in the collection.
 boolean lastRoleSession(GAI pActor)
          Returns wether the collection contains only one rolesessions where the specified Actor is either a cooperator or initiator.
 Item listRoleSessions()
          Returns a list of all the rolesessions in the collection in the form of an Item.
 boolean noMoreRoleSessions()
          Simple utility to check wether there are no more RoleSessions in this collection.
 boolean removeRoleSession(RoleSession pRS, boolean pApo)
          Removes the specified RoleSession from the collection.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

vRS

private java.util.Vector vRS
Constructor Detail

RoleSessionCollection

public RoleSessionCollection()
Creates a new RoleSessionCollection.
Method Detail

addRoleSession

public void addRoleSession(RoleSession pRS)
Adds the specified RoleSession to the collection. NOTE: Should return a boolean to give failure indication.
Parameters:
pRS - The RoleSession to be added to the collection.

findRoleSession

public RoleSession findRoleSession(java.lang.String pRSId)
Searches through the collection for the specified rolesession and returns it if it is found.
Parameters:
pRSId - The name of the rolesession.
Returns:
Returns the rolesession if it is found, else it returns null.

getCollectionSize

public int getCollectionSize()
Returns the number of rolesessions in this collection.
Returns:
The size of the Vector.

initialRoleSession

public RoleSession initialRoleSession()
Returns the first rolesession in the collection. This should always be the initial rolesession.
Returns:
The first rolesession in the collection.

lastRoleSession

public boolean lastRoleSession()
Returns wether there is only one more rolesession in the collection.
Returns:
Returns true if the size of the collection is 1, false otherwise.

lastRoleSession

public boolean lastRoleSession(GAI pActor)
Returns wether the collection contains only one rolesessions where the specified Actor is either a cooperator or initiator.
Parameters:
pActor - The actor that must be part of the rolesession.
Returns:
Wether the collection contains only one rolesessions that matches the specified criteria.

listRoleSessions

public Item listRoleSessions()
Returns a list of all the rolesessions in the collection in the form of an Item. An Item is an information element that can contain other Items in a hierarchy. The returned Item contains an array of Items. Each of those Items has their name-variable equal the rolesessionID and their value-variable equal a concatenation of the rolesession initiator and cooperator.
Returns:
All the rolesessions in the collection as an Item.

noMoreRoleSessions

public boolean noMoreRoleSessions()
Simple utility to check wether there are no more RoleSessions in this collection.
Returns:
Returns true if there are no more rolesessions in the collection ,false otherwise.

removeRoleSession

public boolean removeRoleSession(RoleSession pRS,
                                 boolean pApo)
Removes the specified RoleSession from the collection. If there are no more rolesessions in the collection and ..??
Parameters:
pRS - The rolesession to be removed from the collection.
Returns:
Returns true if the removed rolesession was the last one in the Collection.
See Also:
Item