org.security.session.manager.helpers
Class UserLocationTree

Package class diagram package UserLocationTree
java.lang.Object
  extended by org.security.session.manager.helpers.LocationTreeWrapper
      extended by org.security.session.manager.helpers.UserLocationTree

public class UserLocationTree
extends LocationTreeWrapper

Extends LocationTreeWrapper to add a Set of Users to each node in the tree. In addition it manages the Allocation and Deallocation of users in the Location tree.

Author:
amedrano

Field Summary
 
Fields inherited from class org.security.session.manager.helpers.LocationTreeWrapper
loc
 
Constructor Summary
UserLocationTree(Location l)
          Model the given Location.
 
Method Summary
 void addUser(User u)
          Add a single User to this Location.
 Set<User> allocateUser(User u)
          Allocate a user in the Location tree, this means the user is logically located in all of the parent locations of this location.
 Set<User> deallocateUser(User u)
          Remove the User from the whole Location tree.
 UserLocationTree getMaxUser(User u)
          Calculate the uppermost Location in which the User is alone.
 Set<User> getUserSet()
          The user set is stored as a List in the actual Location instance, so this methods helps reformat that into a Set.
 void setUserSet(Set<User> users)
          Complement to getUserSet().
 
Methods inherited from class org.security.session.manager.helpers.LocationTreeWrapper
equals, getChildren, getLocation, getParent, getRoot, isRoot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserLocationTree

public UserLocationTree(Location l)
Model the given Location.

Parameters:
l -
Method Detail

getUserSet

public Set<User> getUserSet()
The user set is stored as a List in the actual Location instance, so this methods helps reformat that into a Set.

Returns:

setUserSet

public void setUserSet(Set<User> users)
Complement to getUserSet().

Parameters:
users -

addUser

public void addUser(User u)
Add a single User to this Location.

Parameters:
u -

deallocateUser

public Set<User> deallocateUser(User u)
Remove the User from the whole Location tree. There may be users affected by this movement, since they might be alone now that the other user is deallocated.

Parameters:
u - the user to be removed.
Returns:
the Set of Users affected.

allocateUser

public Set<User> allocateUser(User u)
Allocate a user in the Location tree, this means the user is logically located in all of the parent locations of this location. But all children locations must be marked too.

Parameters:
u - the allocated user.
Returns:
the affected Users by this allocation.

getMaxUser

public UserLocationTree getMaxUser(User u)
Calculate the uppermost Location in which the User is alone.

Parameters:
u -
Returns:
the UserLocationTree where the user is alone, null if it is not in the location tree, or she/he is not alone anywhere. TODO add delegation logic here.


Copyright © 2014 universAAL Consortium. All Rights Reserved.