JML

org.jmlspecs.samples.misc
Interface Counter

All Known Implementing Classes:
Meter

public interface Counter

A simple Counter. This class is a demo of behavioral subtyping.


Class Specifications
instance public invariant 0 <= this.val&&this.val < 100;

Specifications inherited from class Object
represents objectState <- org.jmlspecs.lang.JMLDataGroup.IT;
public represents _getClass <- \typeof(this);

Model Field Summary
[instance]  int val
          A model of the value of this counter.
 
Field Summary
static int CAPACITY
          The capacity of this counter.
 
Method Summary
 void inc()
          Increment this counter
 int value()
          Return the value of this counter.
 

Model Field Detail

val

public int val
A model of the value of this counter.

Specifications: instance
datagroup contains: org.jmlspecs.samples.misc.Meter.count
Field Detail

CAPACITY

public static final int CAPACITY
The capacity of this counter.

Method Detail

inc

public void inc()
Increment this counter

Specifications:
requires this.val < 100;
assignable val;
ensures this.val == \old(this.val+1);

value

public int value()
Return the value of this counter.

Specifications: pure
ensures \result == this.val;

JML

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.