// @(#)$Id: Dictionary.refines-spec,v 1.6 2006/11/28 03:51:11 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; public abstract class Dictionary { //@ public ghost \TYPE keyType = \type(Object); //@ public ghost \TYPE elementType = \type(Object); //@ pure public Dictionary(); //@ modifies \nothing; public abstract int size(); //@ modifies \nothing; public abstract boolean isEmpty(); //@ modifies \nothing; public abstract /*@non_null*/ Enumeration keys(); //@ modifies \nothing; public abstract /*@non_null*/ Enumeration elements(); // NOTE: // While the spec of Dictionary states that key and value cannot be null, // due to behavioral subtyping and the fact that subclasses of Dictionary allow // key and value to be null, we must declare these formal parameters as nullable. //@ requires key != null; //@ modifies \nothing; public abstract /*@ nullable @*/ Object get(/*@ nullable @*/ Object key); //@ requires key != null; //@ requires value != null; public abstract /*@ nullable @*/ Object put(/*@ nullable @*/ Object key, /*@ nullable @*/ Object value); //@ requires key != null; public abstract /*@ nullable @*/ Object remove(/*@ nullable @*/ Object key); }