public class TurnCostStorage extends Object implements Storable<TurnCostStorage>
Like IntRefs on edges, this can in principle be used to store values of any kind.
In practice, the IntRefs are used to store generalized travel costs per turn relation per vehicle type. In practice, we only store 0 or infinity. (Can turn, or cannot turn.)
| Modifier and Type | Class and Description |
|---|---|
static interface |
TurnCostStorage.TurnRelationIterator |
| Constructor and Description |
|---|
TurnCostStorage(com.graphhopper.storage.BaseGraph baseGraph,
DataAccess turnCosts) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
This method makes sure that the underlying used resources are released.
|
TurnCostStorage |
copyTo(TurnCostStorage turnCostStorage) |
TurnCostStorage |
create(long initBytes)
Creates the underlying storage.
|
void |
flush()
This method makes sure that the underlying data is written to the storage.
|
double |
get(DecimalEncodedValue turnCostEnc,
int fromEdge,
int viaNode,
int toEdge) |
TurnCostStorage.TurnRelationIterator |
getAllTurnRelations()
Returns an iterator over all entries.
|
long |
getCapacity() |
boolean |
isClosed() |
boolean |
loadExisting() |
void |
set(DecimalEncodedValue turnCostEnc,
int fromEdge,
int viaNode,
int toEdge,
double cost)
Sets the turn cost at the viaNode when going from "fromEdge" to "toEdge"
WARNING: It is tacitly assumed that for every encoder, this method is only called once per turn relation.
|
void |
setSegmentSize(int bytes) |
String |
toString() |
public TurnCostStorage(com.graphhopper.storage.BaseGraph baseGraph, DataAccess turnCosts)
public void setSegmentSize(int bytes)
public TurnCostStorage create(long initBytes)
Storablecreate in interface Storable<TurnCostStorage>public void flush()
Storableflush in interface Storable<TurnCostStorage>public void close()
Storableclose in interface Storable<TurnCostStorage>close in interface Closeableclose in interface AutoCloseablepublic long getCapacity()
getCapacity in interface Storable<TurnCostStorage>public boolean loadExisting()
loadExisting in interface Storable<TurnCostStorage>public void set(DecimalEncodedValue turnCostEnc, int fromEdge, int viaNode, int toEdge, double cost)
public double get(DecimalEncodedValue turnCostEnc, int fromEdge, int viaNode, int toEdge)
public TurnCostStorage copyTo(TurnCostStorage turnCostStorage)
public boolean isClosed()
isClosed in interface Storable<TurnCostStorage>public TurnCostStorage.TurnRelationIterator getAllTurnRelations()
Copyright © 2012–2020. All rights reserved.