|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectginy.util.NodeDistances
Calculates the all-pairs-shortest-paths (APSP) of a set of giny.model.Node
objects that reside in a giny.model.GraphPerspective.
IntNodeDistances| Field Summary | |
protected boolean |
canceled
|
protected int |
currentProgress
|
protected boolean |
directed
|
protected int[][] |
distances
|
protected boolean |
done
|
static int |
INFINITY
|
protected int |
lengthOfTask
|
protected java.util.HashMap |
nodeIndexToMatrixIndexMap
|
protected java.util.List |
nodesList
|
protected GraphPerspective |
perspective
|
protected java.lang.String |
statusMessage
|
| Constructor Summary | |
NodeDistances(java.util.List nodesList,
GraphPerspective perspective,
java.util.HashMap nodeIndexToMatrixIndexMap)
The main constructor |
|
NodeDistances(java.util.List nodes_list,
int[][] distances,
GraphPerspective perspective)
Deprecated. Can't use this now that GraphPerspective uses root graph indices. |
|
NodeDistances(java.util.List nodes_list,
int[][] distances,
GraphPerspective perspective,
boolean directed)
Deprecated. Can't use this now that GraphPerspective uses root graph indices. |
|
| Method Summary | |
int[][] |
calculate()
Calculates the node distances. |
int |
getCurrentProgress()
|
java.lang.String |
getCurrentStatusMessage()
|
int[][] |
getDistances()
|
int |
getLengthOfTask()
|
java.lang.String |
getTaskDescription()
|
boolean |
isDone()
|
void |
start(boolean return_when_done)
Calculates the APSP in a separate thread. |
void |
stop()
Stops the task if it is currently running. |
boolean |
wasCanceled()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int INFINITY
protected java.util.List nodesList
protected GraphPerspective perspective
protected int[][] distances
protected boolean directed
protected int currentProgress
protected int lengthOfTask
protected java.lang.String statusMessage
protected boolean done
protected boolean canceled
protected java.util.HashMap nodeIndexToMatrixIndexMap
| Constructor Detail |
public NodeDistances(java.util.List nodes_list,
int[][] distances,
GraphPerspective perspective)
nodes_list - a List of giny.model.Node objects for
which distances will be calculateddistances - the 2 dimensional array that will hold the calculated distances
(possibly null)perspective - the giny.model.GraphPerspective in which the nodes
reside
public NodeDistances(java.util.List nodes_list,
int[][] distances,
GraphPerspective perspective,
boolean directed)
nodes_list - a List of giny.model.Node objects for
which distances will be calculateddistances - the 2 dimensional array that will hold the calculated distances
(possibly null)perspective - the giny.model.GraphPerspective in which the nodes
residedirected - if true, then APSP is calculated assuming a directed graph,
if false an undirected graph is assumed
public NodeDistances(java.util.List nodesList,
GraphPerspective perspective,
java.util.HashMap nodeIndexToMatrixIndexMap)
nodesList - List of nodes ordered by the index mapperspective - The giny.model.GraphPerspective in which the nodes residenodeIndexToMatrixIndexMap - An index map that maps your root graph indices to the returned matrix indices| Method Detail |
public int getCurrentProgress()
getCurrentProgress in interface MonitorableTaskpublic int getLengthOfTask()
getLengthOfTask in interface MonitorableTaskpublic java.lang.String getTaskDescription()
getTaskDescription in interface MonitorableTaskString describing the task being performedpublic java.lang.String getCurrentStatusMessage()
getCurrentStatusMessage in interface MonitorableTaskString status message describing what the task
is currently doing (example: "Completed 23% of total.", "Initializing...", etc).public boolean isDone()
isDone in interface MonitorableTasktrue if the task is done, false otherwisepublic void stop()
stop in interface MonitorableTaskpublic boolean wasCanceled()
wasCanceled in interface MonitorableTasktrue if the task was canceled before it was done
(for example, by calling MonitorableSwingWorker.stop(),
false otherwisepublic int[][] calculate()
int[][] array of calculated distances or null if the
task was canceled or there was an errorpublic int[][] getDistances()
int[][] 2D array of calculated distances or null
if not yet calculatedpublic void start(boolean return_when_done)
start in interface MonitorableTaskreturn_when_done - if true, then this method will return only when
the task is done, else, it will return immediately after spawning the thread that
performs the task
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||