KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > storage > search > AggregatedField


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.storage.search;
11
12 /**
13  * A field in an aggregated query.
14  * <p>
15  * Each field in a aggregated query has an aggregation type, which is one of
16  * the values listed below.
17  * </ul>
18  * This corresponds to an aggregated field in SQL SELECT-syntax.
19  *
20  * @author Rob van Maris
21  * @version $Id: AggregatedField.java,v 1.4 2005/04/25 14:56:57 pierre Exp $
22  * @since MMBase-1.7
23  */

24 public interface AggregatedField extends StepField {
25
26     /**
27      * Aggregation type, resulting in grouping the results on non-null
28      * values of this field.
29      */

30     public final static int AGGREGATION_TYPE_GROUP_BY = 1;
31
32     /**
33      * Aggregation type, resulting in count of non-null
34      * values in this field.
35      */

36     public final static int AGGREGATION_TYPE_COUNT = 2;
37
38     /**
39      * Aggregation type, resulting in count of distinct non-null
40      * values in this field.
41      */

42     public final static int AGGREGATION_TYPE_COUNT_DISTINCT = 3;
43
44     /** Aggregation type, resulting in minimum value in this field. */
45     public final static int AGGREGATION_TYPE_MIN = 4;
46
47     /** Aggregation type, resulting in maximum value in this field. */
48     public final static int AGGREGATION_TYPE_MAX = 5;
49
50     /**
51      * Search type descriptions corresponding to the search type values:
52      * {@link #AGGREGATION_TYPE_GROUP_BY}, {@link #AGGREGATION_TYPE_COUNT}, {@link #AGGREGATION_TYPE_COUNT_DISTINCT},
53      * {@link #AGGREGATION_TYPE_MIN}, and {@link #AGGREGATION_TYPE_MAX}
54      */

55     String JavaDoc[] AGGREGATION_TYPE_DESCRIPTIONS = new String JavaDoc[] {
56          null, // not specified
57
"group by", "count", "count distinct",
58          "min", "max"
59     };
60
61     /**
62      * Gets the aggregation type.
63      */

64     public int getAggregationType();
65
66     /**
67      * Compares this aggregated field to the specified object. The result is
68      * <code>true</code> if and only if the argument is a non-null
69      * <code>AggregatedField</code> object associated with the same field,
70      * using the same alias, and having the same aggregation type.
71      *
72      * @param obj The object to compare with.
73      * @return <code>true</code> if the objects are equal,
74      * <code>false</code> otherwise.
75      */

76     public boolean equals(Object JavaDoc obj);
77
78     /**
79      * Returns a string representation of this AggregatedField.
80      * The string representation has the form
81      * "AggregatedField(step:&lt;step&gt;, fieldname:&lt;fieldname&gt;,
82      * alias:&lt;alias&gt;, aggregationtype:&lt;aggregationtype&gt;)"
83      * where
84      * <ul>
85      * <li><em>&lt;step&gt;</em> is the step alias returned by
86      * <code>getStep().getAlias()</code> or,
87      * when the step alias is <code>null</code>, the step tablename
88      * returned by <code>getStep().getTableName()</code>.
89      * <li><em>&lt;fieldname&gt;</em> is the fieldname returned by
90      * {@link #getFieldName getFieldName()}
91      * <li><em>&lt;alias&gt;</em> is the alias returned by
92      * {@link #getAlias getAlias()}
93      * <li><em>&lt;aggregationtype&gt;</em> is the alias returned by
94      * {@link #getAggregationType getAggregationType()}
95      * </ul>
96      *
97      * @return A string representation of this AggregatedField.
98      */

99     public String JavaDoc toString();
100 }
Popular Tags