gui
Class TSPModelConnectThread

java.lang.Object
  extended by java.lang.Thread
      extended by gui.TSPModelConnectThread
All Implemented Interfaces:
java.lang.Runnable

 class TSPModelConnectThread
extends java.lang.Thread

Class to communicate with the thread on the compute server.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  int algo
           
private  ChannelFactory cf
           
private  SocketChannel comm
           
private  int guiClientPort
           
private  java.lang.String guiHost
           
private  int guiPort
           
private  boolean isBestPath
           
private  long iter
           
private  long maxIter
           
private  long maxIterTemp
           
private  TSPguiModel model
           
private  int numThread
           
private  Path path
           
private  Point[] points
           
private  ThreadPool pool
           
private  int port
           
private  java.lang.String server
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
TSPModelConnectThread(Point[] points, int algo, int threads, long mit, java.lang.String server, int port, TSPguiModel model)
           
 
Method Summary
 Path getActualBestPath()
           
 Path getBestPath()
           
 long getIterations()
           
 long getMaxIterations()
           
 boolean isBestPath()
           
 boolean isRunning()
           
 void run()
           
protected  java.lang.Object sendReceive(TransportContainer m)
          RPC style communication.
 long setMaxIterations(long m)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

points

private Point[] points

path

private Path path

numThread

private int numThread

algo

private int algo

iter

private long iter

maxIter

private long maxIter

maxIterTemp

private long maxIterTemp

isBestPath

private boolean isBestPath

server

private java.lang.String server

port

private int port

guiHost

private java.lang.String guiHost

guiPort

private int guiPort

guiClientPort

private int guiClientPort

model

private TSPguiModel model

cf

private ChannelFactory cf

comm

private SocketChannel comm

pool

private ThreadPool pool
Constructor Detail

TSPModelConnectThread

public TSPModelConnectThread(Point[] points,
                             int algo,
                             int threads,
                             long mit,
                             java.lang.String server,
                             int port,
                             TSPguiModel model)
Parameters:
points - array city coordinates.
algo - algorithm to use.
threads - number of thread to use.
mit - maximal iteration count.
server - host name of compute server.
port - of compute server.
model - the TSPguiModel.
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

isRunning

public boolean isRunning()
Returns:
true if thread is runnning.

isBestPath

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

getIterations

public long getIterations()
Returns:
iteration count.

getActualBestPath

public Path getActualBestPath()
Returns:
actual best path.

getBestPath

public Path getBestPath()
Returns:
best known path.

getMaxIterations

public long getMaxIterations()
Returns:
maximal iteration count.

setMaxIterations

public long setMaxIterations(long m)
Parameters:
m - new maximal iteration count.
Returns:
old maximal iteration count.

sendReceive

protected java.lang.Object sendReceive(TransportContainer m)
RPC style communication.

Parameters:
m - a TransportContainer.
Returns:
received Object.