FileDocCategorySizeDatePackage
UnsafePrinterInterchanged1000.javaAPI DocExample2054Wed Jul 07 11:55:46 BST 2004javathreads.examples.ch15.example13

UnsafePrinterInterchanged

public class UnsafePrinterInterchanged extends Object implements ScaleTester

Fields Summary
private float[]
lookupValues
private int
nRows
private int
nCols
private int
nThreads
private LoopPrinterUnsafe
lp
Constructors Summary
Methods Summary
public float[][]doCalc()

        UnsafePrinterInterchangedHandler loop =
                    new UnsafePrinterInterchangedHandler(nCols, nThreads);
        loop.loopProcess();
	try {
	    lp.send2stream(new PrintStream(new FileOutputStream("/dev/null")));
	} catch (IOException ioe) {
	    throw new IllegalArgumentException("Can't write to /dev/null " + ioe);
	}
        return lookupValues;
    
public voidinit(int nRows, int nCols, int nThreads)

        this.nRows = nRows;
        this.nCols = nCols;
        this.nThreads = nThreads;
	lp = new LoopPrinterUnsafe(nCols*nRows);
        lookupValues = new float[nRows][];
        for (int j = 0; j < nRows; j++) {
            lookupValues[j] = new float[nCols];
        }