1
package org.apache.solr.client.solrj.response;
4
* Licensed to the Apache Software Foundation (ASF) under one or more
5
* contributor license agreements. See the NOTICE file distributed with
6
* this work for additional information regarding copyright ownership.
7
* The ASF licenses this file to You under the Apache License, Version 2.0
8
* (the "License"); you may not use this file except in compliance with
9
* the License. You may obtain a copy of the License at
11
* http://www.apache.org/licenses/LICENSE-2.0
13
* Unless required by applicable law or agreed to in writing, software
14
* distributed under the License is distributed on an "AS IS" BASIS,
15
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
* See the License for the specific language governing permissions and
17
* limitations under the License.
20
import java.util.ArrayList;
21
import java.util.List;
24
* Represents a range facet result
26
public abstract class RangeFacet<B, G> {
28
private final String name;
29
private final List<Count> counts = new ArrayList<Count>();
31
private final B start;
35
private final Number before;
36
private final Number after;
38
protected RangeFacet(String name, B start, B end, G gap, Number before, Number after) {
47
public void addCount(String value, int count) {
48
counts.add(new Count(value, count, this));
51
public String getName() {
55
public List<Count> getCounts() {
71
public Number getBefore() {
75
public Number getAfter() {
79
public static class Numeric extends RangeFacet<Number, Number> {
81
public Numeric(String name, Number start, Number end, Number gap, Number before, Number after) {
82
super(name, start, end, gap, before, after);
87
public static class Date extends RangeFacet<java.util.Date, String> {
89
public Date(String name, java.util.Date start, java.util.Date end, String gap, Number before, Number after) {
90
super(name, start, end, gap, before, after);
95
public static class Count {
97
private final String value;
98
private final int count;
99
private final RangeFacet rangeFacet;
101
public Count(String value, int count, RangeFacet rangeFacet) {
104
this.rangeFacet = rangeFacet;
107
public String getValue() {
111
public int getCount() {
115
public RangeFacet getRangeFacet() {