net.sf.jasperreports.crosstabs.fill.calculation.BucketDefinition Maven / Gradle / Ivy
/*
* JasperReports - Free Java Reporting Library.
* Copyright (C) 2001 - 2014 TIBCO Software Inc. All rights reserved.
* http://www.jaspersoft.com
*
* Unless you have purchased a commercial license agreement from Jaspersoft,
* the following license terms apply:
*
* This program is part of JasperReports.
*
* JasperReports is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* JasperReports is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JasperReports. If not, see .
*/
package net.sf.jasperreports.crosstabs.fill.calculation;
import java.util.Comparator;
import net.sf.jasperreports.crosstabs.fill.BucketOrderer;
import net.sf.jasperreports.crosstabs.fill.calculation.BucketValueOrderDecorator.OrderPosition;
import net.sf.jasperreports.crosstabs.type.CrosstabTotalPositionEnum;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.analytics.dataset.BucketOrder;
import org.apache.commons.collections.comparators.ComparableComparator;
import org.apache.commons.collections.comparators.ReverseComparator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Bucket definition.
*
* @author Lucian Chirita ([email protected])
*/
public class BucketDefinition
{
private static final Log log = LogFactory.getLog(BucketDefinition.class);
public static final String EXCEPTION_MESSAGE_KEY_UNSUPPORTED_ORDER_TYPE = "crosstabs.calculation.unsupported.order.type";
/**
* Value type used for non-null values.
*/
protected static final byte VALUE_TYPE_VALUE = 0;
/**
* Value type used for null bucket values.
*/
protected static final byte VALUE_TYPE_NULL = 1;
/**
* Value type used for total buckets.
*/
protected static final byte VALUE_TYPE_TOTAL = 2;
/**
* The total value for this bucket.
*/
protected final Bucket VALUE_TOTAL = new Bucket(VALUE_TYPE_TOTAL);
/**
* The null bucket.
*/
protected final Bucket VALUE_NULL = new Bucket(VALUE_TYPE_NULL);
protected final Comparator