|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object giny.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
residepublic 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 assumedpublic 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 indicesMethod Detail |
public int getCurrentProgress()
getCurrentProgress
in interface MonitorableTask
public int getLengthOfTask()
getLengthOfTask
in interface MonitorableTask
public java.lang.String getTaskDescription()
getTaskDescription
in interface MonitorableTask
String
describing the task being performedpublic java.lang.String getCurrentStatusMessage()
getCurrentStatusMessage
in interface MonitorableTask
String
status message describing what the task
is currently doing (example: "Completed 23% of total.", "Initializing...", etc).public boolean isDone()
isDone
in interface MonitorableTask
true
if the task is done, false otherwisepublic void stop()
stop
in interface MonitorableTask
public boolean wasCanceled()
wasCanceled
in interface MonitorableTask
true
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 MonitorableTask
return_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 |