org.jmlspecs.samples.stacks
Class UnboundedStackAsArrayList
java.lang.Object
org.jmlspecs.samples.stacks.UnboundedStack
org.jmlspecs.samples.stacks.UnboundedStackAsArrayList
- public class UnboundedStackAsArrayList
- extends UnboundedStack
Class Specifications |
protected invariant this.elems != null;
protected represents theStack <- this.abstractValue();
protected represents_redundantly theStack \such_that ( \forall int i; 0 <= i&&i < this.elems.size(); this.elems.get(i) == this.theStack.itemAt(i)); |
Specifications inherited from class UnboundedStack |
public invariant this.theStack != null;
public initially this.theStack != null&&this.theStack.isEmpty(); |
Specifications inherited from class Object |
represents objectState <- org.jmlspecs.lang.JMLDataGroup.IT;
public represents _getClass <- \typeof(this); |
elems
protected ArrayList elems
- Specifications:
is in groups: theStack
maps elems.theList \into theStack
UnboundedStackAsArrayList
public UnboundedStackAsArrayList()
- Specifications:
-
public normal_behavior
assignable theStack;
ensures this.theStack.isEmpty();
abstractValue
protected JMLObjectSequence abstractValue()
- Specifications: pure
pop
public void pop()
- Specifications:
- also
-
protected normal_behavior
requires !this.theStack.isEmpty();
assignable theStack;
ensures \not_modified(elems);
- Specifications inherited from overridden method in class UnboundedStack:
-
public normal_behavior
requires !this.theStack.isEmpty();
assignable theStack;
ensures this.theStack.equals(\old(this.theStack.trailer()));
push
public void push(Object x)
- Specifications:
- also
-
protected normal_behavior
assignable theStack;
ensures \not_modified(elems);
- Specifications inherited from overridden method push(Object x) in class UnboundedStack:
-
public normal_behavior
assignable theStack;
ensures this.theStack.equals(\old(this.theStack.insertFront(x)));
top
public Object top()
- Specifications: (inherited)pure
- Specifications inherited from overridden method in class UnboundedStack:
pure -
public normal_behavior
requires !this.theStack.isEmpty();
assignable \nothing;
ensures \result == this.theStack.first();
toString
public String toString()
- Overrides:
toString
in class Object
- Specifications inherited from overridden method in class Object:
non_null -
public normal_behavior
assignable objectState;
ensures \result != null&&\result .equals(this.theString);
ensures (* \result is a string representation of this object *);
- also
-
public code normal_behavior
assignable \nothing;
ensures \result != null&&(* \result is the instance's class name, followed by an @, followed by the instance's hashcode in hex *);
- also
-
public code model_program { ... }
- implies_that
-
assignable objectState;
ensures \result != null;
JML is Copyright (C) 1998-2002 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.