public class GHUtility extends Object
Modifier and Type | Class and Description |
---|---|
static class |
GHUtility.DisabledEdgeIterator
This edge iterator can be used in tests to mock specific iterator behaviour via overloading
certain methods.
|
Constructor and Description |
---|
GHUtility() |
Modifier and Type | Method and Description |
---|---|
static EncodingManager.Builder |
addDefaultEncodedValues(EncodingManager.Builder builder) |
static void |
addRandomTurnCosts(Graph graph,
long seed,
FlagEncoder encoder,
int maxTurnCost,
TurnCostExtension turnCostExtension) |
static Set<Integer> |
asSet(int... values) |
static void |
buildRandomGraph(Graph graph,
Random random,
int numNodes,
double meanDegree,
boolean allowLoops,
boolean allowZeroDistance,
DecimalEncodedValue randomSpeedEnc,
double pNonZeroLoop,
double pBothDir,
double pRandomOffset) |
static Graph |
copyTo(Graph fromGraph,
Graph toGraph) |
static int |
count(EdgeIterator iter)
Counts reachable edges.
|
static int |
createEdgeKey(int nodeA,
int nodeB,
int edgeId,
boolean reverse)
Creates unique positive number for specified edgeId taking into account the direction defined
by nodeA, nodeB and reverse.
|
static EdgeIteratorState |
createMockedEdgeIteratorState(double distance,
IntsRef flags) |
static EdgeIteratorState |
createMockedEdgeIteratorState(double distance,
IntsRef flags,
int base,
int adj,
int edge,
int origFirst,
int origLast) |
static int |
getAdjNode(Graph g,
int edge,
int adjNode) |
static double |
getDistance(int from,
int to,
NodeAccess nodeAccess) |
static EdgeIteratorState |
getEdge(Graph graph,
int base,
int adj) |
static int |
getEdgeFromEdgeKey(int edgeKey) |
static List<Integer> |
getEdgeIds(EdgeIterator iter) |
static int |
getEdgeKey(Graph graph,
int edgeId,
int node,
boolean reverse)
Returns the edge key for a given edge id and adjacent node.
|
static Set<Integer> |
getNeighbors(EdgeIterator iter) |
static String |
getNodeInfo(CHGraph g,
int nodeId,
EdgeFilter filter) |
static String |
getNodeInfo(Graph g,
int nodeId,
EdgeFilter filter) |
static List<String> |
getProblems(Graph g)
This method could throw an exception if problems like index out of bounds etc
|
static boolean |
isSameEdgeKeys(int edgeKey1,
int edgeKey2)
Returns if the specified edgeKeys (created by createEdgeKey) are identical regardless of the
direction.
|
static GraphHopperStorage |
newStorage(GraphHopperStorage store)
Create a new storage from the specified one without copying the data.
|
static void |
printEdgeInfo(Graph g,
FlagEncoder encoder) |
static void |
printGraphForUnitTest(Graph g,
FlagEncoder encoder) |
static void |
printGraphForUnitTest(Graph g,
FlagEncoder encoder,
BBox bBox) |
static void |
printInfo(Graph g,
int startNode,
int counts,
EdgeFilter filter) |
static int |
reverseEdgeKey(int edgeKey)
Returns the edgeKey of the opposite direction
|
static EdgeIteratorState |
setProperties(EdgeIteratorState edge,
FlagEncoder encoder,
double averageSpeed,
boolean fwd,
boolean bwd) |
static EdgeIteratorState |
setProperties(EdgeIteratorState edge,
FlagEncoder encoder,
double fwdSpeed,
double bwdSpeed) |
static IntsRef |
setProperties(IntsRef edgeFlags,
FlagEncoder encoder,
double averageSpeed,
boolean fwd,
boolean bwd) |
static IntsRef |
setProperties(IntsRef edgeFlags,
FlagEncoder encoder,
double fwdSpeed,
double bwdSpeed) |
static Graph |
shuffle(Graph g,
Graph sortedGraph) |
static Graph |
sortDFS(Graph g,
Graph sortedGraph)
Sorts the graph according to depth-first search traversal.
|
public static List<String> getProblems(Graph g)
public static int count(EdgeIterator iter)
public static Set<Integer> getNeighbors(EdgeIterator iter)
public static List<Integer> getEdgeIds(EdgeIterator iter)
public static void printEdgeInfo(Graph g, FlagEncoder encoder)
public static void printGraphForUnitTest(Graph g, FlagEncoder encoder)
public static void printGraphForUnitTest(Graph g, FlagEncoder encoder, BBox bBox)
public static void buildRandomGraph(Graph graph, Random random, int numNodes, double meanDegree, boolean allowLoops, boolean allowZeroDistance, DecimalEncodedValue randomSpeedEnc, double pNonZeroLoop, double pBothDir, double pRandomOffset)
public static double getDistance(int from, int to, NodeAccess nodeAccess)
public static void addRandomTurnCosts(Graph graph, long seed, FlagEncoder encoder, int maxTurnCost, TurnCostExtension turnCostExtension)
public static void printInfo(Graph g, int startNode, int counts, EdgeFilter filter)
public static String getNodeInfo(CHGraph g, int nodeId, EdgeFilter filter)
public static String getNodeInfo(Graph g, int nodeId, EdgeFilter filter)
public static Graph sortDFS(Graph g, Graph sortedGraph)
public static Graph copyTo(Graph fromGraph, Graph toGraph)
public static GraphHopperStorage newStorage(GraphHopperStorage store)
public static int getAdjNode(Graph g, int edge, int adjNode)
public static EdgeIteratorState createMockedEdgeIteratorState(double distance, IntsRef flags)
public static EdgeIteratorState createMockedEdgeIteratorState(double distance, IntsRef flags, int base, int adj, int edge, int origFirst, int origLast)
public static EdgeIteratorState getEdge(Graph graph, int base, int adj)
public static int createEdgeKey(int nodeA, int nodeB, int edgeId, boolean reverse)
public static boolean isSameEdgeKeys(int edgeKey1, int edgeKey2)
public static int reverseEdgeKey(int edgeKey)
public static int getEdgeFromEdgeKey(int edgeKey)
public static int getEdgeKey(Graph graph, int edgeId, int node, boolean reverse)
public static IntsRef setProperties(IntsRef edgeFlags, FlagEncoder encoder, double averageSpeed, boolean fwd, boolean bwd)
public static EdgeIteratorState setProperties(EdgeIteratorState edge, FlagEncoder encoder, double fwdSpeed, double bwdSpeed)
public static IntsRef setProperties(IntsRef edgeFlags, FlagEncoder encoder, double fwdSpeed, double bwdSpeed)
public static EdgeIteratorState setProperties(EdgeIteratorState edge, FlagEncoder encoder, double averageSpeed, boolean fwd, boolean bwd)
public static final EncodingManager.Builder addDefaultEncodedValues(EncodingManager.Builder builder)
Copyright © 2012–2019. All rights reserved.