~ubuntu-branches/ubuntu/trusty/ehcache/trusty

« back to all changes in this revision

Viewing changes to src/main/java/net/sf/ehcache/search/impl/GroupedResultImpl.java

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg
  • Date: 2013-05-06 14:53:07 UTC
  • mfrom: (1.1.7) (2.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20130506145307-v5bhw5yu70re00l3
Tags: 2.6.7-1
* Team upload.
* New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 *  Copyright Terracotta, Inc.
 
3
 *
 
4
 *  Licensed under the Apache License, Version 2.0 (the "License");
 
5
 *  you may not use this file except in compliance with the License.
 
6
 *  You may obtain a copy of the License at
 
7
 *
 
8
 *      http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
10
 *  Unless required by applicable law or agreed to in writing, software
 
11
 *  distributed under the License is distributed on an "AS IS" BASIS,
 
12
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 *  See the License for the specific language governing permissions and
 
14
 *  limitations under the License.
 
15
 */
 
16
 
 
17
package net.sf.ehcache.search.impl;
 
18
 
 
19
import java.util.List;
 
20
import java.util.Map;
 
21
 
 
22
import net.sf.ehcache.store.StoreQuery;
 
23
 
 
24
/**
 
25
 * Representation of single result row from group-by queries
 
26
 * @author vfunshte
 
27
 *
 
28
 */
 
29
public class GroupedResultImpl extends BaseResult {
 
30
    private final Map<String, Object> attributes;
 
31
    private final Object[] sortAttributes;
 
32
    private final Map<String, Object> groupByValues;
 
33
 
 
34
    /**
 
35
     * Constructor
 
36
     *
 
37
     * @param query
 
38
     * @param attributes
 
39
     * @param sortAttributes
 
40
     * @param aggregatorResults
 
41
     * @param groupBy
 
42
     */
 
43
    public GroupedResultImpl(StoreQuery query, Map<String, Object> attributes, Object[] sortAttributes,
 
44
            List<Object> aggregatorResults, Map<String, Object> groupBy) {
 
45
        super(query);
 
46
        this.attributes = attributes;
 
47
        this.sortAttributes = sortAttributes;
 
48
        this.groupByValues = groupBy;
 
49
        setAggregateResults(aggregatorResults);
 
50
    }
 
51
 
 
52
    @Override
 
53
    protected Object basicGetKey() {
 
54
        throw new AssertionError("Not supported");
 
55
    }
 
56
 
 
57
    @Override
 
58
    protected Object basicGetValue() {
 
59
        throw new AssertionError("Not supported");
 
60
    }
 
61
 
 
62
    @Override
 
63
    protected Object basicGetAttribute(String name) {
 
64
        return attributes.get(name);
 
65
    }
 
66
 
 
67
    @Override
 
68
    Object getSortAttribute(int pos) {
 
69
        return sortAttributes[pos];
 
70
    }
 
71
 
 
72
    /**
 
73
     * {@inheritDoc}
 
74
     */
 
75
    public Map<String, Object> getGroupByValues() {
 
76
        return groupByValues;
 
77
    }
 
78
}