Changeset 1424 for trunk/grails-app/domain
- Timestamp:
- Jan 21, 2011, 4:30:04 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/domain/dbnp/studycapturing/RelTime.groovy
r959 r1424 21 21 package dbnp.studycapturing 22 22 23 class RelTime {23 class RelTime implements Comparable { 24 24 final static long s = 1L; 25 25 final static long m = 60L * s; … … 285 285 286 286 public void computeDifference(Date start, Date end) { 287 println([start, end]);288 println([start.getTime(), end.getTime()]);289 290 287 if (start && end) { 291 288 long seconds = (end.getTime() - start.getTime()) / 1000L; … … 301 298 return reltime; 302 299 } 300 301 public boolean equals( Object o ) { 302 if( o == null ) 303 return false 304 if( !( o instanceof RelTime ) ) 305 return false 306 307 RelTime rt = (RelTime) o; 308 309 return rt.reltimeValue == this.reltimeValue; 310 } 311 312 public int compareTo( Object o ) throws ClassCastException { 313 if( o == null || !( o instanceof RelTime ) ) 314 throw new ClassCastException( "Can't cast object " + o + " of class " + o.class.getName() + " to RelTime for comparison.") 315 316 RelTime rt = (RelTime) o; 317 318 return rt.reltimeValue <=> this.reltimeValue; 319 } 303 320 }
Note: See TracChangeset
for help on using the changeset viewer.