com.kuka.graph.traverse
Class AbstractBaseGraphIterator<T extends AbstractBaseGraphIterator<T,N>,N>

java.lang.Object
  extended by com.kuka.graph.traverse.AbstractBaseGraphIterator<T,N>
Type Parameters:
T - the iterator type
N - the node type
All Implemented Interfaces:
GraphIterator<T,N>, Iterator<N>
Direct Known Subclasses:
BreadthFirstIterator, ClosestFirstIterator, DepthFirstIterator

public abstract class AbstractBaseGraphIterator<T extends AbstractBaseGraphIterator<T,N>,N>
extends Object
implements GraphIterator<T,N>

base implementation for graph iterators.


Nested Class Summary
protected static interface AbstractBaseGraphIterator.NodeQueue<A>
          Interface representing a node queue.
 
Constructor Summary
AbstractBaseGraphIterator(AbstractBaseGraphIterator.NodeQueue<N> queue, Graph<N,?> graph, N start)
          Creates a new graph iterator.
 
Method Summary
 double getCost()
           
 double getCost(N node)
          Returns the cost of the given node.
 N getPredecessor()
          Returns the predecessor node of this graph iterator.
 N getPredecessor(N node)
          Returns the predecessor node of a certain node of this graph iterator.
 boolean hasNext()
           
 N next()
           
 void remove()
           
protected  T self()
           
 T setCost(CostFunction<N,?> cost)
          Sets the cost function used for node expansions.
 T setEdgeFilter(GraphElementFilter<Edge<N>> filter)
          Sets an edge filter for this node iterator.
 T setNodeFilter(GraphElementFilter<N> filter)
          Sets a node filter for this node iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractBaseGraphIterator

public AbstractBaseGraphIterator(AbstractBaseGraphIterator.NodeQueue<N> queue,
                                 Graph<N,?> graph,
                                 N start)
Creates a new graph iterator.

Parameters:
queue - the implementation of the node queue.
graph - the graph
start - the start node
Method Detail

setCost

public final T setCost(CostFunction<N,?> cost)
Description copied from interface: GraphIterator
Sets the cost function used for node expansions.

Specified by:
setCost in interface GraphIterator<T extends AbstractBaseGraphIterator<T,N>,N>
Parameters:
cost - the cost function
Returns:
this iterator

setNodeFilter

public final T setNodeFilter(GraphElementFilter<N> filter)
Description copied from interface: GraphIterator
Sets a node filter for this node iterator.

Specified by:
setNodeFilter in interface GraphIterator<T extends AbstractBaseGraphIterator<T,N>,N>
Parameters:
filter - the node filter
Returns:
this iterator

setEdgeFilter

public final T setEdgeFilter(GraphElementFilter<Edge<N>> filter)
Description copied from interface: GraphIterator
Sets an edge filter for this node iterator.

Specified by:
setEdgeFilter in interface GraphIterator<T extends AbstractBaseGraphIterator<T,N>,N>
Parameters:
filter - the edge filter
Returns:
this iterator

hasNext

public final boolean hasNext()
Specified by:
hasNext in interface Iterator<N>

next

public final N next()
Specified by:
next in interface Iterator<N>

getPredecessor

public final N getPredecessor()
Description copied from interface: GraphIterator
Returns the predecessor node of this graph iterator.

Specified by:
getPredecessor in interface GraphIterator<T extends AbstractBaseGraphIterator<T,N>,N>
Returns:
the predecessor node

getPredecessor

public final N getPredecessor(N node)
Description copied from interface: GraphIterator
Returns the predecessor node of a certain node of this graph iterator.

Specified by:
getPredecessor in interface GraphIterator<T extends AbstractBaseGraphIterator<T,N>,N>
Parameters:
node - the node to get predecessor for
Returns:
the predecessor node

getCost

public final double getCost()
Specified by:
getCost in interface GraphIterator<T extends AbstractBaseGraphIterator<T,N>,N>
Returns:
the cost of the current node.

getCost

public final double getCost(N node)
Description copied from interface: GraphIterator
Returns the cost of the given node.

Specified by:
getCost in interface GraphIterator<T extends AbstractBaseGraphIterator<T,N>,N>
Parameters:
node - the node
Returns:
the cost

remove

public final void remove()
Specified by:
remove in interface Iterator<N>

self

protected final T self()
Returns:
this iterator.


Copyright © 2019. All rights reserved.