01: // @(#)$Id: JMLType.java 1.1 Mon, 02 May 2005 14:31:03 +0200 engelc $
02:
03: // Copyright (C) 1998, 1999, 2002 Iowa State University
04:
05: // This file is part of JML
06:
07: // JML is free software; you can redistribute it and/or modify
08: // it under the terms of the GNU General Public License as published by
09: // the Free Software Foundation; either version 2, or (at your option)
10: // any later version.
11:
12: // JML is distributed in the hope that it will be useful,
13: // but WITHOUT ANY WARRANTY; without even the implied warranty of
14: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: // GNU General Public License for more details.
16:
17: // You should have received a copy of the GNU General Public License
18: // along with JML; see the file COPYING. If not, write to
19: // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20:
21: package org.jmlspecs.models;
22:
23: /** Objects with a clone and equals method.
24: * JMLObjectType and JMLValueType are refinements
25: * for object and value containers (respectively).
26: * @version $Revision: 1.1 $
27: * @author Gary T. Leavens
28: * @author Albert L. Baker
29: * @see JMLObjectType
30: * @see JMLValueType
31: */
32: //-@ immutable
33: //@ pure
34: public interface JMLType extends Cloneable, java.io.Serializable {
35:
36: /** Return a clone of this object.
37: */
38: /*@ also
39: @ public normal_behavior
40: @ ensures \result != null;
41: @ ensures \result instanceof JMLType;
42: @ ensures \result.equals(this);
43: @*/
44: /*@ ensures \result != null
45: @ && \typeof(\result) <: \type(JMLType);
46: @*/
47: public/*@ pure @*/Object clone();
48:
49: /** Test whether this object's value is equal to the given argument.
50: */
51: /*@ also
52: @ public normal_behavior
53: @ ensures \result ==>
54: @ ob2 != null
55: @ && (* ob2 is not distinguishable from this,
56: @ except by using mutation or == *);
57: @ public normal_behavior
58: @ {|
59: @ requires ob2 != null && ob2 instanceof JMLType;
60: @ ensures ((JMLType)ob2).equals(this) == \result;
61: @ also
62: @ requires ob2 == this;
63: @ ensures \result <==> true;
64: @ |}
65: @*/
66: public/*@ pure @*/boolean equals(Object ob2);
67:
68: /** Return a hash code for this object.
69: */
70: public/*@ pure @*/int hashCode();
71: }
|