SOLR-1131: formatting - indent inner class

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@893771 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2009-12-24 15:14:26 +00:00
parent 05237cf80f
commit 78c7dc3dbe

View File

@ -166,111 +166,111 @@ public class PointType extends CoordinateFieldType {
}
class PointTypeValueSource extends MultiValueSource {
protected SchemaField field;
protected FieldType subType;
protected int dimension;
private QParser parser;
protected SchemaField field;
protected FieldType subType;
protected int dimension;
private QParser parser;
public PointTypeValueSource(SchemaField field, int dimension, FieldType subType, QParser parser) {
this.field = field;
this.dimension = dimension;
this.subType = subType;
this.parser = parser;
}
@Override
public void createWeight(Map context, Searcher searcher) throws IOException {
String name = field.getName();
String suffix = FieldType.POLY_FIELD_SEPARATOR + subType.typeName;
int len = name.length();
StringBuilder bldr = new StringBuilder(len + 3 + suffix.length());//should be enough buffer to handle most values of j.
bldr.append(name);
for (int i = 0; i < dimension; i++) {
bldr.append(i).append(suffix);
SchemaField sf = schema.getField(bldr.toString());
subType.getValueSource(sf, parser).createWeight(context, searcher);
bldr.setLength(len);
public PointTypeValueSource(SchemaField field, int dimension, FieldType subType, QParser parser) {
this.field = field;
this.dimension = dimension;
this.subType = subType;
this.parser = parser;
}
}
public int dimension() {
return dimension;
}
@Override
public DocValues getValues(Map context, IndexReader reader) throws IOException {
final DocValues[] valsArr1 = new DocValues[dimension];
String name = field.getName();
String suffix = FieldType.POLY_FIELD_SEPARATOR + subType.typeName;
int len = name.length();
StringBuilder bldr = new StringBuilder(len + 3 + suffix.length());//should be enough buffer to handle most values of j.
bldr.append(name);
for (int i = 0; i < dimension; i++) {
bldr.append(i).append(suffix);
SchemaField sf = schema.getField(bldr.toString());
valsArr1[i] = subType.getValueSource(sf, parser).getValues(context, reader);
bldr.setLength(len);
}
return new DocValues() {
//TODO: not sure how to handle the other types at this moment
@Override
public void doubleVal(int doc, double[] vals) {
//TODO: check whether vals.length == dimension or assume its handled elsewhere?
for (int i = 0; i < dimension; i++) {
vals[i] = valsArr1[i].doubleVal(doc);
}
@Override
public void createWeight(Map context, Searcher searcher) throws IOException {
String name = field.getName();
String suffix = FieldType.POLY_FIELD_SEPARATOR + subType.typeName;
int len = name.length();
StringBuilder bldr = new StringBuilder(len + 3 + suffix.length());//should be enough buffer to handle most values of j.
bldr.append(name);
for (int i = 0; i < dimension; i++) {
bldr.append(i).append(suffix);
SchemaField sf = schema.getField(bldr.toString());
subType.getValueSource(sf, parser).createWeight(context, searcher);
bldr.setLength(len);
}
}
public int dimension() {
return dimension;
}
@Override
public String toString(int doc) {
StringBuilder sb = new StringBuilder("point(");
boolean firstTime = true;
for (DocValues docValues : valsArr1) {
if (firstTime == false) {
sb.append(",");
} else {
firstTime = true;
@Override
public DocValues getValues(Map context, IndexReader reader) throws IOException {
final DocValues[] valsArr1 = new DocValues[dimension];
String name = field.getName();
String suffix = FieldType.POLY_FIELD_SEPARATOR + subType.typeName;
int len = name.length();
StringBuilder bldr = new StringBuilder(len + 3 + suffix.length());//should be enough buffer to handle most values of j.
bldr.append(name);
for (int i = 0; i < dimension; i++) {
bldr.append(i).append(suffix);
SchemaField sf = schema.getField(bldr.toString());
valsArr1[i] = subType.getValueSource(sf, parser).getValues(context, reader);
bldr.setLength(len);
}
return new DocValues() {
//TODO: not sure how to handle the other types at this moment
@Override
public void doubleVal(int doc, double[] vals) {
//TODO: check whether vals.length == dimension or assume its handled elsewhere?
for (int i = 0; i < dimension; i++) {
vals[i] = valsArr1[i].doubleVal(doc);
}
sb.append(docValues.toString(doc));
}
sb.append(")");
return sb.toString();
}
};
@Override
public String toString(int doc) {
StringBuilder sb = new StringBuilder("point(");
boolean firstTime = true;
for (DocValues docValues : valsArr1) {
if (firstTime == false) {
sb.append(",");
} else {
firstTime = true;
}
sb.append(docValues.toString(doc));
}
sb.append(")");
return sb.toString();
}
};
}
public String description() {
StringBuilder sb = new StringBuilder();
sb.append("point(");
sb.append("fld=").append(field.name).append(", subType=").append(subType.typeName)
.append(", dimension=").append(dimension).append(')');
return sb.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof PointTypeValueSource)) return false;
PointTypeValueSource that = (PointTypeValueSource) o;
if (dimension != that.dimension) return false;
if (!field.equals(that.field)) return false;
if (!subType.equals(that.subType)) return false;
return true;
}
@Override
public int hashCode() {
int result = field.hashCode();
result = 31 * result + subType.hashCode();
result = 31 * result + dimension;
return result;
}
}
public String description() {
StringBuilder sb = new StringBuilder();
sb.append("point(");
sb.append("fld=").append(field.name).append(", subType=").append(subType.typeName)
.append(", dimension=").append(dimension).append(')');
return sb.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof PointTypeValueSource)) return false;
PointTypeValueSource that = (PointTypeValueSource) o;
if (dimension != that.dimension) return false;
if (!field.equals(that.field)) return false;
if (!subType.equals(that.subType)) return false;
return true;
}
@Override
public int hashCode() {
int result = field.hashCode();
result = 31 * result + subType.hashCode();
result = 31 * result + dimension;
return result;
}
}
}