1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-13 20:15:22 +02:00

[cleanup] Fix typos

This commit is contained in:
Martin Oberhuber 2008-04-04 14:58:14 +00:00
parent d164641fe6
commit 7cd42a7466

View file

@ -7,7 +7,7 @@
* *
* Contributors: * Contributors:
* Michael Scharf (Wind River) - initial API and implementation * Michael Scharf (Wind River) - initial API and implementation
* Douglas Lea (Addison Wesley) - [cq:1552] BoundedBufferWithStateTracking adapted to BoundedByteBuffer * Douglas Lea (Addison Wesley) - [cq:1552] BoundedBufferWithStateTracking adapted to BoundedByteBuffer
*******************************************************************************/ *******************************************************************************/
package org.eclipse.tm.internal.terminal.control.impl; package org.eclipse.tm.internal.terminal.control.impl;
@ -22,16 +22,16 @@ import org.eclipse.swt.widgets.Display;
/** /**
* The main purpose of this class is to start a runnable in the * The main purpose of this class is to start a runnable in the
* display thread when data is available and to pretend no data * display thread when data is available and to pretend no data
* is available after a given amount of time the runnable is running. * is available after a given amount of time the runnable is running.
* *
*/ */
public class TerminalInputStream extends InputStream { public class TerminalInputStream extends InputStream {
/** /**
* The maximum time in milli seconds the {@link #fNotifyChange} runs until * The maximum time in milliseconds the {@link #fNotifyChange} runs until
* {@link #ready()} returns false. * {@link #ready()} returns false.
*/ */
private final int fUITimeout; private final int fUITimeout;
/** /**
* The output stream used by the terminal backend to write to the terminal * The output stream used by the terminal backend to write to the terminal
*/ */
@ -49,7 +49,7 @@ public class TerminalInputStream extends InputStream {
* A blocking byte queue. * A blocking byte queue.
*/ */
private final BoundedByteBuffer fQueue; private final BoundedByteBuffer fQueue;
/** /**
* The maximum amount of data read and written in one shot. * The maximum amount of data read and written in one shot.
* The timer cannot interrupt reading this amount of data. * The timer cannot interrupt reading this amount of data.
@ -60,14 +60,14 @@ public class TerminalInputStream extends InputStream {
// block size must be smaller than the Queue capacity! // block size must be smaller than the Queue capacity!
final int BLOCK_SIZE=64; final int BLOCK_SIZE=64;
/** /**
* The runnable that si scheduled in the display tread. Takes care of * The runnable that is scheduled in the display tread. Takes care of the
* the timeout management. It calls the {@link #fNotifyChange} * timeout management. It calls the {@link #fNotifyChange}
*/ */
// synchronized with fQueue! // synchronized with fQueue!
private Runnable fRunnable; private Runnable fRunnable;
/** /**
* Used as flag to indicate that the current runnable * Used as flag to indicate that the current runnable
* has used enough time in the display thread. * has used enough time in the display thread.
@ -81,23 +81,23 @@ public class TerminalInputStream extends InputStream {
/** /**
* A byte bounded buffer used to synchronize the input and the output stream. * A byte bounded buffer used to synchronize the input and the output stream.
* <p> * <p>
* Adapted from BoundedBufferWithStateTracking * Adapted from BoundedBufferWithStateTracking
* http://gee.cs.oswego.edu/dl/cpj/allcode.java * http://gee.cs.oswego.edu/dl/cpj/allcode.java
* http://gee.cs.oswego.edu/dl/cpj/ * http://gee.cs.oswego.edu/dl/cpj/
* <p> * <p>
* BoundedBufferWithStateTracking is part of the examples for the book * BoundedBufferWithStateTracking is part of the examples for the book
* Concurrent Programming in Java: Design Principles and Patterns by * Concurrent Programming in Java: Design Principles and Patterns by
* Doug Lea (ISBN 0-201-31009-0). Second edition published by * Doug Lea (ISBN 0-201-31009-0). Second edition published by
* Addison-Wesley, November 1999. The code is * Addison-Wesley, November 1999. The code is
* Copyright(c) Douglas Lea 1996, 1999 and released to the public domain * Copyright(c) Douglas Lea 1996, 1999 and released to the public domain
* and may be used for any purposes whatsoever. * and may be used for any purposes whatsoever.
* <p> * <p>
* For some reasons a solution based on * For some reasons a solution based on
* PipedOutputStream/PipedIntputStream * PipedOutputStream/PipedIntputStream
* does work *very* slowly: * does work *very* slowly:
* http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4404700 * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4404700
* <p> * <p>
* *
*/ */
class BoundedByteBuffer { class BoundedByteBuffer {
protected final byte[] fBuffer; // the elements protected final byte[] fBuffer; // the elements
@ -153,17 +153,17 @@ public class TerminalInputStream extends InputStream {
} }
/** /**
* An output stream that calls {@link TerminalInputStream#textAvailable} * An output stream that calls {@link TerminalInputStream#textAvailable}
* every time data is written to the stream. The data is written to * every time data is written to the stream. The data is written to
* {@link TerminalInputStream#fQueue}. * {@link TerminalInputStream#fQueue}.
* *
*/ */
class TerminalOutputStream extends OutputStream { class TerminalOutputStream extends OutputStream {
public void write(byte[] b, int off, int len) throws IOException { public void write(byte[] b, int off, int len) throws IOException {
try { try {
// optimization to avoid many synchronized // optimization to avoid many synchronized
// sections: put the data in junks into the // sections: put the data in junks into the
// queue. // queue.
int noff=off; int noff=off;
int end=off+len; int end=off+len;
while(noff<end) { while(noff<end) {
@ -200,7 +200,7 @@ public class TerminalInputStream extends InputStream {
} }
/** /**
* @param bufferSize the size of the buffer of the output stream * @param bufferSize the size of the buffer of the output stream
* @param uiTimeout the maximum time the notifyChange runnable runs. It will be * @param uiTimeout the maximum time the notifyChange runnable runs. It will be
* rescheduled after uiTimeout if input data is still available. * rescheduled after uiTimeout if input data is still available.
* @param notifyChange a Runnable that is posted to the Display thread * @param notifyChange a Runnable that is posted to the Display thread
* via {@link Display#asyncExec}. The runnable is posted several times! * via {@link Display#asyncExec}. The runnable is posted several times!
@ -228,7 +228,7 @@ public class TerminalInputStream extends InputStream {
synchronized(fQueue){ synchronized(fQueue){
fRunnable=null; fRunnable=null;
} }
// end the reading after some time // end the reading after some time
startTimer(fUITimeout); startTimer(fUITimeout);
// and start the real runnable // and start the real runnable
fNotifyChange.run(); fNotifyChange.run();
@ -312,14 +312,14 @@ public class TerminalInputStream extends InputStream {
// read as much as we can using a single synchronized statement // read as much as we can using a single synchronized statement
synchronized (fQueue) { synchronized (fQueue) {
try { try {
// The assumption is that the caller has used available to // The assumption is that the caller has used available to
// check if bytes are available! That's why we don't check // check if bytes are available! That's why we don't check
// for fEnoughDisplayTime! // for fEnoughDisplayTime!
// Make sure that not more than BLOCK_SIZE is read in one call // Make sure that not more than BLOCK_SIZE is read in one call
while(fQueue.size()>0 && n<len && n<BLOCK_SIZE) { while(fQueue.size()>0 && n<len && n<BLOCK_SIZE) {
cbuf[off+n]=fQueue.read(); cbuf[off+n]=fQueue.read();
n++; n++;
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }