All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.jagg.NoPropAnalytic Maven / Gradle / Ivy

Go to download

jAgg is a Java 5.0 API that supports “group by” operations on Lists of Java objects: aggregate operations such as count, sum, max, min, avg, and many more. It also allows custom aggregate operations.

The newest version!
package net.sf.jagg;

/**
 * This abstract class allows the implementation of analytic functions over no
 * variables (properties).  The analytic algorithm is
 * the same as in AnalyticAggregator, but NoPropAnlaytics
 * don't allow any property names (null or an empty string
 * "" are acceptable as "property" names).  No-property
 * Aggregtors don't make sense by themselves; they only make sense
 * as an AnalyticFunction, so this implements
 * AnalyticFunction.  An example of a  NoPropAnalytic
 * is a RowNumberAnalytic, which assigns row numbers through its
 * partitions and orderings, regardless of the value(s).
 *
 * @author Randy Gettman
 * @since 0.9.0
 */
public abstract class NoPropAnalytic extends Aggregator implements AnalyticFunction
{
   /**
    * Default constructor is protected so that only subclasses of
    * NoPropAnalytic can be instantiated.
    */
   protected NoPropAnalytic()
   {
      super();
   }

   /**
    * Sets no property Strings.  Enforces that any property passed
    * in here is either null or an empty string "".
    *
    * @param property The property string, expected tobe either null
    *     or an empty string "".
    */
   @Override
   protected void setProperty(String property)
   {
      if (property != null && property.length() > 0)
         throw new IllegalArgumentException("No property expected: " + property);
   }

   /**
    * There is no property; throws an UnsupportedOperationException.
    * 
    * @return Doesn't return normaly.
    * @throws UnsupportedOperationException There is no property.
    */
   @Override
   public String getProperty()
   {
      throw new UnsupportedOperationException("No property is supported!");
   }

   /**
    * A String representation of this
    * NoPropAnalytic.  It displays no property.
    *
    * @return The string representation.
    */
   @Override
   public String toString()
   {
      return getClass().getName() + "()";
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy