/** * <p> * Returns true if the present instance of RecurringDuration is greater than the parameter * <p> * Note : the order relation follows the W3C XML Schema draft i.e <tt>rd1 < rd2 </tt>iff rd2-rd1>0 * * @param reccD the recurring duration to compare with the present instance * @return true if the present instance is the greatest, false if not */ public boolean isGreater(RecurringDuration reccD) throws ValidationException { boolean result = false; if (!(this.getPeriod().equals(reccD.getPeriod())) || !(this.getDuration().equals(reccD.getDuration()))) { String err = " Recurring Duration which have different values " + "for the duration and period can not be compared"; throw new ValidationException(err); } short[] val_this = this.getValues(); short[] val_reccD = reccD.getValues(); int i = 0; while ((result != true) && (i < (val_this.length - 1))) { result = val_this[i] > val_reccD[i]; if (val_this[i] < val_reccD[i]) return false; i++; } return result; }// isGreater
/** * <p>Returns true if the present instance of RecurringDuration is greater than * the parameter * <p>Note : the order relation follows the W3C XML Schema draft i.e * <tt>rd1 < rd2 </tt>iff rd2-rd1>0 * @param reccD the recurring duration to compare with the present instance * @return true if the present instance is the greatest, false if not */ public boolean isGreater(RecurringDuration reccD) throws ValidationException { boolean result = false; if ( !(this.getPeriod().equals(reccD.getPeriod())) || !(this.getDuration().equals(reccD.getDuration())) ) { String err = " Recurring Duration which have different values " +"for the duration and period can not be compared"; throw new ValidationException(err); } short[] val_this = this.getValues(); short[] val_reccD = reccD.getValues(); int i = 0; while ( (result != true) && (i< (val_this.length-1)) ) { result = val_this[i] > val_reccD[i]; if ( val_this[i] < val_reccD[i]) return false; i++; } return result; }//isGreater