|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectginy.util.IntNodeDistances
Calculates the all-pairs-shortest-paths (APSP) of a set of giny.model.Node
objects' indices that reside in a giny.model.GraphPerspective
.
NodeDistances
Field Summary | |
protected boolean |
canceled
|
protected int |
currentProgress
|
protected boolean |
directed
|
protected int[][] |
distances
|
protected boolean |
done
|
static int |
INFINITY
|
protected int |
lengthOfTask
|
protected int[] |
nodesArray
|
protected GraphPerspective |
perspective
|
protected java.lang.String |
statusMessage
|
Constructor Summary | |
IntNodeDistances(int[] nodes_array,
int[][] distances,
GraphPerspective perspective)
Constructor, it assumes that the graph is undirected. |
|
IntNodeDistances(int[] nodes_array,
int[][] distances,
GraphPerspective perspective,
boolean directed)
Constructor, specifies whether the graph should be trated as a directed graph or not. |
Method Summary | |
int[][] |
calculate()
Calculates the distances. |
int |
getCurrentProgress()
|
java.lang.String |
getCurrentStatusMessage()
|
int[][] |
getDistances()
|
int |
getLengthOfTask()
|
java.lang.String |
getTaskDescription()
|
boolean |
isDone()
|
void |
start(boolean return_when_done)
Starts doing the task in a separate thread so that the GUI stays responsive |
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 int[] nodesArray
protected GraphPerspective perspective
protected int[][] distances
protected boolean directed
protected int currentProgress
protected int lengthOfTask
protected boolean done
protected boolean canceled
protected java.lang.String statusMessage
Constructor Detail |
public IntNodeDistances(int[] nodes_array, int[][] distances, GraphPerspective perspective)
nodes_array
- an array of giny.model.GraphPerspective
node indices for which
distances will be calculateddistances
- the 2D array where distances will be stored (possibly null)perspective
- the giny.model.GraphPerspective
in which the nodes residepublic IntNodeDistances(int[] nodes_array, int[][] distances, GraphPerspective perspective, boolean directed)
nodes_array
- an array of giny.model.GraphPerspective
node indices for which
distances will be calculateddistances
- the 2D array where distances will be stored (possibly null)perspective
- the giny.model.GraphPerspective
in which the nodes residedirected
- if true, the graph is treated as a directed graph, else, it is treated as
an undirected graphMethod Detail |
public boolean isDone()
isDone
in interface MonitorableTask
true
if the task is done, false otherwisepublic 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 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 distances, or null if the task was canceled or
there was an errorpublic int[][] getDistances()
public 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 |