/** * Returns the computed maximum value. * * @return The computed maximum value. */ public Object getValue() { if ( result == null ) { return null; } return result.get( lastGroupSequenceNumber ); }
/** * 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 ); }
/** * Returns the number of items counted (so far) by the function. This is either the number of items in the report, or * the group (if a group has been defined for the function). * * @return The item count. */ public Object getValue() { final BigDecimal value = count.get( lastGroupSequenceNumber ); if ( value == null ) { return ZERO; } return value; }
/** * Returns the computed minimum value. * * @return The computed minimum value. */ public Object getValue() { if ( result == null ) { return null; } return result.get( lastGroupSequenceNumber ); }
/** * 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() { final BigDecimal value = sum.get( lastGroupSequenceNumber ); if ( value == null ) { return ZERO; } return value; }
/** * Returns the function value, in this case the running total of a specific column in the report's data-set. * * @return The function value. */ public Object getValue() { return max.get( lastGroupSequenceNumber ); }
/** * Return the current expression value. * <P> * The value depends (obviously) on the expression implementation. * * @return the value of the function. */ public Object getValue() { if ( result == null ) { return null; } return result.get( lastGroupSequenceNumber ); }
/** * Returns the number of items counted (so far) by the function. This is either the number of items in the report, or * the group (if a group has been defined for the function). * * @return The item count. */ public Object getValue() { if ( result == null ) { return 0; } final Integer value = result.get( lastGroupSequenceNumber ); if ( value == null ) { return 0; } return value; }
/** * Return the current function value. * <p> * The value depends (obviously) on the function implementation. For example, a page counting function will return the * current page number. * * @return The value of the function. */ public Object getValue() { if ( result == null ) { return ZERO; } final BigDecimal value = result.get( lastGroupSequenceNumber ); if ( value == null ) { return ZERO; } return value; }
/** * Return the number of distint values for the given column. * * @return the value of the function. */ public Object getValue() { final HashSet vals = values.get( lastGroupSequenceNumber ); if ( vals != null ) { return vals.size(); } return 0; }
/** * Returns the function value, in this case the average of all values of a specific column in the report's TableModel. * * @return The function value. */ public Object getValue() { final BigDecimal count = itemCount.get( lastGroupSequenceNumber ); if ( count == null ) { return null; } final BigDecimal sum = this.sum.get( lastGroupSequenceNumber ); if ( sum == null ) { return null; } if ( count.longValue() == 0 ) { return null; } return sum.divide( count, scale, roundingMode ); }
/** * Received notification of a move to the next row of data. Increments the item count. * * @param event * Information about the event. */ public void itemsAdvanced( final ReportEvent event ) { final BigDecimal oldValue = count.get( lastGroupSequenceNumber ); if ( oldValue == null ) { count.set( lastGroupSequenceNumber, ONE ); } else { count.set( lastGroupSequenceNumber, oldValue.add( ONE ) ); } }
/** * Receives notification that a row of data is being processed. * * @param event the event. */ public void itemsAdvanced( final ReportEvent event ) { if ( isPrepareRunLevel( event ) == false ) { return; } final Integer oldValue = result.get( lastGroupSequenceNumber ); if ( oldValue == null ) { result.set( lastGroupSequenceNumber, 1 ); } else { result.set( lastGroupSequenceNumber, oldValue + 1 ); } }
/** * Receives notification that a row of data is being processed. Reads the data from the field defined for this * function and performs the maximum value comparison with its old 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 = max.get( lastGroupSequenceNumber ); if ( oldValue == null || oldValue.compareTo( compare ) < 0 ) { max.set( lastGroupSequenceNumber, compare ); } } catch ( Exception e ) { ItemMaxFunction.logger.error( "ItemMaxFunction.advanceItems(): problem comparing number." ); } }
/** * 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." ); } }
/** * Receives notification that a row of data is being processed. * * @param event * the event. */ public void itemsAdvanced( final ReportEvent event ) { if ( getField() == null ) { return; } final Object o = event.getDataRow().get( getField() ); HashSet<Object> valueSet = this.values.get( lastGroupSequenceNumber ); if ( valueSet == null ) { valueSet = new HashSet<Object>(); this.values.set( lastGroupSequenceNumber, valueSet ); } if ( ignoreNullValues && o == null ) { return; } valueSet.add( o ); }
/** * Receives notification that a row of data is being processed. * * @param event the event. */ public void itemsAdvanced( final ReportEvent event ) { if ( field == null ) { return; } if ( FunctionUtilities.isDefinedPrepareRunLevel( this, event ) == false ) { return; } final Object fieldValue = event.getDataRow().get( getField() ); if ( fieldValue instanceof Comparable == false ) { return; } try { final Comparable compare = (Comparable) fieldValue; final Comparable oldValue = result.get( lastGroupSequenceNumber ); if ( oldValue == null || oldValue.compareTo( compare ) > ZERO_I ) { result.set( lastGroupSequenceNumber, compare ); } } catch ( Exception e ) { logger.error( "TotalItemMinFunction.advanceItems(): problem comparing values." ); } }
/** * Receives notification that a row of data is being processed. * * @param event the event. */ public void itemsAdvanced( final ReportEvent event ) { if ( field == null ) { return; } if ( FunctionUtilities.isDefinedPrepareRunLevel( this, event ) == false ) { return; } final Object fieldValue = event.getDataRow().get( getField() ); if ( fieldValue instanceof Comparable == false ) { return; } try { final Comparable compare = (Comparable) fieldValue; final Comparable oldValue = result.get( lastGroupSequenceNumber ); if ( oldValue == null || oldValue.compareTo( compare ) < ZERO_I ) { result.set( lastGroupSequenceNumber, compare ); } } catch ( Exception e ) { logger.error( "TotalItemMaxFunction.advanceItems(): problem comparing values." ); } }
/** * Receives notification that a row of data is being processed. Reads the data from the field defined for this * function and adds it to the running total. * <P> * This function assumes that it will find an instance of the Number class in the column of the data-row specified by * the field name. * * @param event * Information about the event. */ public void itemsAdvanced( final ReportEvent event ) { final Object fieldValue = getDataRow().get( getField() ); if ( fieldValue == null ) { return; } if ( fieldValue instanceof Number == false ) { return; } final Number numerValue = (Number) fieldValue; final BigDecimal number = ExpressionUtilities.convertToBigDecimal( numerValue ); final BigDecimal oldValue = sum.get( lastGroupSequenceNumber ); if ( oldValue == null ) { sum.set( lastGroupSequenceNumber, number ); } else { sum.set( lastGroupSequenceNumber, oldValue.add( number ) ); } }
/** * Receives notification that a row of data is being processed. * * @param event the event. */ public void itemsAdvanced( final ReportEvent event ) { if ( field == null ) { return; } if ( isPrepareRunLevel( event ) == false ) { return; } final BigDecimal value = ExpressionUtilities.convertToBigDecimal( event.getDataRow().get( getField() ) ); if ( value == null ) { return; } final BigDecimal oldValue = result.get( lastGroupSequenceNumber ); if ( oldValue == null ) { result.set( lastGroupSequenceNumber, value ); } else { result.set( lastGroupSequenceNumber, oldValue.add( value ) ); } }