Buffer program - outline

Buffer program - outline

class Buffer {

private protected Object[] buf;

private protected int in = 0; //index for put

private protected int out = 0; //index for get

private protected int count = 0; //items in buffer

private protected int size;

Buffer(int size) {

this.size = size;

buf = new Object[size];

}

synchronized public void put(Object o) {…}

synchronized public Object get() {…}

}

Previous slide Next slide Back to the first slide View Graphic Version