return super.add(o); } else if (element.type() == Element.SECTION) { Section section = (Section) o; section.setNumbers(++subsections, numbers); return super.add(section);
super.add(index, element);
    public boolean add(Object o) {        try {            Element element = (Element) o;            if (element.type() == Element.PARAGRAPH ||            element.type() == Element.LIST ||            element.type() == Element.CHUNK ||            element.type() == Element.PHRASE ||            element.type() == Element.ANCHOR ||            element.type() == Element.ANNOTATION ||            element.type() == Element.TABLE ||            element.type() == Element.GIF ||            element.type() == Element.JPEG ||            element.type() == Element.PNG ||            element.type() == Element.IMGRAW) {                return super.add(o);            }            else if (element.type() == Element.SECTION) {                Section section = (Section) o;                section.setNumbers(++subsections, numbers);                return super.add(section);            }            else {                throw new ClassCastException(String.valueOf(element.type()));            }        }        catch(ClassCastException cce) {            throw new ClassCastException("Insertion of illegal Element: " + cce.getMessage());        }    }