JML

org.jmlspecs.samples.prelimdesign
Class Point2D

java.lang.Object
  extended byorg.jmlspecs.samples.prelimdesign.Point2D

public class Point2D
extends Object


Class Specifications
public invariant !java.lang.Double.isNaN(this.x);
public invariant !java.lang.Double.isNaN(this.y);
public invariant !java.lang.Double.isInfinite(this.x);
public invariant !java.lang.Double.isInfinite(this.y);

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

Model Field Summary
 
Model fields inherited from class java.lang.Object
_getClass, objectState, theString
 
Ghost Field Summary
 
Ghost fields inherited from class java.lang.Object
objectTimesFinalized, owner
 
Field Summary
[spec_public] private  double x
           
[spec_public] private  double y
           
 
Constructor Summary
Point2D()
           
Point2D(double xc, double yc)
           
 
Model Method Summary
 
Model methods inherited from class java.lang.Object
hashValue
 
Method Summary
 double getX()
           
 double getY()
           
 void moveX(double dx)
           
 void moveY(double dy)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

private double x
Specifications: spec_public

y

private double y
Specifications: spec_public
Constructor Detail

Point2D

public Point2D()
Specifications:
ensures this.x == 0.0&&this.y == 0.0;

Point2D

public Point2D(double xc,
               double yc)
Specifications:
requires !java.lang.Double.isNaN(xc);
requires !java.lang.Double.isNaN(yc);
requires !java.lang.Double.isInfinite(xc);
requires !java.lang.Double.isInfinite(yc);
assignable x, y;
ensures this.x == xc&&this.y == yc;
Method Detail

getX

public double getX()
Specifications: pure
ensures \result == this.x;

getY

public double getY()
Specifications: pure
ensures \result == this.y;

moveX

public void moveX(double dx)
Specifications:
requires !java.lang.Double.isNaN(this.x+dx);
requires !java.lang.Double.isInfinite(this.x+dx);
assignable x;
ensures org.jmlspecs.models.JMLDouble.approximatelyEqualTo(this.x,\old(this.x+dx),1.0E-10);

moveY

public void moveY(double dy)
Specifications:
requires !java.lang.Double.isNaN(this.y+dy);
requires !java.lang.Double.isInfinite(this.y+dy);
assignable y;
ensures org.jmlspecs.models.JMLDouble.approximatelyEqualTo(this.y,\old(this.y+dy),1.0E-10);

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.