public Object clone() { try { final ItemMinFunction function = (ItemMinFunction) super.clone(); function.min = min.clone(); return function; } catch (CloneNotSupportedException e) { throw new IllegalStateException(); } }
/** * Receives notification that a row of data is being processed. Reads the data from the field * defined for this function and calculates the minimum value. * * @param event Information about the event. */ public void itemsAdvanced(final ReportEvent event) { if (field == null) { return; } final Object fieldValue = event.getDataRow().get(getField()); if (fieldValue instanceof Comparable == false) { return; } try { final Comparable compare = (Comparable) fieldValue; final Comparable oldValue = min.get(lastGroupSequenceNumber); if (oldValue == null || oldValue.compareTo(compare) > 0) { min.set(lastGroupSequenceNumber, compare); } } catch (Exception e) { ItemMinFunction.logger.error("ItemMinFunction.advanceItems(): problem adding number."); } }
/** * Return a completly separated copy of this function. The copy does no longer share any * changeable objects with the original function. * * @return a copy of this function. */ public Expression getInstance() { final ItemMinFunction function = (ItemMinFunction) super.getInstance(); function.min = min.clone(); function.lastGroupSequenceNumber = 0; return function; }
/** * Returns the function value, in this case the running total of a specific column in the report's * data row. * * @return The function value. */ public Object getValue() { return min.get(lastGroupSequenceNumber); }