All Packages Class Hierarchy This Package Previous Next Index
Class sdsu.util.CharQueue
java.lang.Object
|
+----sdsu.util.CharQueue
- public final class CharQueue
- extends Object
This class implements a characater queue. Yes the JKD does contain
a general queue. However that queue operates on objects. This queue
just handles char elements. Use in IO operations where converting
chars to objects will be too expensive.
- Version:
- 1.0 21 August 1997
- Author:
- Roger Whitney (whitney@cs.sdsu.edu)
-
DEFAULT_QUEUE_SIZE
-
-
CharQueue()
-
-
CharQueue(int)
-
-
capacity()
- Returns the current number of locations for chars in queue
-
clear()
- Clears the queue so it has no more elements in it
-
dequeue()
- Removes front char from the queue and returns the char
-
dequeue(char[])
- Fills charsRemoved with chars removed from the queue.
-
dequeue(char[], int, int)
- Places chars from queue in charsRemoved starting at charsRemoved[offset].
-
dequeueAll()
- Returns an array containing all chars in the queue.
-
enqueue(char)
- Adds charToAdd to the end of the queue
-
enqueue(char[])
- Adds all elements of charsToAdd to the end of the queue
-
enqueue(char[], int, int)
- Adds numCharsToAdd elements of charsToAdd, starting with charsToAdd[offset]
to the end of the queue
-
enqueue(String)
- Adds charsToAdd to the end of the queue
-
isEmpty()
- Returns true if the queue is empty
-
isFull()
- Returns true if the queue is full
-
peek()
- Returns the front char from the queue without removing it
-
size()
- Returns the number of chars in the queue
-
toString()
- Returns string representation of the queue
-
unusedCapacity()
- Returns the current number of unused locations in the queue
DEFAULT_QUEUE_SIZE
public static final int DEFAULT_QUEUE_SIZE
CharQueue
public CharQueue(int Size)
CharQueue
public CharQueue()
capacity
public int capacity()
- Returns the current number of locations for chars in queue
isEmpty
public boolean isEmpty()
- Returns true if the queue is empty
isFull
public boolean isFull()
- Returns true if the queue is full
size
public int size()
- Returns the number of chars in the queue
toString
public String toString()
- Returns string representation of the queue
- Overrides:
- toString in class Object
unusedCapacity
public int unusedCapacity()
- Returns the current number of unused locations in the queue
dequeue
public char dequeue()
- Removes front char from the queue and returns the char
dequeue
public int dequeue(char charsRemoved[])
- Fills charsRemoved with chars removed from the queue. If charsRemoved is
larger than queue then charsRemoved is not completely filled
- Returns:
- actual number of chars put in charsRemoved
dequeue
public int dequeue(char charsRemoved[],
int offset,
int numCharsRequested)
- Places chars from queue in charsRemoved starting at charsRemoved[offset].
Will place numCharsRequested into charsRemoved if queue has enougth chars.
- Returns:
- actual number of chars put in charsRemoved
dequeueAll
public char[] dequeueAll()
- Returns an array containing all chars in the queue. Afterwards queue is empty.
peek
public char peek()
- Returns the front char from the queue without removing it
enqueue
public void enqueue(char charToAdd)
- Adds charToAdd to the end of the queue
enqueue
public void enqueue(String charsToAdd)
- Adds charsToAdd to the end of the queue
enqueue
public void enqueue(char charsToAdd[])
- Adds all elements of charsToAdd to the end of the queue
enqueue
public void enqueue(char charsToAdd[],
int offset,
int numCharsToAdd)
- Adds numCharsToAdd elements of charsToAdd, starting with charsToAdd[offset]
to the end of the queue
clear
public void clear()
- Clears the queue so it has no more elements in it
All Packages Class Hierarchy This Package Previous Next Index