home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
Queue.java
< prev
next >
Wrap
Text File
|
1997-04-24
|
2KB
|
101 lines
import java.util.Enumeration;
import java.util.Vector;
// Do not delete this line -- Start Class Declarations
public class Queue extends Object {
// Data attributes
// Association attributes
private Vector queue;
// Default constructor
public Queue() {
// Start user code section
queue = new Vector();
// End user code section
} // default constructor Queue
// User defined constructors
public Queue(Object object) {
queue = new Vector();
queue.addElement(object);
} // user constructor Queue -- regeneration end marker
// Methods
public void append(Object object) {
queue.addElement(object);
} // method append -- regeneration end marker
public void insert(Object object) {
try {
queue.insertElementAt(object, 0);
} catch (ArrayIndexOutOfBoundsException e) {}
} // method insert -- regeneration end marker
public void clear() {
queue.removeAllElements();
} // method clear -- regeneration end marker
public int entries() {
return (queue.size());
} // method entries -- regeneration end marker
public Object first() {
return queue.firstElement();
} // method first -- regeneration end marker
public Object last() {
return queue.lastElement();
} // method last -- regeneration end marker
public void removeElement(Object object) {
queue.removeElement(object);
} // method removeElement -- regeneration end marker
public Enumeration elements() {
return queue.elements();
} // method elements -- regeneration end marker
// Do not delete this line -- regeneration end marker
// Attribute accessors
// Association accessors
} // class Queue
// Do not delete this line -- End Class Declarations