com.yosokumo.core
Class Roster

java.lang.Object
  extended by com.yosokumo.core.Roster

public class Roster
extends java.lang.Object

For each study, a list of users that have a role on the study. A roster has these attributes:


Method Summary
 boolean containsRole(java.lang.String userIdentifier)
          Test if a role is in the roster.
 Role getRole(java.lang.String userIdentifier)
          Return a role from the roster.
 java.util.Collection<Role> getRoleCollection()
          Return all roles in the roster as a Collection<Role>.
 java.lang.String getStudyIdentifier()
          Return the study identifier.
 java.lang.String getStudyName()
          Return the study name.
 java.util.Set<java.lang.String> getUserIdentifiersSet()
          Return the user identifiers of all the roles in the roster as a Set<String>.
 boolean isEmpty()
          Return true if the roster contains no roles.
 int size()
          Return the number of roles in the roster.
 java.lang.String toString()
          Return a string representation of this Roster.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getStudyIdentifier

public java.lang.String getStudyIdentifier()
Return the study identifier.

Returns:
the identifier of the study to which the roster belongs. May be null.

getStudyName

public java.lang.String getStudyName()
Return the study name.

Returns:
the name of the study to which the roster belongs. May be null.

getRole

public Role getRole(java.lang.String userIdentifier)
Return a role from the roster.

Parameters:
userIdentifier - the identifier of the Role to get from the roster.
Returns:
null means there is no role in the roster with the user identifier specified by the parameter. non-null means that there is a role in the roster with the user identifier specified by the parameter, and the return value is the specified role.

containsRole

public boolean containsRole(java.lang.String userIdentifier)
Test if a role is in the roster.

Parameters:
userIdentifier - the identifier of the Role to test for.
Returns:
false means there is no role in the roster with the user identifier specified by the parameter. true means that there is a role in the roster with the user identifier specified by the parameter.

size

public int size()
Return the number of roles in the roster.

Returns:
the number of roles in the roster.

isEmpty

public boolean isEmpty()
Return true if the roster contains no roles.

Returns:
true if the roster contains no roles. false otherwise.

getUserIdentifiersSet

public java.util.Set<java.lang.String> getUserIdentifiersSet()
Return the user identifiers of all the roles in the roster as a Set<String>. This makes it possible to iterate over the role identifiers like this:
   for (String s : roster.getUserIdentifiersSet())
{ process role identifier s }

Returns:
a set of the user identifiers of all roles in the roster.

getRoleCollection

public java.util.Collection<Role> getRoleCollection()
Return all roles in the roster as a Collection<Role>. This makes it possible to iterate over all roles in the roster like this:
   for (Role r : roster.getRoleCollection())
   {
       process role r
   }
 

Returns:
a collection of all roles in the roster.

toString

public java.lang.String toString()
Return a string representation of this Roster. Note that for a role in the roster only the role identifier is represented as a string, not the entire role.

Overrides:
toString in class java.lang.Object
Returns:
the string representation of this Roster.