m trying to write a program that store a binary tree of possible events in an array. i need to be able to sort the the Events in the array based on the previous event that caused it by the time which they will occur. After the specific time has passed the event will be removed and all other events will be bumped up, all the while new events will be added to the end and sorted by their time.

Please Help

heres wot i've got so far, i've got some test that will test whe the program is doin wot it should. i just dont know how to implement the add(event) and remove(event) methods

// Store a collection of events. The operations are to add an event to the
// collection, or to remove the earliest event from the collection.
// Internally, a priority heap is used to provide an efficient implementation.

class EventQueue
{
// The fields of an EventQueue are...
Event[] eventqueue = new Event[100];
// The capacity() method returns the maximum size that the queue can grow
// to without resizing.
public int capicity()
{
return eventqueue.length;
}
// The size() method returns the number of events currently in the queue.
public int size(int count)
{
for (int i=0; i<eventqueue.length;i++)
{
if (eventqueue != null);
count = count+1;
}
return count;
}
// The add(event) method adds an event to the queue.
public void add(Event event)
{


}

// The take() method returns the earliest event in the queue.

// Test the queue.

public static void main(String[] args)
{
EventQueue q = new EventQueue();
Event e1 = new Event("One", 1);
Event e2 = new Event("Two", 2);
Event e3 = new Event("Three", 3);
q.add(e2);
q.add(e3);
q.add(e1);
test(q.size(), 3, "The queue should have size 3.");
test(q.capacity() >= 3, true, "The capacity should be >= size.");
test(q.take(), e1, "The earliest event was expected.");
test(q.take(), e2, "The second event was expected.");
test(q.take(), e3, "The third event was expected.");
}

// Test that an actual value matches an expected value, either of which can
// be null. Print the given message and throw an error if not.

private static void test(Object actual, Object expected, String message)
{
if (actual == null && expected == null) return;
if (actual != null && actual.equals(expected)) return;
System.err.print(message);
System.err.print(": " + actual);
System.err.println(", not " + expected);
throw new Error("Testing failed.");
}
}