public class SimpleSet {
    int contents[];
    int size;

    SimpleSet(int capacity) {
	contents = new int[capacity];
	size = 0;
    }

    //@ modifies size, contents[*];
    boolean add(int i) {
	if (contains(i))
	    return false;
	contents[size++]=i;
	return true;
    }

    //@ pure
    boolean contains(int i) {
	for (int j = 0; j < size; ++j)
	    if (contents[j] == i) {
		return true;
	    }
	return false;
    }
}

class SimpleSetDriver {
    void testConstructor() {
	SimpleSet s = new SimpleSet(2);
	//@ assert !s.contains(5);
    }
    void testAdd() {
	SimpleSet s = new SimpleSet(2);
	s.add(5);
	//@ assert !s.contains(4);
	//@ assert s.contains(5);
	s.add(4);
	//@ assert s.contains(4);
	s.add(4);
    }
}
