| Modifier and Type | Method and Description |
|---|---|
Path<C> |
decode(String encoded)
Decode compressed path without a start cell
|
Path<C> |
decode(String encoded,
C start)
Decode compressed path
|
String |
encode(Path<C> path)
Encode the computed path, without the start cell
To decode this path, the start cell must be provided on the decode method
This method should be used by the client to send a path to the server
String encoded = encoder.encode(myPath);
Path decoded = encoder.decode(encoded, startCell);
|
String |
encodeWithStartCell(Path<C> path)
Encode the computed path, including the start cell
To decode this path, the start cell should not be provided on the decode method
This method should be used by server to send a path to the client
String encoded = encoder.encodeWithStartCell(myPath);
Path decoded = encoder.decode(encoded);
|
Optional<C> |
nextCellByDirection(C start,
Direction direction)
Get the immediately next cell if we move by the given direction
If the next cell is out of the map, an empty optional is returned
|
Pathfinder<C> |
pathfinder()
Get the pathfinder related to this decoder
|
public Optional<C> nextCellByDirection(C start, Direction direction)
start - The start celldirection - The direction to followpublic Path<C> decode(String encoded, C start) throws PathException
encoded - The encoded pathstart - The start cell. Can be null.
Set a value is the encoded path do not contains the start cell (ex: use encode(Path, boolean) with includeStartCell)PathException - When an invalid path is givenpublic Path<C> decode(String encoded) throws PathException
encoded - The encoded path. Must contains the start cellPathException - When an invalid path is givenpublic String encodeWithStartCell(Path<C> path)
String encoded = encoder.encodeWithStartCell(myPath);
Path decoded = encoder.decode(encoded);
path - The path to encodepublic String encode(Path<C> path)
String encoded = encoder.encode(myPath);
Path decoded = encoder.decode(encoded, startCell);
path - The path to encodeSet to false to generate a path without the start cellpublic Pathfinder<C> pathfinder()
Copyright © 2022. All rights reserved.