public abstract class UserDB
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
class |
UserDB.SE1 |
class |
UserDB.SE2 |
| Modifier and Type | Field and Description |
|---|---|
(package private) java.util.Collection<UserRecord> |
data
The collection of user data records.
|
(package private) GroupDB |
groupDB
Reference to GroupDB needed for change and delete methods.
|
| Constructor and Description |
|---|
UserDB() |
| Modifier and Type | Method and Description |
|---|---|
(package private) abstract void |
add(UserRecord ur)
Add the given UserRecord to the given UserDB.
|
(package private) abstract void |
change(UserRecord old_ur,
UserRecord new_ur)
Change the given old UserRecord to the given new record.
|
(package private) abstract LeaderlessGroupsWarning |
delete(UserRecord ur)
Delete the given user record from the given UserDB.
|
(package private) abstract UserRecord |
findById(java.lang.String id)
Find a user by unique id.
|
(package private) abstract java.util.List<UserRecord> |
findByName(java.lang.String name)
Find a user or users by real-world name.
|
java.util.Collection<UserRecord> data
GroupDB groupDB
abstract void add(UserRecord ur)
normal_behavior
pre:
//
// There is no user record in the input UserDB with the same id as the
// record to be added.
//
(! exists (UserRecord ur_other ;
data.contains(ur_other) ;
ur_other.id.equals(ur.id)))
&&
//
// The id of the given user record is not empty and 8 characters or
// less.
//
(ur.id != null) && (ur.id.length() > 0) && (ur.id.length() <= 8)
&&
//
// The email address is not empty.
//
(ur.email != null) && (ur.email.length() > 0)
&&
//
// If the phone area code and number are present, they must be 3 digits
// and 7 digits respectively.
//
((ur.phone.area != 0) ==>
Integer.toString(ur.phone.area).length() == 3) &&
((ur.phone.number != 0) ==>
Integer.toString(ur.phone.number).length() == 7);
post:
//
// A user record is in the output data if and only if it is the new
// record to be added or it is in the input data.
//
forall (UserRecord ur_other ;
(data'.contains(ur_other)) iff
ur_other.equals(ur) || data.contains(ur_other));
exceptional_behavior
signals (SE1 e) ur.id == null;
signals (SE1 e) ur.email == null;abstract UserRecord findById(java.lang.String id)
abstract java.util.List<UserRecord> findByName(java.lang.String name)
abstract void change(UserRecord old_ur, UserRecord new_ur)
abstract LeaderlessGroupsWarning delete(UserRecord ur)