public class CallLog extends Object
A call log has a name and a list of call log entries. The call log and its name form an aggregation. The call log and its list of entries form a composition.
A call log ensures that no two log entries have dates that are equal.
| Constructor and Description |
|---|
CallLog() |
CallLog(String name)
Initializes this call log to have the given name and
zero entries.
|
CallLog(String name,
Date callDate,
PhoneNumber number)
Initializes this call log to have the given name and a size
equal to 1.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(CallLogEntry entry)
Adds an entry to this call log.
|
List<CallLogEntry> |
callsAfter(Date after)
Returns a sorted list of all of the entries in this call log
that occurred after the given date.
|
String |
getName()
Return the name of this call log.
|
Set<PhoneNumber> |
getPhoneNumbers()
Returns a set of all of the phone numbers in this call log.
|
void |
setName(String name)
Set the name of this call log.
|
int |
size()
Returns the number of entries in this call log.
|
public CallLog()
public CallLog(String name)
name - the non-null name of this call logpublic CallLog(String name, Date callDate, PhoneNumber number)
CallLogEntry
whose date is equal to callDate and whose
phone number is equal to number.name - the non-null name of this call logcallDate - the non-null date at which the call occurrednumber - the non-null phone number of the callpublic String getName()
public void setName(String name)
name - a non-null name for this call logpublic int size()
public Set<PhoneNumber> getPhoneNumbers()
public void add(CallLogEntry entry)
SameDateException
if the call log already contains an entry equal to
entry.getDate()entry - an entry to add to this call logSameDateException - if the call log already contains an
entry equal to entry.getDate()public List<CallLogEntry> callsAfter(Date after)
after - a non-null date