org.javanetworkanalyzer.data
Class PathLengthData<T extends Number>

java.lang.Object
  extended by org.javanetworkanalyzer.data.PathLengthData<T>
Direct Known Subclasses:
UnweightedPathLengthData, WeightedPathLengthData

public abstract class PathLengthData<T extends Number>
extends Object

Stores information about the shortest path lengths from one node to the other nodes in the network.

Author:
Adam Gouge

Field Summary
protected  int count
          Number of shortest path lengths accumulated in this instance.
protected static String SPL_ERROR
          Error message to be given when no shortest path lengths have been accumulated.
 
Constructor Summary
PathLengthData()
          Initializes a new instance of PathLengthData.
 
Method Summary
abstract  void addSPLength(T length)
          Accumulates a new shortest path length to this data instance.
 void clear()
          Clears all path length data information.
abstract  double getAverageLength()
          Average shortest path length.
 int getCount()
          Gets the number of shortest path lengths.
abstract  T getMaxLength()
          Longest among the shortest path lengths added to this data instance.
abstract  T getTotalLength()
          Gets the total length of shortest paths.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

count

protected int count
Number of shortest path lengths accumulated in this instance.


SPL_ERROR

protected static final String SPL_ERROR
Error message to be given when no shortest path lengths have been accumulated.

See Also:
Constant Field Values
Constructor Detail

PathLengthData

public PathLengthData()
Initializes a new instance of PathLengthData.

Method Detail

clear

public void clear()
Clears all path length data information.


getCount

public int getCount()
Gets the number of shortest path lengths.

Returns:
Number of shortest path lengths accumulated in this instance.

addSPLength

public abstract void addSPLength(T length)
Accumulates a new shortest path length to this data instance.

Parameters:
length - Length of a new shortest path to be accumulated.

getMaxLength

public abstract T getMaxLength()
Longest among the shortest path lengths added to this data instance.

Returns:
Maximum length of a shortest path accumulated in this instance.

getTotalLength

public abstract T getTotalLength()
Gets the total length of shortest paths.

Returns:
Sum of all shortest path lengths accumulated in this instance.

getAverageLength

public abstract double getAverageLength()
Average shortest path length.

Returns:
Average length of a shortest path accumulated in this instance.
Throws:
IllegalStateException - If no SPLs were accumulated in this instance.


Copyright © 2014. All Rights Reserved.