make numeric namings consistent with bytes ones

also add the ability to get the ordinals from DoubleValues.WithOrdinals and LongValues.WithOrdinals
This commit is contained in:
Shay Banon 2013-04-05 13:33:56 +02:00
parent 36b92be212
commit bcc14cde9f
10 changed files with 95 additions and 112 deletions

View File

@ -67,10 +67,10 @@ public abstract class DoubleValues {
}
public static abstract class DenseDoubleValues extends DoubleValues {
public static abstract class Dense extends DoubleValues {
protected DenseDoubleValues(boolean multiValued) {
protected Dense(boolean multiValued) {
super(multiValued);
}
@ -93,17 +93,21 @@ public abstract class DoubleValues {
}
public static abstract class OrdBasedDoubleValues extends DoubleValues {
public static abstract class WithOrdinals extends DoubleValues {
protected final Docs ordinals;
private final Iter.Multi iter;
protected OrdBasedDoubleValues(Ordinals.Docs ordinals) {
protected WithOrdinals(Ordinals.Docs ordinals) {
super(ordinals.isMultiValued());
this.ordinals = ordinals;
iter = new Iter.Multi(this);
}
public Docs ordinals() {
return ordinals;
}
@Override
public final boolean hasValue(int docId) {
return ordinals.getOrd(docId) != 0;
@ -182,9 +186,9 @@ public abstract class DoubleValues {
private org.elasticsearch.index.fielddata.ordinals.Ordinals.Docs.Iter ordsIter;
private int ord;
private OrdBasedDoubleValues values;
private WithOrdinals values;
public Multi(OrdBasedDoubleValues values) {
public Multi(WithOrdinals values) {
this.values = values;
}
@ -231,11 +235,11 @@ public abstract class DoubleValues {
}
public static class FilteredDoubleValues extends DoubleValues {
public static class Filtered extends DoubleValues {
protected final DoubleValues delegate;
public FilteredDoubleValues(DoubleValues delegate) {
public Filtered(DoubleValues delegate) {
super(delegate.isMultiValued());
this.delegate = delegate;
}

View File

@ -67,10 +67,10 @@ public abstract class LongValues {
}
public static abstract class DenseLongValues extends LongValues {
public static abstract class Dense extends LongValues {
protected DenseLongValues(boolean multiValued) {
protected Dense(boolean multiValued) {
super(multiValued);
}
@ -93,17 +93,21 @@ public abstract class LongValues {
}
public static abstract class OrdBasedLongValues extends LongValues {
public static abstract class WithOrdinals extends LongValues {
protected final Docs ordinals;
private final Iter.Multi iter;
protected OrdBasedLongValues(Ordinals.Docs ordinals) {
protected WithOrdinals(Ordinals.Docs ordinals) {
super(ordinals.isMultiValued());
this.ordinals = ordinals;
iter = new Iter.Multi(this);
}
public Docs ordinals() {
return this.ordinals;
}
@Override
public final boolean hasValue(int docId) {
return ordinals.getOrd(docId) != 0;
@ -182,9 +186,9 @@ public abstract class LongValues {
private org.elasticsearch.index.fielddata.ordinals.Ordinals.Docs.Iter ordsIter;
private int ord;
private OrdBasedLongValues values;
private WithOrdinals values;
public Multi(OrdBasedLongValues values) {
public Multi(WithOrdinals values) {
this.values = values;
}
@ -231,11 +235,11 @@ public abstract class LongValues {
}
public static class FilteredLongValues extends LongValues {
public static class Filtered extends LongValues {
protected final LongValues delegate;
public FilteredLongValues(LongValues delegate) {
public Filtered(LongValues delegate) {
super(delegate.isMultiValued());
this.delegate = delegate;
}

View File

@ -71,7 +71,7 @@ abstract class DoubleValuesComparatorBase<T extends Number> extends NumberCompar
}
}
static final class MultiValueWrapper extends DoubleValues.FilteredDoubleValues {
static final class MultiValueWrapper extends DoubleValues.Filtered {
private final SortMode sortMode;

View File

@ -72,7 +72,7 @@ abstract class LongValuesComparatorBase<T extends Number> extends NumberComparat
return this;
}
private static final class MultiValueWrapper extends LongValues.FilteredLongValues {
private static final class MultiValueWrapper extends LongValues.Filtered {
private final SortMode sortMode;

View File

@ -21,11 +21,7 @@ package org.elasticsearch.index.fielddata.plain;
import org.apache.lucene.util.FixedBitSet;
import org.elasticsearch.common.RamUsage;
import org.elasticsearch.index.fielddata.AtomicNumericFieldData;
import org.elasticsearch.index.fielddata.BytesValues;
import org.elasticsearch.index.fielddata.DoubleValues;
import org.elasticsearch.index.fielddata.LongValues;
import org.elasticsearch.index.fielddata.ScriptDocValues;
import org.elasticsearch.index.fielddata.*;
import org.elasticsearch.index.fielddata.ordinals.Ordinals;
/**
@ -51,7 +47,6 @@ public abstract class ByteArrayAtomicFieldData extends AtomicNumericFieldData {
}
@Override
public void close() {
}
@ -135,7 +130,7 @@ public abstract class ByteArrayAtomicFieldData extends AtomicNumericFieldData {
return new DoubleValues(values, ordinals.ordinals());
}
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.OrdBasedLongValues {
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.WithOrdinals {
private final byte[] values;
@ -151,7 +146,7 @@ public abstract class ByteArrayAtomicFieldData extends AtomicNumericFieldData {
}
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.OrdBasedDoubleValues {
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.WithOrdinals {
private final byte[] values;
@ -299,7 +294,7 @@ public abstract class ByteArrayAtomicFieldData extends AtomicNumericFieldData {
}
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.DenseLongValues {
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.Dense {
private final byte[] values;
@ -316,7 +311,7 @@ public abstract class ByteArrayAtomicFieldData extends AtomicNumericFieldData {
}
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.DenseDoubleValues {
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.Dense {
private final byte[] values;

View File

@ -21,11 +21,7 @@ package org.elasticsearch.index.fielddata.plain;
import org.apache.lucene.util.FixedBitSet;
import org.elasticsearch.common.RamUsage;
import org.elasticsearch.index.fielddata.AtomicNumericFieldData;
import org.elasticsearch.index.fielddata.BytesValues;
import org.elasticsearch.index.fielddata.DoubleValues;
import org.elasticsearch.index.fielddata.LongValues;
import org.elasticsearch.index.fielddata.ScriptDocValues;
import org.elasticsearch.index.fielddata.*;
import org.elasticsearch.index.fielddata.ordinals.Ordinals;
/**
@ -135,7 +131,7 @@ public abstract class DoubleArrayAtomicFieldData extends AtomicNumericFieldData
}
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.OrdBasedLongValues {
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.WithOrdinals {
private final double[] values;
@ -146,11 +142,11 @@ public abstract class DoubleArrayAtomicFieldData extends AtomicNumericFieldData
@Override
protected final long getByOrd(int ord) {
return (long)values[ord];
return (long) values[ord];
}
}
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.OrdBasedDoubleValues {
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.WithOrdinals {
private final double[] values;
@ -294,7 +290,7 @@ public abstract class DoubleArrayAtomicFieldData extends AtomicNumericFieldData
return new DoubleValues(values);
}
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.DenseLongValues {
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.Dense {
private final double[] values;
@ -310,7 +306,7 @@ public abstract class DoubleArrayAtomicFieldData extends AtomicNumericFieldData
}
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.DenseDoubleValues {
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.Dense {
private final double[] values;

View File

@ -21,11 +21,7 @@ package org.elasticsearch.index.fielddata.plain;
import org.apache.lucene.util.FixedBitSet;
import org.elasticsearch.common.RamUsage;
import org.elasticsearch.index.fielddata.AtomicNumericFieldData;
import org.elasticsearch.index.fielddata.BytesValues;
import org.elasticsearch.index.fielddata.DoubleValues;
import org.elasticsearch.index.fielddata.LongValues;
import org.elasticsearch.index.fielddata.ScriptDocValues;
import org.elasticsearch.index.fielddata.*;
import org.elasticsearch.index.fielddata.ordinals.Ordinals;
/**
@ -133,7 +129,7 @@ public abstract class FloatArrayAtomicFieldData extends AtomicNumericFieldData {
return new DoubleValues(values, ordinals.ordinals());
}
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.OrdBasedLongValues {
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.WithOrdinals {
private final float[] values;
@ -148,7 +144,7 @@ public abstract class FloatArrayAtomicFieldData extends AtomicNumericFieldData {
}
}
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.OrdBasedDoubleValues {
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.WithOrdinals {
private final float[] values;
@ -295,7 +291,7 @@ public abstract class FloatArrayAtomicFieldData extends AtomicNumericFieldData {
}
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.DenseLongValues {
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.Dense {
private final float[] values;
@ -311,7 +307,7 @@ public abstract class FloatArrayAtomicFieldData extends AtomicNumericFieldData {
}
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.DenseDoubleValues {
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.Dense {
private final float[] values;

View File

@ -21,11 +21,7 @@ package org.elasticsearch.index.fielddata.plain;
import org.apache.lucene.util.FixedBitSet;
import org.elasticsearch.common.RamUsage;
import org.elasticsearch.index.fielddata.AtomicNumericFieldData;
import org.elasticsearch.index.fielddata.BytesValues;
import org.elasticsearch.index.fielddata.DoubleValues;
import org.elasticsearch.index.fielddata.LongValues;
import org.elasticsearch.index.fielddata.ScriptDocValues;
import org.elasticsearch.index.fielddata.*;
import org.elasticsearch.index.fielddata.ordinals.Ordinals;
/**
@ -133,7 +129,7 @@ public abstract class IntArrayAtomicFieldData extends AtomicNumericFieldData {
return new DoubleValues(values, ordinals.ordinals());
}
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.OrdBasedLongValues {
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.WithOrdinals {
private final int[] values;
@ -149,7 +145,7 @@ public abstract class IntArrayAtomicFieldData extends AtomicNumericFieldData {
}
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.OrdBasedDoubleValues{
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.WithOrdinals {
private final int[] values;
@ -294,7 +290,7 @@ public abstract class IntArrayAtomicFieldData extends AtomicNumericFieldData {
return new DoubleValues(values);
}
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.DenseLongValues {
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.Dense {
private final int[] values;
@ -311,7 +307,7 @@ public abstract class IntArrayAtomicFieldData extends AtomicNumericFieldData {
}
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.DenseDoubleValues {
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.Dense {
private final int[] values;

View File

@ -21,11 +21,7 @@ package org.elasticsearch.index.fielddata.plain;
import org.apache.lucene.util.FixedBitSet;
import org.elasticsearch.common.RamUsage;
import org.elasticsearch.index.fielddata.AtomicNumericFieldData;
import org.elasticsearch.index.fielddata.BytesValues;
import org.elasticsearch.index.fielddata.DoubleValues;
import org.elasticsearch.index.fielddata.LongValues;
import org.elasticsearch.index.fielddata.ScriptDocValues;
import org.elasticsearch.index.fielddata.*;
import org.elasticsearch.index.fielddata.ordinals.Ordinals;
/**
@ -133,7 +129,7 @@ public abstract class LongArrayAtomicFieldData extends AtomicNumericFieldData {
return new DoubleValues(values, ordinals.ordinals());
}
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.OrdBasedLongValues {
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.WithOrdinals {
private final long[] values;
@ -148,7 +144,7 @@ public abstract class LongArrayAtomicFieldData extends AtomicNumericFieldData {
}
}
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.OrdBasedDoubleValues {
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.WithOrdinals {
private final long[] values;
@ -294,7 +290,7 @@ public abstract class LongArrayAtomicFieldData extends AtomicNumericFieldData {
return new DoubleValues(values);
}
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.DenseLongValues {
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.Dense {
private final long[] values;
@ -310,7 +306,7 @@ public abstract class LongArrayAtomicFieldData extends AtomicNumericFieldData {
}
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.DenseDoubleValues {
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.Dense {
private final long[] values;

View File

@ -21,11 +21,7 @@ package org.elasticsearch.index.fielddata.plain;
import org.apache.lucene.util.FixedBitSet;
import org.elasticsearch.common.RamUsage;
import org.elasticsearch.index.fielddata.AtomicNumericFieldData;
import org.elasticsearch.index.fielddata.BytesValues;
import org.elasticsearch.index.fielddata.DoubleValues;
import org.elasticsearch.index.fielddata.LongValues;
import org.elasticsearch.index.fielddata.ScriptDocValues;
import org.elasticsearch.index.fielddata.*;
import org.elasticsearch.index.fielddata.ordinals.Ordinals;
/**
@ -133,7 +129,7 @@ public abstract class ShortArrayAtomicFieldData extends AtomicNumericFieldData {
return new DoubleValues(values, ordinals.ordinals());
}
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.OrdBasedLongValues {
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.WithOrdinals {
private final short[] values;
@ -149,7 +145,7 @@ public abstract class ShortArrayAtomicFieldData extends AtomicNumericFieldData {
}
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.OrdBasedDoubleValues {
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.WithOrdinals {
private final short[] values;
@ -293,7 +289,7 @@ public abstract class ShortArrayAtomicFieldData extends AtomicNumericFieldData {
return new DoubleValues(values);
}
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.DenseLongValues {
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.Dense {
private final short[] values;
@ -309,7 +305,7 @@ public abstract class ShortArrayAtomicFieldData extends AtomicNumericFieldData {
}
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.DenseDoubleValues {
static class DoubleValues extends org.elasticsearch.index.fielddata.DoubleValues.Dense {
private final short[] values;