/** * Returns true if the instance of TimeDuration has the same fields * of the parameter * @param timeD the time duration to compare * @return true if equal, false if not */ public boolean equal(TimeDuration timeD) { boolean result = false; if (timeD == null) return result; result = (_year == timeD.getYear()); result = result && (_month == timeD.getMonth()); result = result && (_day == timeD.getDay()); result = result && (_hour == timeD.getHour()); result = result && (_minute == timeD.getMinute()); result = result && (_second == timeD.getSeconds()); result = result && (this.isNegative() == timeD.isNegative()); return result; } //equals
/** * Returns true if the instance of TimeDuration has the same fields of the parameter * * @param timeD the time duration to compare * @return true if equal, false if not */ public boolean equal(TimeDuration timeD) { boolean result = false; if (timeD == null) return result; result = (_year == timeD.getYear()); result = result && (_month == timeD.getMonth()); result = result && (_day == timeD.getDay()); result = result && (_hour == timeD.getHour()); result = result && (_minute == timeD.getMinute()); result = result && (_second == timeD.getSeconds()); result = result && (this.isNegative() == timeD.isNegative()); return result; } // equals
/** * Sets the value of the field associated with this descriptor. * * @param target the object in which to set the value * @param value the value of the field */ public void setValue(Object target, Object value) throws java.lang.IllegalStateException { if (!(target instanceof TimeDuration)) { // -- throw exception } TimeDuration time = (TimeDuration) target; if (value == null) { /// do something } // -- update current instance of time with new time try { TimeDuration temp = TimeDuration.parseTimeDuration(value.toString()); time.setYear(temp.getYear()); time.setMonth(temp.getMonth()); time.setDay(temp.getDay()); time.setHour(temp.getHour()); time.setMinute(temp.getMinute()); time.setSeconds(temp.getSeconds()); } catch (java.text.ParseException ex) { // -- ignore for now } } // -- setValue
/** * Sets the value of the field associated with this descriptor. * * @param target * the object in which to set the value * @param value * the value of the field */ public void setValue(Object target, Object value) throws java.lang.IllegalStateException { if (! (target instanceof TimeDuration) ) { //-- throw exception } TimeDuration time = (TimeDuration) target; if (value == null) { /// do something } //-- update current instance of time with new time try { TimeDuration temp = TimeDuration.parseTimeDuration(value.toString()) ; time.setYear(temp.getYear()); time.setMonth(temp.getMonth()); time.setDay(temp.getDay()); time.setHour(temp.getHour()); time.setMinute(temp.getMinute()); time.setSeconds(temp.getSeconds()); } catch (java.text.ParseException ex) { //-- ignore for now } } //-- setValue