P
- Type of the (P)arent object containing this collection (e.g., SelectorPart
s have Selector
s as the parent).T
- The (T)ype of units to be grouped with.public interface SyntaxCollection<P,T extends Groupable<P,T>> extends Iterable<T>
Syntax
units.Modifier and Type | Method and Description |
---|---|
SyntaxCollection<P,T> |
append(T unit)
Appends the specified unit to the end of this collection.
|
SyntaxCollection<P,T> |
appendAfter(T index,
T unit)
Appends the specified unit after the given index unit.
|
SyntaxCollection<P,T> |
appendAll(Iterable<T> units)
Appends all of the given units to the end of this collection.
|
SyntaxCollection<P,T> |
clear()
Removes all units from this collection.
|
boolean |
contains(T unit)
Gets whether the given unit is contained within this collection.
|
void |
destroyAll()
Calls
Groupable.destroy() on all units. |
<S extends T> |
find(Class<S> klass)
Finds the first item in this collection that is a type of a the given class.
|
Optional<T> |
first()
Gets the first unit in the collection.
|
boolean |
isEmpty()
Gets whether this collection contains any units.
|
boolean |
isEmptyOrNoneWritable()
Gets whether this collection is empty, or all contained elements are not writable.
|
Optional<T> |
last()
Gets the last unit in the collection.
|
Optional<T> |
next(T unit)
Gets the next unit after the given one, if there is one.
|
P |
parent()
Gets the parent
Syntax unit that owns this collection. |
SyntaxCollection<P,T> |
prepend(T unit)
Prepends the specified unit to the beginning of this collection.
|
SyntaxCollection<P,T> |
prependAll(Iterable<T> units)
Prepends all of the given units to the beginning of this collection.
|
SyntaxCollection<P,T> |
prependBefore(T index,
T unit)
Prepends the specified unit before the given index unit.
|
Optional<T> |
previous(T unit)
Gets the previous unit before the given one, if there is one.
|
void |
propagateBroadcast(Broadcaster broadcaster,
Status status)
Calls
Broadcastable#propagateBroadcast(Broadcaster, Status) on all units within this collection using the given
Broadcaster . |
SyntaxCollection<P,T> |
remove(T unit)
Removes a unit from this collection.
|
SyntaxCollection<P,T> |
replaceExistingWith(Iterable<T> units)
Replaces all existing units with the given units.
|
SyntaxCollection<P,T> |
replaceExistingWith(T unit)
Replaces all existing units with the given unit.
|
int |
size()
Gets the number of units in the collection.
|
Stream<T> |
stream()
Returns a
Stream over the contents. |
forEach, iterator, spliterator
int size()
boolean isEmpty()
boolean isEmptyOrNoneWritable()
Writable#isWritable()
boolean contains(T unit)
unit
- Check if this unit is contained within this collection.Optional<T> first()
Optional
if not present.Optional<T> last()
Optional
if not present.Optional<T> next(T unit)
unit
- Get the next unit after this one.Optional
if not present.IllegalArgumentException
- if the given unit is not contained within this collection.Optional<T> previous(T unit)
unit
- Get the unit before this one.Optional
if not present.IllegalArgumentException
- if the given unit is not contained within this collection.<S extends T> Optional<S> find(Class<S> klass)
S
- Type of the instance to find.klass
- Find the first instance of this class.Optional
if not present.SyntaxCollection<P,T> prepend(T unit)
unit
- The unit to prepend.SyntaxCollection<P,T> prependAll(Iterable<T> units)
units
- The units to add.SyntaxCollection<P,T> prependBefore(T index, T unit) throws IllegalArgumentException
The index unit must be present within this collection. If the unit to prepend already exists in this collection it will be moved.
index
- Prepend before this unit.unit
- Prepend this unit.IllegalArgumentException
- If the index unit is not contained within this collection.SyntaxCollection<P,T> append(T unit)
unit
- The unit to append.SyntaxCollection<P,T> appendAll(Iterable<T> units)
units
- The units to append.SyntaxCollection<P,T> appendAfter(T index, T unit) throws IllegalArgumentException
The index unit must be present within this collection. If the unit to append already exists in this collection it will be moved.
index
- Append after this unit.unit
- Append this unit.IllegalArgumentException
- If existing is not contained within this collection.SyntaxCollection<P,T> remove(T unit)
Groupable.destroy()
over this.unit
- The unit to remove.SyntaxCollection<P,T> clear()
SyntaxCollection<P,T> replaceExistingWith(T unit)
unit
- Replace all existing (if any) units with this one.SyntaxCollection<P,T> replaceExistingWith(Iterable<T> units)
units
- Replace all existing (if any) units with these.void destroyAll()
Groupable.destroy()
on all units.P parent()
Syntax
unit that owns this collection.void propagateBroadcast(Broadcaster broadcaster, Status status)
Broadcastable#propagateBroadcast(Broadcaster, Status)
on all units within this collection using the given
Broadcaster
.broadcaster
- Propagate using this Broadcaster
.status
- Broadcast units that have this status.Copyright (c) 2019, Salesforce.com, Inc. All rights reserved. Licensed under the BSD 3-Clause license. For full license text, see the LICENSE file in the repository.