gui
Class TSPguiModel

java.lang.Object
  extended by gui.TSPguiModel

public class TSPguiModel
extends java.lang.Object

Model class to be viewed and controled by the GUI.

Author:
Heinz Kredel.

Field Summary
protected  Path actualBestPath
           
protected  int algo
           
protected  java.lang.String algorithm
           
protected  Path bestPath
           
protected  boolean done
           
protected  ExecutableServer es
           
protected  Graph graph
           
protected  boolean isBestPath
           
protected  long iter
           
protected  double iterPercent
           
protected  long maxIter
           
protected  int numThread
           
protected  Point[] points
           
protected  int port
           
protected  int probSize
           
protected  Point[] scaledPoints
           
protected  java.lang.String server
           
protected  boolean standAlone
           
private  TSPModelConnectThread thread
           
private  TSPguiUpdate updater
           
private  javax.swing.Timer wecker
           
 
Constructor Summary
TSPguiModel()
           
 
Method Summary
 void assureStopped()
           
 void doStatus()
           
 void doUpdate()
           
protected  long facul(long n)
           
 void generateProblem()
           
 Path getActualBestPath()
           
 java.lang.String getAlgorithm()
           
 Path getBestPath()
           
 Graph getGraph()
           
 long getIterations()
           
 double getIterPercent()
           
 long getMaxIterations()
           
 Point[] getPoints()
           
 int getPort()
           
 int getProbSize()
           
 Point[] getScaledPoints()
           
 java.lang.String getServer()
           
 boolean getStandAlone()
           
 int getThreads()
           
 boolean isBestPath()
           
 boolean isDone()
           
 boolean isRunning()
           
 void setAlgorithm(java.lang.String alg)
           
 void setDone()
           
 long setMaxIterations(long m)
          Set maximal iteration count.
 void setPort(int p)
           
 void setProbSize(int s)
           
 void setServer(java.lang.String s)
           
 void setStandAlone(boolean a)
           
 void setThreads(int n)
           
 void setUpdater(TSPguiUpdate u)
           
 void solveProblem()
           
 void stopProblem()
           
 void waitDone()
           
 void waitProblem()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

algorithm

protected java.lang.String algorithm

algo

protected int algo

server

protected java.lang.String server

port

protected int port

standAlone

protected boolean standAlone

es

protected ExecutableServer es

probSize

protected int probSize

points

protected Point[] points

graph

protected Graph graph

scaledPoints

protected Point[] scaledPoints

isBestPath

protected boolean isBestPath

bestPath

protected Path bestPath

actualBestPath

protected Path actualBestPath

iter

protected long iter

maxIter

protected long maxIter

numThread

protected int numThread

iterPercent

protected double iterPercent

done

protected boolean done

thread

private TSPModelConnectThread thread

wecker

private javax.swing.Timer wecker

updater

private TSPguiUpdate updater
Constructor Detail

TSPguiModel

public TSPguiModel()
Method Detail

generateProblem

public void generateProblem()

solveProblem

public void solveProblem()

isRunning

public boolean isRunning()
Returns:
true if thread is running, else false.

waitProblem

public void waitProblem()

assureStopped

public void assureStopped()

stopProblem

public void stopProblem()

getPoints

public Point[] getPoints()
Returns:
points of the cities.

getScaledPoints

public Point[] getScaledPoints()
Returns:
scaled points of the cities, i.e. all coordiates lie within 0.0 and 1.0.

getGraph

public Graph getGraph()
Returns:
the graph.

isBestPath

public boolean isBestPath()
Returns:
true if the actual path is the best path, else false.

getBestPath

public Path getBestPath()
Returns:
return best path if known.

getActualBestPath

public Path getActualBestPath()
Returns:
return actual best path

getThreads

public int getThreads()
Returns:
number of threads used.

setThreads

public void setThreads(int n)
Parameters:
n - number of threads to be used.

getIterations

public long getIterations()
Returns:
iteration count.

getMaxIterations

public long getMaxIterations()
Returns:
maximal iteration count.

getIterPercent

public double getIterPercent()
Returns:
per centage of used iterations of total number of possible paths.

facul

protected long facul(long n)
Parameters:
n - input.
Returns:
n * facul( n-1 ).

setMaxIterations

public long setMaxIterations(long m)
Set maximal iteration count.

Parameters:
m - new maximal iteration count.
Returns:
old maximal iteration count.

isDone

public boolean isDone()
Returns:
true if user requests exit.

setDone

public void setDone()

waitDone

public void waitDone()

getProbSize

public int getProbSize()
Returns:
problem size, i.e. number of points / nodes / cities.

setProbSize

public void setProbSize(int s)
Parameters:
s - new problem size.

getAlgorithm

public java.lang.String getAlgorithm()
Returns:
the algorithm to be used.

setAlgorithm

public void setAlgorithm(java.lang.String alg)
Parameters:
alg - the new algorithm to be used.

getServer

public java.lang.String getServer()
Returns:
name of compute server.

setServer

public void setServer(java.lang.String s)
Parameters:
s - name of compute server.

getPort

public int getPort()
Returns:
port of compute server.

setPort

public void setPort(int p)
Parameters:
p - port of compute server.

getStandAlone

public boolean getStandAlone()
Returns:
true if no remote compute server should be used.

setStandAlone

public void setStandAlone(boolean a)
Parameters:
a - true if no remote compute server should be used.

setUpdater

public void setUpdater(TSPguiUpdate u)
Parameters:
u - the TSPguiUpdate.

doUpdate

public void doUpdate()

doStatus

public void doStatus()