Skip to content

Commit

Permalink
Merge pull request #23825 from vespa-engine/balder/minor-cleanup-whil…
Browse files Browse the repository at this point in the history
…e-reading-code

Minor cleanup while reading code.
  • Loading branch information
bratseth authored Aug 28, 2022
2 parents 9bd995f + c6e3b0b commit ee29a7a
Showing 1 changed file with 17 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public class AttributeFields extends Derived implements AttributesConfig.Produce

public enum FieldSet {ALL, FAST_ACCESS}

private Map<String, Attribute> attributes = new java.util.LinkedHashMap<>();
private Map<String, Attribute> importedAttributes = new java.util.LinkedHashMap<>();
private final Map<String, Attribute> attributes = new java.util.LinkedHashMap<>();
private final Map<String, Attribute> importedAttributes = new java.util.LinkedHashMap<>();

/** Whether this has any position attribute */
private boolean hasPosition = false;
Expand Down Expand Up @@ -156,7 +156,7 @@ private void deriveMapOfPrimitiveType(ImmutableSDField field) {
}

/** Returns a read only attribute iterator */
public Iterator attributeIterator() {
public Iterator<Attribute> attributeIterator() {
return attributes().iterator();
}

Expand Down Expand Up @@ -257,33 +257,24 @@ private AttributesConfig.Attribute.Builder getConfig(String attrName, Attribute
}

private static AttributesConfig.Attribute.Dictionary.Type.Enum convert(Dictionary.Type type) {
switch (type) {
case BTREE:
return AttributesConfig.Attribute.Dictionary.Type.BTREE;
case HASH:
return AttributesConfig.Attribute.Dictionary.Type.HASH;
case BTREE_AND_HASH:
return AttributesConfig.Attribute.Dictionary.Type.BTREE_AND_HASH;
}
return AttributesConfig.Attribute.Dictionary.Type.BTREE;
return switch (type) {
case BTREE: yield AttributesConfig.Attribute.Dictionary.Type.BTREE;
case HASH: yield AttributesConfig.Attribute.Dictionary.Type.HASH;
case BTREE_AND_HASH: yield AttributesConfig.Attribute.Dictionary.Type.BTREE_AND_HASH;

};
}
private static AttributesConfig.Attribute.Dictionary.Match.Enum convert(Case type) {
switch (type) {
case CASED:
return AttributesConfig.Attribute.Dictionary.Match.CASED;
case UNCASED:
return AttributesConfig.Attribute.Dictionary.Match.UNCASED;
}
return AttributesConfig.Attribute.Dictionary.Match.UNCASED;
return switch (type) {
case CASED: yield AttributesConfig.Attribute.Dictionary.Match.CASED;
case UNCASED: yield AttributesConfig.Attribute.Dictionary.Match.UNCASED;
};
}
private static AttributesConfig.Attribute.Match.Enum convertMatch(Case type) {
switch (type) {
case CASED:
return AttributesConfig.Attribute.Match.CASED;
case UNCASED:
return AttributesConfig.Attribute.Match.UNCASED;
}
return AttributesConfig.Attribute.Match.UNCASED;
return switch (type) {
case CASED: yield AttributesConfig.Attribute.Match.CASED;
case UNCASED: yield AttributesConfig.Attribute.Match.UNCASED;
};
}

public void getConfig(AttributesConfig.Builder builder, FieldSet fs, long maxUnCommittedMemory, boolean enableBitVectors) {
Expand Down

0 comments on commit ee29a7a

Please sign in to comment.