// @(#)$Id: TreeSet.refines-spec,v 1.11 2006/12/11 23:09:41 chalin Exp $ // Copyright (C) 2005 Iowa State University // // This file is part of the runtime library of the Java Modeling Language. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public License // as published by the Free Software Foundation; either version 2.1, // of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with JML; see the file LesserGPL.txt. If not, write to the Free // Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA // 02110-1301 USA. package java.util; //@ model import org.jmlspecs.models.JMLEqualsSet; /** JML's specification of java.util.TreeSet. * @version $Revision: 1.11 $ * @author Katie Becker * @author Gary T. Leavens */ public class TreeSet extends AbstractSet implements SortedSet, Cloneable, java.io.Serializable { /*@ public normal_behavior @ assignable theSet; @ ensures theSet != null && theSet.isEmpty(); @*/ public TreeSet(); /*@ public normal_behavior @ assignable theSet; @ ensures theSet != null && theSet.isEmpty(); @*/ public TreeSet(Comparator c); /*@ public normal_behavior @ assignable theSet; @ ensures theSet != null @ && theSet.equals(JMLEqualsSet.convertFrom(c)); @*/ public TreeSet(Collection c); /*@ public normal_behavior @ requires s != null; @ assignable theSet; @ ensures theSet != null && theSet.equals(s.theSet); @ also @ public exceptional_behavior @ requires s == null; @ assignable theSet; @ signals_only NullPointerException; @*/ public TreeSet(SortedSet s); // specified by Collection //@ pure public Iterator iterator(); // specified by Collection //@ pure public int size(); // specified by Collection //@ pure public boolean isEmpty(); // specified by Collection //@ pure public boolean contains(/*@nullable*/ Object o); // specified by Collection public boolean add(/*@nullable*/ Object o); // specified by Collection public boolean remove(/*@nullable*/ Object o); // specified by Collection public void clear(); // specified by Collection public boolean addAll(Collection c); // specified by SortedSet public SortedSet subSet(Object fromElement, Object toElement); // specified by SortedSet public SortedSet headSet(Object toElement); // specified by SortedSet public SortedSet tailSet(Object fromElement); // specified by SortedSet public Comparator comparator(); // specified by SortedSet public Object first(); // specified by SortedSet public Object last(); /*@ also @ public normal_behavior @ ensures \result instanceof TreeSet && \fresh(\result) @ && ((TreeSet)\result).equals(this); @ ensures_redundantly \result != this; @*/ public /*@ pure @*/ Object clone(); }