Search in sources :

Example 1 with SimpleByteIndexStrategy

use of org.locationtech.geowave.core.index.simple.SimpleByteIndexStrategy in project geowave by locationtech.

the class NumericAttributeIndexProvider method buildIndex.

@Override
public AttributeIndex buildIndex(final String indexName, final DataTypeAdapter<?> adapter, final FieldDescriptor<?> fieldDescriptor) {
    final Class<?> bindingClass = fieldDescriptor.bindingClass();
    final String fieldName = fieldDescriptor.fieldName();
    final NumericIndexStrategy indexStrategy;
    final CommonIndexModel indexModel;
    if (Byte.class.isAssignableFrom(bindingClass)) {
        indexStrategy = new SimpleByteIndexStrategy();
        indexModel = new BasicIndexModel(new NumericDimensionField[] { new BasicNumericDimensionField<>(fieldName, Byte.class) });
    } else if (Short.class.isAssignableFrom(bindingClass)) {
        indexStrategy = new SimpleShortIndexStrategy();
        indexModel = new BasicIndexModel(new NumericDimensionField[] { new BasicNumericDimensionField<>(fieldName, Short.class) });
    } else if (Integer.class.isAssignableFrom(bindingClass)) {
        indexStrategy = new SimpleIntegerIndexStrategy();
        indexModel = new BasicIndexModel(new NumericDimensionField[] { new BasicNumericDimensionField<>(fieldName, Integer.class) });
    } else if (Long.class.isAssignableFrom(bindingClass)) {
        indexStrategy = new SimpleLongIndexStrategy();
        indexModel = new BasicIndexModel(new NumericDimensionField[] { new BasicNumericDimensionField<>(fieldName, Long.class) });
    } else if (Float.class.isAssignableFrom(bindingClass)) {
        indexStrategy = new SimpleFloatIndexStrategy();
        indexModel = new BasicIndexModel(new NumericDimensionField[] { new BasicNumericDimensionField<>(fieldName, Float.class) });
    } else if (Double.class.isAssignableFrom(bindingClass)) {
        indexStrategy = new SimpleDoubleIndexStrategy();
        indexModel = new BasicIndexModel(new NumericDimensionField[] { new BasicNumericDimensionField<>(fieldName, Double.class) });
    } else {
        throw new ParameterException("Unsupported numeric attribute index class: " + bindingClass.getName());
    }
    return new AttributeIndexImpl(indexStrategy, indexModel, indexName, fieldName);
}
Also used : BasicNumericDimensionField(org.locationtech.geowave.core.store.dimension.BasicNumericDimensionField) NumericDimensionField(org.locationtech.geowave.core.store.dimension.NumericDimensionField) BasicNumericDimensionField(org.locationtech.geowave.core.store.dimension.BasicNumericDimensionField) SimpleLongIndexStrategy(org.locationtech.geowave.core.index.simple.SimpleLongIndexStrategy) SimpleShortIndexStrategy(org.locationtech.geowave.core.index.simple.SimpleShortIndexStrategy) SimpleDoubleIndexStrategy(org.locationtech.geowave.core.index.simple.SimpleDoubleIndexStrategy) SimpleFloatIndexStrategy(org.locationtech.geowave.core.index.simple.SimpleFloatIndexStrategy) ParameterException(com.beust.jcommander.ParameterException) SimpleIntegerIndexStrategy(org.locationtech.geowave.core.index.simple.SimpleIntegerIndexStrategy) SimpleByteIndexStrategy(org.locationtech.geowave.core.index.simple.SimpleByteIndexStrategy) NumericIndexStrategy(org.locationtech.geowave.core.index.NumericIndexStrategy)

Aggregations

ParameterException (com.beust.jcommander.ParameterException)1 NumericIndexStrategy (org.locationtech.geowave.core.index.NumericIndexStrategy)1 SimpleByteIndexStrategy (org.locationtech.geowave.core.index.simple.SimpleByteIndexStrategy)1 SimpleDoubleIndexStrategy (org.locationtech.geowave.core.index.simple.SimpleDoubleIndexStrategy)1 SimpleFloatIndexStrategy (org.locationtech.geowave.core.index.simple.SimpleFloatIndexStrategy)1 SimpleIntegerIndexStrategy (org.locationtech.geowave.core.index.simple.SimpleIntegerIndexStrategy)1 SimpleLongIndexStrategy (org.locationtech.geowave.core.index.simple.SimpleLongIndexStrategy)1 SimpleShortIndexStrategy (org.locationtech.geowave.core.index.simple.SimpleShortIndexStrategy)1 BasicNumericDimensionField (org.locationtech.geowave.core.store.dimension.BasicNumericDimensionField)1 NumericDimensionField (org.locationtech.geowave.core.store.dimension.NumericDimensionField)1