E
- The event implementation.public class Schedule<E extends Schedule.Event>
extends AbstractSet<E>
implements Iterator<E>
Modifier and Type | Class and Description |
---|---|
static interface |
Schedule.Event
Event.
|
static class |
Schedule.PointEvent
Point event.
|
Constructor and Description |
---|
Schedule(boolean future)
Constructs an instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(E event) |
void |
advance()
Advances to the next event.
|
void |
cancel(E event)
Cancels an event.
|
protected void |
cancelWait()
Cancels wait.
|
void |
clear() |
boolean |
contains(Object object) |
boolean |
containsAll(Collection<?> collection) |
boolean |
equals(Object other) |
long |
getDelay()
Gets the delay before the first event is due.
|
protected NavigableSet<E> |
getEvents()
Gets the events.
|
protected Object |
getMutex()
Gets the mutex.
|
int |
hashCode() |
boolean |
hasNext() |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
E |
next() |
protected Optional<E> |
next(boolean wait)
Returns the next event.
|
Optional<E> |
peek()
Peeks at the first event.
|
void |
remove() |
boolean |
remove(Object object) |
boolean |
removeAll(Collection<?> collection) |
boolean |
retainAll(Collection<?> collection) |
protected void |
rollback()
Rolls back the latest call to
next(boolean) . |
int |
size() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] array) |
String |
toString() |
public Schedule(boolean future)
future
- True to schedule only in the future.public final boolean add(E event)
add
in interface Collection<E extends Schedule.Event>
add
in interface Set<E extends Schedule.Event>
add
in class AbstractCollection<E extends Schedule.Event>
public final void advance()
public final void cancel(@Nonnull E event)
event
- The event.public final void clear()
clear
in interface Collection<E extends Schedule.Event>
clear
in interface Set<E extends Schedule.Event>
clear
in class AbstractCollection<E extends Schedule.Event>
public final boolean contains(Object object)
contains
in interface Collection<E extends Schedule.Event>
contains
in interface Set<E extends Schedule.Event>
contains
in class AbstractCollection<E extends Schedule.Event>
public final boolean containsAll(Collection<?> collection)
containsAll
in interface Collection<E extends Schedule.Event>
containsAll
in interface Set<E extends Schedule.Event>
containsAll
in class AbstractCollection<E extends Schedule.Event>
public final boolean equals(Object other)
equals
in interface Collection<E extends Schedule.Event>
equals
in interface Set<E extends Schedule.Event>
equals
in class AbstractSet<E extends Schedule.Event>
@CheckReturnValue public final long getDelay()
Require.FailureException
- When empty.public final boolean hasNext()
hasNext
in interface Iterator<E extends Schedule.Event>
public final int hashCode()
hashCode
in interface Collection<E extends Schedule.Event>
hashCode
in interface Set<E extends Schedule.Event>
hashCode
in class AbstractSet<E extends Schedule.Event>
public final boolean isEmpty()
isEmpty
in interface Collection<E extends Schedule.Event>
isEmpty
in interface Set<E extends Schedule.Event>
isEmpty
in class AbstractCollection<E extends Schedule.Event>
public final Iterator<E> iterator()
iterator
in interface Iterable<E extends Schedule.Event>
iterator
in interface Collection<E extends Schedule.Event>
iterator
in interface Set<E extends Schedule.Event>
iterator
in class AbstractCollection<E extends Schedule.Event>
public final E next()
next
in interface Iterator<E extends Schedule.Event>
@Nonnull @CheckReturnValue public final Optional<E> peek()
public final void remove()
remove
in interface Iterator<E extends Schedule.Event>
public final boolean remove(Object object)
remove
in interface Collection<E extends Schedule.Event>
remove
in interface Set<E extends Schedule.Event>
remove
in class AbstractCollection<E extends Schedule.Event>
public final boolean removeAll(Collection<?> collection)
removeAll
in interface Collection<E extends Schedule.Event>
removeAll
in interface Set<E extends Schedule.Event>
removeAll
in class AbstractSet<E extends Schedule.Event>
public final boolean retainAll(Collection<?> collection)
retainAll
in interface Collection<E extends Schedule.Event>
retainAll
in interface Set<E extends Schedule.Event>
retainAll
in class AbstractCollection<E extends Schedule.Event>
public final int size()
size
in interface Collection<E extends Schedule.Event>
size
in interface Set<E extends Schedule.Event>
size
in class AbstractCollection<E extends Schedule.Event>
public final Object[] toArray()
toArray
in interface Collection<E extends Schedule.Event>
toArray
in interface Set<E extends Schedule.Event>
toArray
in class AbstractCollection<E extends Schedule.Event>
public final <T> T[] toArray(T[] array)
toArray
in interface Collection<E extends Schedule.Event>
toArray
in interface Set<E extends Schedule.Event>
toArray
in class AbstractCollection<E extends Schedule.Event>
public final String toString()
toString
in class AbstractCollection<E extends Schedule.Event>
protected void cancelWait()
@Nonnull @CheckReturnValue protected NavigableSet<E> getEvents()
@Nonnull @CheckReturnValue protected final Object getMutex()
@Nonnull @CheckReturnValue protected final Optional<E> next(boolean wait) throws InterruptedException
Note: must be called while synchronized on getMutex()
.
wait
- True to wait.InterruptedException
- When interrupted.protected final void rollback()
next(boolean)
.Copyright © 2003-2019 Serge Brisson. All Rights Reserved.