JML

java.sql
Class Time

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

public class Time
extends Date

JML specification for Time.

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
Time(int hour, int minutes, int second)
          Deprecated.  
Time(long time)
           
 
Model Method Summary
 boolean sameTimeOfDay(long t1, long t2)
          return true when t1 and t2 have the same hours, minutes, and seconds.
 
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 getDate()
          Deprecated.  
 int getDay()
          Deprecated.  
 int getMonth()
          Deprecated.  
 int getYear()
          Deprecated.  
 void setDate(int Param0)
          Deprecated.  
 void setMonth(int Param0)
          Deprecated.  
 void setTime(long time)
           
 void setYear(int Param0)
          Deprecated.  
 String toString()
           
static Time valueOf(String s)
           
 
Methods inherited from class java.util.Date
after, before, clone, compareTo, compareTo, getHours, getMinutes, getSeconds, getTime, getTimezoneOffset, hashCode, parse, setHours, setMinutes, setSeconds, 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

Time

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

Time

public Time(int hour,
            int minutes,
            int second)
Deprecated.  

Model Method Detail

sameTimeOfDay

public boolean sameTimeOfDay(long t1,
                             long t2)
return true when t1 and t2 have the same hours, minutes, and seconds.

Specifications: pure
Method Detail

getDate

public int getDate()
Deprecated.  

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

getDay

public int getDay()
Deprecated.  

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

getMonth

public int getMonth()
Deprecated.  

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

getYear

public int getYear()
Deprecated.  

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

setDate

public void setDate(int Param0)
Deprecated.  

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

setMonth

public void setMonth(int Param0)
Deprecated.  

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

setYear

public void setYear(int Param0)
Deprecated.  

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

setTime

public void setTime(long time)
Overrides:
setTime in class Date
Specifications:
     also
assignable fastTime;
ensures this.fastTime == time;
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.sameTimeOfDay(this.fastTime,valueOf(\result ).fastTime);
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 Time valueOf(String s)
Specifications: pure
requires s != null&&s.matches("[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.Time;
ensures \result ==> (((java.sql.Time)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.