org.apache.solr.analytics.util

## Class RangeEndpointCalculator<T extends Comparable<T>>

- java.lang.Object
- - org.apache.solr.analytics.util.RangeEndpointCalculator<T>

- Direct Known Subclasses:
    RangeEndpointCalculator.DateRangeEndpointCalculator, RangeEndpointCalculator.DoubleRangeEndpointCalculator, RangeEndpointCalculator.FloatRangeEndpointCalculator, RangeEndpointCalculator.IntegerRangeEndpointCalculator, RangeEndpointCalculator.LongRangeEndpointCalculator

      public abstract class RangeEndpointCalculator<T extends Comparable<T>>
      extends Object

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `RangeEndpointCalculator.DateRangeEndpointCalculator`
    `static class` | `RangeEndpointCalculator.DoubleRangeEndpointCalculator`
    `static class` | `RangeEndpointCalculator.FacetRange`
    `static class` | `RangeEndpointCalculator.FloatRangeEndpointCalculator`
    `static class` | `RangeEndpointCalculator.IntegerRangeEndpointCalculator`
    `static class` | `RangeEndpointCalculator.LongRangeEndpointCalculator`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected SchemaField` | `field`
    `protected RangeFacetRequest` | `request`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RangeEndpointCalculator(RangeFacetRequest request)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `T` | `addGap(T value, String gap)` Adds the String gap param to a low Range endpoint value to determine the corrisponding high Range endpoint value, throwing a useful exception if not possible.
    `static RangeEndpointCalculator<? extends Comparable<?>>` | `create(RangeFacetRequest request)`
    `String` | `formatValue(T val)` Formats a Range endpoint for use as a range label name in the response.
    `Object` | `getGap(String gap)` Parses a String param into a value that represents the gap and can be included in the response, throwing a useful exception if not possible.
    `List<RangeEndpointCalculator.FacetRange>` | `getRanges()`
    `T` | `getValue(String rawval)` Parses a String param into an Range endpoint value throwing a useful exception if not possible
    `protected abstract T` | `parseAndAddGap(T value, String gap)` Adds the String gap param to a low Range endpoint value to determine the corrisponding high Range endpoint value.
    `protected Object` | `parseGap(String rawval)` Parses a String param into a value that represents the gap and can be included in the response.
    `protected abstract T` | `parseVal(String rawval)` Parses a String param into an Range endpoint.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### field

          protected final SchemaField field

    - #### request

          protected final RangeFacetRequest request

  - ### Constructor Detail

    - #### RangeEndpointCalculator

          public RangeEndpointCalculator(RangeFacetRequest request)

  - ### Method Detail

    - #### formatValue

          public String formatValue(T val)

      Formats a Range endpoint for use as a range label name in the response. Default Impl just uses toString()

    - #### getValue

          public final T getValue(String rawval)

      Parses a String param into an Range endpoint value throwing a useful exception if not possible

    - #### parseVal

          protected abstract T parseVal(String rawval)
                                 throws ParseException

      Parses a String param into an Range endpoint. Can throw a low level format exception as needed.
      Throws:
        `ParseException`

    - #### getGap

          public final Object getGap(String gap)

      Parses a String param into a value that represents the gap and can be included in the response, throwing a useful exception if not possible. Note: uses Object as the return type instead of T for things like Date where gap is just a DateMathParser string

    - #### parseGap

          protected Object parseGap(String rawval)
                             throws ParseException

      Parses a String param into a value that represents the gap and can be included in the response. Can throw a low level format exception as needed. Default Impl calls parseVal
      Throws:
        `ParseException`

    - #### addGap

          public final T addGap(T value,
                                String gap)

      Adds the String gap param to a low Range endpoint value to determine the corrisponding high Range endpoint value, throwing a useful exception if not possible.

    - #### parseAndAddGap

          protected abstract T parseAndAddGap(T value,
                                              String gap)
                                       throws ParseException

      Adds the String gap param to a low Range endpoint value to determine the corrisponding high Range endpoint value. Can throw a low level format exception as needed.
      Throws:
        `ParseException`

    - #### getRanges

          public List<RangeEndpointCalculator.FacetRange> getRanges()

    - #### create

          public static RangeEndpointCalculator<? extends Comparable<?>> create(RangeFacetRequest request)

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.