Modifier and Type | Class and Description |
---|---|
(package private) static class |
Hueristic2D.TargetNode |
Modifier and Type | Field and Description |
---|---|
private static java.util.function.Function<Bounds,java.lang.Double> |
BOUNDS_BOTTOM_SIDE |
private static java.util.function.Function<Bounds,java.lang.Double> |
BOUNDS_LEFT_SIDE |
private static java.util.function.Function<Bounds,java.lang.Double> |
BOUNDS_RIGHT_SIDE |
private static java.util.function.Function<Bounds,java.lang.Double> |
BOUNDS_TOP_SIDE |
protected Node |
cacheLastTraversalNode |
protected Direction |
cacheStartTraversalDirection |
protected Node |
cacheStartTraversalNode |
protected boolean |
reverseDirection |
protected java.util.Stack<Node> |
traversalNodeStack |
Constructor and Description |
---|
Hueristic2D() |
Modifier and Type | Method and Description |
---|---|
private void |
cacheTraversal(Node node,
Direction dir) |
private double |
centerSideDistance(Direction dir,
Bounds cur,
Bounds tgt)
Computes the side distance from current center to target center.
|
private double |
cornerSideDistance(Direction dir,
Bounds cur,
Bounds tgt)
Computes the side distance between the closest corners of the current
and target.
|
static double |
findMin(double... values) |
protected Node |
getNearestNodeLeftOrRight(Bounds currentB,
Bounds originB,
TraversalContext context,
Direction dir) |
protected Node |
getNearestNodeUpOrDown(Bounds currentB,
Bounds originB,
TraversalContext context,
Direction dir) |
private boolean |
isOnAxis(Direction dir,
Bounds cur,
Bounds tgt) |
private double |
outDistance(Direction dir,
Bounds cur,
Bounds tgt)
Compute the out-distance to the near edge of the target in the
traversal direction.
|
Node |
select(Node node,
Direction dir,
TraversalContext context)
Traverse from owner, in direction dir.
|
Node |
selectFirst(TraversalContext context)
Return the first traversable node for the specified context (root).
|
Node |
selectLast(TraversalContext context)
Return the last traversable node for the specified context (root).
|
protected Node cacheStartTraversalNode
protected Direction cacheStartTraversalDirection
protected boolean reverseDirection
protected Node cacheLastTraversalNode
protected java.util.Stack<Node> traversalNodeStack
private static final java.util.function.Function<Bounds,java.lang.Double> BOUNDS_TOP_SIDE
private static final java.util.function.Function<Bounds,java.lang.Double> BOUNDS_BOTTOM_SIDE
private static final java.util.function.Function<Bounds,java.lang.Double> BOUNDS_LEFT_SIDE
private static final java.util.function.Function<Bounds,java.lang.Double> BOUNDS_RIGHT_SIDE
public Node select(Node node, Direction dir, TraversalContext context)
Algorithm
public Node selectFirst(TraversalContext context)
Algorithm
selectFirst
in interface Algorithm
context
- the context that contains the rootpublic Node selectLast(TraversalContext context)
Algorithm
selectLast
in interface Algorithm
context
- the context that contains the rootprivate double outDistance(Direction dir, Bounds cur, Bounds tgt)
private double centerSideDistance(Direction dir, Bounds cur, Bounds tgt)
private double cornerSideDistance(Direction dir, Bounds cur, Bounds tgt)
protected Node getNearestNodeUpOrDown(Bounds currentB, Bounds originB, TraversalContext context, Direction dir)
protected Node getNearestNodeLeftOrRight(Bounds currentB, Bounds originB, TraversalContext context, Direction dir)
public static double findMin(double... values)