Class CalcThread

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--CalcThread
All Implemented Interfaces:
java.lang.Runnable

public class CalcThread
extends java.lang.Thread

Programm: WaveThread
Copyright: 2002 Andreas Gohr, Frank Schubert, Milan Altenburg
License: GPL2 or higher

Info: Class CalcThread, calculates Raster, holds array of Rasters


Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
CalcThread(MonoWave[] mw, java.awt.Color col)
          CalcThread Constructor sets time, MonoWave and Color creates new RGB ColorModel
 
Method Summary
 void calc_java(int idx)
          calculates the next Raster, according to time _time
 void calc_native(int idx)
          calculates the next Raster, according to time _time but using a native function
 void calcArray(int[] returnvals, float[] wavevals, int x, int y, float t, boolean sinus_method, boolean use_pointers, boolean use_copy)
          declaration of native function for calculation of the raster
 void die()
          control thread from outside, supposed but never used
 long fak(int x)
           
 java.lang.String getOptions()
           
 int getQueueSize()
           
 java.awt.image.WritableRaster getRaster()
           
 void run()
          "main" of CalcThread calls synchronized calc to fill queue
 void setXY(int x, int y)
          sets new width and height starts Thread, creates suitable Raster resets queue values (length,first,last)
 float sinusApproximation(float akt)
           
 void switchCalcMethod()
          switches usage of either native c or java calculation
 void switchSinusCalcMethod()
          switches usage of either sinus or taylor approximation
 void switchUsageOfCopy()
          switches usage of line copy
 void switchUsageOfPointers()
          switches usage of pointers in native c function
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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
 

Constructor Detail

CalcThread

public CalcThread(MonoWave[] mw,
                  java.awt.Color col)
CalcThread Constructor sets time, MonoWave and Color creates new RGB ColorModel

Method Detail

setXY

public void setXY(int x,
                  int y)
sets new width and height starts Thread, creates suitable Raster resets queue values (length,first,last)


getQueueSize

public int getQueueSize()
Returns:
size of queue

getRaster

public java.awt.image.WritableRaster getRaster()
Returns:
the Raster, that is next

die

public void die()
control thread from outside, supposed but never used


switchCalcMethod

public void switchCalcMethod()
switches usage of either native c or java calculation


switchSinusCalcMethod

public void switchSinusCalcMethod()
switches usage of either sinus or taylor approximation


switchUsageOfPointers

public void switchUsageOfPointers()
switches usage of pointers in native c function


switchUsageOfCopy

public void switchUsageOfCopy()
switches usage of line copy


getOptions

public java.lang.String getOptions()
Returns:
String with options currently set

fak

public long fak(int x)
Returns:
factorial

sinusApproximation

public float sinusApproximation(float akt)
Returns:
taylor approximation of sinus

calc_java

public void calc_java(int idx)
calculates the next Raster, according to time _time


calcArray

public void calcArray(int[] returnvals,
                      float[] wavevals,
                      int x,
                      int y,
                      float t,
                      boolean sinus_method,
                      boolean use_pointers,
                      boolean use_copy)
declaration of native function for calculation of the raster


calc_native

public void calc_native(int idx)
calculates the next Raster, according to time _time but using a native function


run

public void run()
"main" of CalcThread calls synchronized calc to fill queue

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread