import java.awt.Graphics;

public class Manager {
    /** Stores the current windows in order. */
    private Window[] windows;

    /** The number of windows currently in the list. */
    private int windowCount;
    
    /** Constructs an empty list. */
    public Manager() {
        windows = new Window[100];
        windowCount = 0;
    }

    /** Adds toAdd to this window list so that it appears on top.
     * Don't worry about what happens if the array is already full. */
    public void add(Window toAdd) {
        // Replace this line with your implementation
    }
    
    /** Removes toRemove from this window list. */
    public void remove(Window toRemove) {
        // Replace this line with your implementation
    }

    /** Returns the uppermost window in this list containing the point
     * (x,y), or null if no windows contain the point. Note that this
     * windowing system, like most, inverts the y-axis from what is
     * conventionally used in mathematics: The y=0 line is at the
     * display's top, and y increases as you move downward. */
    public Window find(int x, int y) {
        return null; // Replace this line with your implementation
    }
    
    /** Paints all the windows in this list, starting with the
     * lowermost. To paint an individual window, use its paint method
     * (passing the g parameter to it). You don't need to use the
     * parameter g in way other than to hand it to each individual
     * window. */
    public void paintAll(Graphics g) {
        // Replace this line with your implementation
    }
    
    /** Brings the window to the top of this list. */
    public void toFront(Window window) {
        remove(window);
        add(window);
    }
    
    /** Returns a string listing all of the windows in the
     * current array. */
    public String getList() {
        if(windowCount == 0) {
            return "  none\n";
        } else {
            StringBuffer buf = new StringBuffer();
            for(int i = 0; i < windowCount; i++) {
                buf.append("  " + i + ": " + windows[i] + "\n");
            }
            return buf.toString();
        }
    }
}
