E - The type of user requests contained in the session.public class UserSession<E extends UserRequest> extends Object implements Sequence<E>
UserRequests. Each request follow the
previous one in time.| Modifier and Type | Field and Description |
|---|---|
protected Date |
endTime
The end time of the sequence.
|
protected Date |
startTime
The start time of the sequence.
|
| Constructor and Description |
|---|
UserSession(String userId)
Creates a new session for the user identified by the given id.
|
| Modifier and Type | Method and Description |
|---|---|
void |
enqueue(E request)
Add a new request to the session.
|
Date |
getEndTime()
Returns the end time of the sequence.
|
Date |
getStartTime()
Returns the start time of the sequence.
|
String |
getUserId()
Returns the id of the user who issued this request.
|
Iterator<E> |
iterator() |
void |
setUserId(String userId)
Set the id of the user who issued this request.
|
int |
size()
Returns the number of requests in the session.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorprotected Date startTime
protected Date endTime
public UserSession(String userId)
userId - The id of the user issuing the requests of the session.public String getUserId()
public void setUserId(String userId)
userId - The new user's id.public Date getStartTime()
public Date getEndTime()
public int size()
size in interface Sequence<E extends UserRequest>public Iterator<E> iterator()
iterator in interface Iterable<E extends UserRequest>public void enqueue(E request)
request - The request to add. Has to be later than the last request
added to the session (request.getTime() > this.getEndTime() ).Copyright © 2014–2018 University of Namur. All rights reserved.