issrg.pba.rbac
Class SetOfSubsetsCredentials

java.lang.Object
  extended by issrg.pba.rbac.SetOfSubsetsCredentials
All Implemented Interfaces:
Credentials, java.lang.Cloneable

public class SetOfSubsetsCredentials
extends java.lang.Object
implements Credentials

This class implements the Credentials interface, as needed for representing the set of subsets.

The object can contain a set of any credentials and tell if it contains other credentials and build unions and intersections with other credentials.

Version:
0.2
Author:
E Ball, A Otenko, D Chadwick

Constructor Summary
SetOfSubsetsCredentials()
          This constructor creates an object with no credentials: an empty set of credentials.
SetOfSubsetsCredentials(Credentials[] Creds)
          This constructor builds a Credential object from an array of Credentials.
SetOfSubsetsCredentials(java.util.Vector creds)
          This constructor also builds the set from the given array of credentials, but the array of credentials is supplied as a vector.
 
Method Summary
 java.lang.Object clone()
          This method creates a copy of this credentials set.
 boolean contains(Credentials subSet)
          This method checks to see if the given set of credentials is contained in this object.
 boolean equals(Credentials creds)
          This method checks to see if the supplied credentials (roles) are equal to the credentials contained in this object.
 boolean equals(java.lang.Object o)
          This method compares this credentials object to another object.
 java.util.Vector getValue()
          This method returns the set of credentials
 Credentials intersection(Credentials set)
          This method builds an intersection of this credentials set with another set.
 boolean partOf(Credentials superSet)
          This method tells if this set of subsets is a part of the given credentials object.
 java.lang.String toString()
           
 Credentials union(Credentials set)
          This method returns a union of this credential set with another one.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SetOfSubsetsCredentials

public SetOfSubsetsCredentials()
This constructor creates an object with no credentials: an empty set of credentials.


SetOfSubsetsCredentials

public SetOfSubsetsCredentials(Credentials[] Creds)
This constructor builds a Credential object from an array of Credentials.

Parameters:
Creds - is the array of credentials to be contained in this set

SetOfSubsetsCredentials

public SetOfSubsetsCredentials(java.util.Vector creds)
This constructor also builds the set from the given array of credentials, but the array of credentials is supplied as a vector.

Parameters:
creds - is the Vector of Credential objects to be included in the set
Method Detail

getValue

public java.util.Vector getValue()
This method returns the set of credentials

Returns:
the Vector of credentials in this set; cannot be null, but can be empty; all elements are of type Credential

contains

public boolean contains(Credentials subSet)
This method checks to see if the given set of credentials is contained in this object. That is, for each Credential contained in the set there is at least one Credential that can grant more or the same privilege.

Specified by:
contains in interface Credentials
Parameters:
subSet - the credentials object (even a set of subsets) that must be a sub-set of this object
Returns:
true, if subSet is fully contained within this object; false, otherwise

partOf

public boolean partOf(Credentials superSet)
This method tells if this set of subsets is a part of the given credentials object. It is used by the SubsetCredentials class.

Parameters:
superSet - is the credentials object that must be a superset of this set
Returns:
true, if the given set of credentials contains this set

equals

public boolean equals(Credentials creds)
This method checks to see if the supplied credentials (roles) are equal to the credentials contained in this object. a.equals(b) and b.equals(a) are both equivalent to (a.contains(b) && b.contains(a)).

Parameters:
creds - is the credentials object to compare to
Returns:
true if this credentials object is equal to the given set

equals

public boolean equals(java.lang.Object o)
This method compares this credentials object to another object. First it checks if that object is a credentials object, then calls equals(Credentials).

Overrides:
equals in class java.lang.Object
Parameters:
o - is the object to compare to
Returns:
true, if o is a credentials object and it is equal to this set
See Also:
equals(Credentials)

clone

public java.lang.Object clone()
This method creates a copy of this credentials set.

Specified by:
clone in interface Credentials
Overrides:
clone in class java.lang.Object
Returns:
the SetOfSubsetsCredentials

intersection

public Credentials intersection(Credentials set)
This method builds an intersection of this credentials set with another set.

The method just intersects each component of the stored set with the given set and collects the result in a credentials object.

Specified by:
intersection in interface Credentials
Parameters:
set - is the set of credentials to intersect with
Returns:
the Credentials object that is the intersection of the two sets; it is contained by both of the sets

union

public Credentials union(Credentials set)
This method returns a union of this credential set with another one.

It just collects all the credentials from the given set that are not contained in any of the elements of the other set.

Specified by:
union in interface Credentials
Parameters:
set - is the set to join with
Returns:
the Credential set representing the union of the two sets; it contains both of the sets

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object