JML

java.sql
Class Date

java.lang.Object
  extended byjava.util.Date
      extended byjava.sql.Date
All Implemented Interfaces:
Cloneable, Comparable, Serializable

public class Date
extends Date

JML specification for Date.

Author:
Chenwei Qiu, Gary T. Leavens

Class Specifications

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

Specifications inherited from interface Comparable
instance public invariant ( \forall java.lang.Comparable x; x != null; x.compareTo(x) == 0);
instance public invariant ( \forall java.lang.Comparable x, y; x != null&&y != null&&this.definedComparison(x,y)&&this.definedComparison(y,x); this.sgn(x.compareTo(y)) == -this.sgn(y.compareTo(x)));
instance public invariant ( \forall int n; n == -1||n == 1; ( \forall java.lang.Comparable x, y, z; x != null&&y != null&&z != null&&this.definedComparison(x,y)&&this.definedComparison(y,z)&&this.definedComparison(x,z); this.sgn(x.compareTo(y)) == n&&this.sgn(y.compareTo(z)) == n ==> this.sgn(x.compareTo(z)) == n));
instance public invariant ( \forall int n; n == -1||n == 1; ( \forall java.lang.Comparable x, y, z; x != null&&y != null&&z != null&&this.definedComparison(x,y)&&this.definedComparison(y,z)&&this.definedComparison(x,z); (this.sgn(x.compareTo(y)) == 0&&this.sgn(y.compareTo(z)) == n||this.sgn(x.compareTo(y)) == n&&this.sgn(y.compareTo(z)) == 0) ==> this.sgn(x.compareTo(z)) == n));
instance public invariant ( \forall java.lang.Comparable x, y, z; x != null&&y != null&&z != null&&this.definedComparison(x,y)&&this.definedComparison(x,z)&&this.definedComparison(y,z); this.sgn(x.compareTo(y)) == 0 ==> this.sgn(x.compareTo(z)) == this.sgn(y.compareTo(z)));

Model Field Summary
 
Model fields inherited from class java.lang.Object
_getClass, objectState, theString
 
Ghost Field Summary
static long millisInDay
           
 
Ghost fields inherited from class java.lang.Object
objectTimesFinalized, owner
 
Field Summary
 
Fields inherited from class java.util.Date
cal, fastTime
 
Constructor Summary
Date(int year, int month, int day)
          Deprecated.  
Date(long date)
           
 
Model Method Summary
 
Model methods inherited from class java.lang.Object
hashValue
 
Model methods inherited from interface java.lang.Comparable
definedComparison, sgn
 
Method Summary
 boolean equals(nullable Object o)
           
 int getHours()
          Deprecated.  
 int getMinutes()
          Deprecated.  
 int getSeconds()
          Deprecated.  
 void setHours(int i)
          Deprecated.  
 void setMinutes(int i)
          Deprecated.  
 void setSeconds(int i)
          Deprecated.  
 void setTime(long date)
           
 String toString()
           
static Date valueOf(String s)
           
 
Methods inherited from class java.util.Date
after, before, clone, compareTo, compareTo, getDate, getDay, getMonth, getTime, getTimezoneOffset, getYear, hashCode, parse, setDate, setMonth, setYear, toGMTString, toLocaleString, UTC
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Ghost Field Detail

millisInDay

public static final long millisInDay
Constructor Detail

Date

public Date(int year,
            int month,
            int day)
Deprecated.  


Date

public Date(long date)
Specifications:
requires date >= 0||date%86400000 == 0;
assignable fastTime;
ensures this.cal == null&&this.fastTime == date;
     also
requires date < 0&&date%86400000 != 0;
assignable fastTime;
ensures this.cal == null&&this.fastTime == ((date/86400000)*86400000)-86400000;
Method Detail

getHours

public int getHours()
Deprecated.  

Overrides:
getHours in class Date
Specifications inherited from overridden method in class Date:
      --- None ---

getMinutes

public int getMinutes()
Deprecated.  

Overrides:
getMinutes in class Date
Specifications inherited from overridden method in class Date:
      --- None ---

getSeconds

public int getSeconds()
Deprecated.  

Overrides:
getSeconds in class Date
Specifications inherited from overridden method in class Date:
      --- None ---

setHours

public void setHours(int i)
Deprecated.  

Overrides:
setHours in class Date
Specifications inherited from overridden method in class Date:
      --- None ---

setMinutes

public void setMinutes(int i)
Deprecated.  

Overrides:
setMinutes in class Date
Specifications inherited from overridden method in class Date:
      --- None ---

setSeconds

public void setSeconds(int i)
Deprecated.  

Overrides:
setSeconds in class Date
Specifications inherited from overridden method in class Date:
      --- None ---

setTime

public void setTime(long date)
Overrides:
setTime in class Date
Specifications:
     also
requires date >= 0||date%86400000 == 0;
assignable fastTime;
ensures this.fastTime == date;
     also
requires date < 0&&date%86400000 != 0;
assignable fastTime;
ensures this.fastTime == ((date/86400000)*86400000)-86400000;
Specifications inherited from overridden method setTime(long time) in class Date:
public normal_behavior
requires this.cal == null;
assignable fastTime;
ensures this.fastTime == time;
     also
public normal_behavior
requires this.cal != null;
assignable cal;
ensures time == this.cal.getTimeInMillis();

toString

public String toString()
Overrides:
toString in class Date
Specifications: pure
     also
assignable \nothing;
ensures \result != null&&this.equals(valueOf(\result ));
Specifications inherited from overridden method in class Date:
     also
public normal_behavior
assignable \nothing;
ensures (* \result is the String representation of Date *);
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;

valueOf

public static Date valueOf(String s)
Specifications: pure
requires s != null&&s.matches("[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]");
assignable \nothing;
ensures \result != null&&\result .toString().equals(s);

equals

public boolean equals(nullable Object o)
Overrides:
equals in class Date
Specifications: pure
     also
requires o instanceof java.sql.Date;
ensures \result ==> (((java.sql.Date)o).fastTime == this.fastTime);
Specifications inherited from overridden method equals(Object obj) in class Date:
       pure
     also
public normal_behavior
old java.util.Date date = (java.util.Date)obj;
requires obj != null;
assignable \nothing;
ensures \result ==> (obj instanceof java.util.Date&&this.getTime() == date.getTime());
Specifications inherited from overridden method equals(Object obj) in class Object:
       pure
public normal_behavior
requires obj != null;
ensures (* \result is true when obj is "equal to" this object *);
     also
public normal_behavior
requires this == obj;
ensures \result ;
     also
public code normal_behavior
requires obj != null;
ensures \result <==> this == obj;
     also
diverges false;
ensures obj == null ==> !\result ;

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.