org.javanetworkanalyzer.data
Class VBFS<V extends VBFS,E>

java.lang.Object
  extended by org.javanetworkanalyzer.data.VId
      extended by org.javanetworkanalyzer.data.VPredImpl<V,E>
          extended by org.javanetworkanalyzer.data.VBFS<V,E>
Type Parameters:
V - Vertex
All Implemented Interfaces:
VDist<Integer>, VPred<V,E>
Direct Known Subclasses:
VUCent

public class VBFS<V extends VBFS,E>
extends VPredImpl<V,E>
implements VDist<Integer>

Vertex to be used in the BFS algorithm.

Author:
Adam Gouge

Field Summary
static int DEFAULT_DISTANCE
          The default distance assigned to all nodes at the beginning of the BFS algorithm.
 
Constructor Summary
VBFS(Integer id)
          Constructor: sets the id.
 
Method Summary
 Integer getDistance()
          Returns the length of the shortest path from a source node to this node.
 void reset()
          Clears the predecessor list and resets the distance to the default distance.
 void setDistance(Integer newDistance)
          Sets the new length of a shortest path from a source node to this node.
 void setSource()
          Clears the predecessor list and sets the distance to zero.
 
Methods inherited from class org.javanetworkanalyzer.data.VPredImpl
addPredecessor, addPredecessorEdge, clear, getPredecessorEdges, getPredecessors
 
Methods inherited from class org.javanetworkanalyzer.data.VId
getID, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_DISTANCE

public static final int DEFAULT_DISTANCE
The default distance assigned to all nodes at the beginning of the BFS algorithm.

See Also:
Constant Field Values
Constructor Detail

VBFS

public VBFS(Integer id)
Constructor: sets the id.

Parameters:
id - Id
Method Detail

getDistance

public Integer getDistance()
Description copied from interface: VDist
Returns the length of the shortest path from a source node to this node.

Specified by:
getDistance in interface VDist<Integer>
Returns:
The length of the shortest path from a source node to this node.

setDistance

public void setDistance(Integer newDistance)
Description copied from interface: VDist
Sets the new length of a shortest path from a source node to this node.

Specified by:
setDistance in interface VDist<Integer>
Parameters:
newDistance - Length of a shortest path to this node.

reset

public void reset()
Clears the predecessor list and resets the distance to the default distance.

Specified by:
reset in interface VDist<Integer>

setSource

public void setSource()
Clears the predecessor list and sets the distance to zero.

Specified by:
setSource in interface VDist<Integer>


Copyright © 2014. All Rights Reserved.