Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query constraints using ordered dimensions #1549

Merged
merged 4 commits into from
May 2, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
minor tweak
  • Loading branch information
rfecher committed May 1, 2019
commit 2ba4a0875d41e6c68903bf1fbc5e44bfaa662f5b
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,17 @@ public FeatureAttributeDimensionField() {
super();
}

public FeatureAttributeDimensionField(final AttributeDescriptor attributeDescriptor) {
this(attributeDescriptor, null);
attributeName = attributeDescriptor.getLocalName();
}

public FeatureAttributeDimensionField(
final AttributeDescriptor attributeDescriptor,
final Range<Double> range) {
super(new BasicDimensionDefinition(range.getMinimum(), range.getMaximum()));
super(
range == null ? null
: new BasicDimensionDefinition(range.getMinimum(), range.getMaximum()));
writer =
new FeatureAttributeWriterWrapper(
(FieldWriter) FieldUtils.getDefaultWriterForClass(
Expand Down Expand Up @@ -60,7 +67,12 @@ public FieldReader<FeatureAttributeCommonIndexValue> getReader() {

@Override
public byte[] toBinary() {
final byte[] bytes = baseDefinition.toBinary();
final byte[] bytes;
if (baseDefinition != null) {
bytes = baseDefinition.toBinary();
} else {
bytes = new byte[0];
}
final byte[] strBytes = StringUtils.stringToBinary(attributeName);
final ByteBuffer buf =
ByteBuffer.allocate(
Expand All @@ -80,9 +92,13 @@ public void fromBinary(final byte[] bytes) {
attributeName = StringUtils.stringFromBinary(strBytes);
final byte[] rest =
new byte[bytes.length - VarintUtils.unsignedIntByteLength(attrNameLength) - attrNameLength];
buf.get(rest);
baseDefinition = new BasicDimensionDefinition();
baseDefinition.fromBinary(rest);
if (rest.length > 0) {
buf.get(rest);
baseDefinition = new BasicDimensionDefinition();
baseDefinition.fromBinary(rest);
} else {
baseDefinition = null;
}
}

private static class FeatureAttributeReaderWrapper implements
Expand Down