Skip to content
Snippets Groups Projects
Commit 03df4412 authored by rasmusse's avatar rasmusse
Browse files

Kommentare und paar Versuche

parent 3e8310b2
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@ import java.nio.BufferUnderflowException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Semaphore;
import java.lang.Thread;
public class Buffer<T>{
public int size;
public Semaphore mutex;
......@@ -11,26 +12,27 @@ public class Buffer<T>{
public Buffer(int size) {
this.size= size;
public void push(Buffer<?> e) throws BufferOverflowException {
//BufferOVerflowException, wenn Buffer voll ist und dennoch Element geschrieben werden will
public void push(Buffer<T> e){
if()
mutex.acquire();
items.add(T.e);
mutex.release();
}
public void pop() throws BufferUnderflowException {
//BufferUnderflowException wenn Buffer leer ist und dennoch Element gelesen werden will
public void pop(Buffer<T> e){
}
public boolean full(){
assert items.size()>=0 : "Buffer cannot be less than 0 in size";
assert
}
public boolean empty(){
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment