C - The cell typepublic final class Path<C extends MapCell> extends Object implements Collection<PathStep<C>>
| Constructor and Description |
|---|
Path(Decoder<C> decoder)
Create an empty path
|
Path(Decoder<C> decoder,
List<PathStep<C>> steps) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(PathStep<C> step) |
boolean |
addAll(Collection<? extends PathStep<C>> c) |
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
String |
encode()
Encode the path to string
|
String |
encodeWithStartCell()
Encode the path to string, including the start cell
|
PathStep<C> |
first()
Get the first step of the path
|
PathStep<C> |
get(int step)
Get one step
|
boolean |
isEmpty() |
Iterator<PathStep<C>> |
iterator() |
Path<C> |
keepWhile(Predicate<PathStep<C>> condition)
Keep the path steps while the condition is valid
The path will be stop when an invalid step is found
|
PathStep<C> |
last()
Get the last step
|
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
@LengthOf(value="this") int |
size() |
C |
start()
Get the start cell
|
C |
target()
Get the last cell
|
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
Path<C> |
truncate(int newSize)
Truncate the path, to the new size
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitequals, hashCode, parallelStream, removeIf, spliterator, streampublic Path(Decoder<C> decoder, List<PathStep<C>> steps)
decoder - The decoder instancesteps - The list of steps@Pure public PathStep<C> get(int step)
step - The step number. The step zero is the current cell, The step (size - 1) is the last step (target)@Pure public PathStep<C> first()
For get the start cell@Pure public PathStep<C> last()
For get the last cell@Pure public C start()
@Pure public C target()
@SideEffectFree public String encode()
@SideEffectFree public String encodeWithStartCell()
Decoder.encodeWithStartCell(Path)public Path<C> keepWhile(Predicate<PathStep<C>> condition)
condition - The condition to apply on all steps. If returns false, the path will be stoppedpublic Path<C> truncate(int newSize)
newSize - The required size@Pure @LengthOf(value="this") public @LengthOf(value="this") int size()
size in interface Collection<PathStep<C extends MapCell>>@Pure public boolean isEmpty()
isEmpty in interface Collection<PathStep<C extends MapCell>>@Pure public boolean contains(Object o)
contains in interface Collection<PathStep<C extends MapCell>>public Object[] toArray()
toArray in interface Collection<PathStep<C extends MapCell>>public <T> T[] toArray(T[] a)
toArray in interface Collection<PathStep<C extends MapCell>>public boolean add(PathStep<C> step)
add in interface Collection<PathStep<C extends MapCell>>public boolean remove(Object o)
remove in interface Collection<PathStep<C extends MapCell>>public boolean containsAll(Collection<?> c)
containsAll in interface Collection<PathStep<C extends MapCell>>public boolean addAll(Collection<? extends PathStep<C>> c)
addAll in interface Collection<PathStep<C extends MapCell>>public boolean removeAll(Collection<?> c)
removeAll in interface Collection<PathStep<C extends MapCell>>public boolean retainAll(Collection<?> c)
retainAll in interface Collection<PathStep<C extends MapCell>>public void clear()
clear in interface Collection<PathStep<C extends MapCell>>Copyright © 2022. All rights reserved.