use of org.locationtech.geowave.core.index.simple.SimpleLongIndexStrategy 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);
}
Aggregations