aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-11-10 11:36:05 +0100
committerJon Bratseth <bratseth@yahoo-inc.com>2016-11-10 11:36:05 +0100
commitf3db734a21415175b7e4b1d0051a5b36b70cd316 (patch)
treef12e74f3af423aa7e45ff3ff483d507469225568
parent6b9522fdf674342f707a8723ffb554b0dc01ac62 (diff)
Order field operations
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java13
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/AliasOperation.java4
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/AttributeOperation.java8
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/FieldOperation.java16
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/FieldOperationContainer.java14
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/StructFieldOperation.java14
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/SummaryToOperation.java4
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/WeightOperation.java4
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/WeightedSetOperation.java9
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/ValidateFieldTypes.java27
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/documentmodel/DocumentSummary.java11
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/documentmodel/SummaryField.java27
-rw-r--r--config-model/src/test/examples/weightedset-summaryto.sd15
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/WeightedSetSummaryToTestCase.java25
-rw-r--r--document/src/main/java/com/yahoo/document/DataType.java2
-rw-r--r--document/src/main/java/com/yahoo/document/WeightedSetDataType.java24
-rw-r--r--document/src/main/java/com/yahoo/document/datatypes/WeightedSet.java2
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Flavor.java7
18 files changed, 157 insertions, 69 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java
index b379abd63ec..f5d208d1b41 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java
@@ -52,8 +52,10 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer,
*/
private int literalBoost=-1;
- /** The weight of this field. This is a percentage,
- * so 100 is default to provide the identity transform. */
+ /**
+ * The weight of this field. This is a percentage,
+ * so 100 is default to provide the identity transform.
+ */
private int weight=100;
/**
@@ -353,10 +355,11 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer,
pendingOperations.add(op);
}
+ @Override
public void applyOperations(SDField field) {
- if (pendingOperations.isEmpty()) {
- return;
- }
+ if (pendingOperations.isEmpty()) return;
+
+ Collections.sort(pendingOperations);
ListIterator<FieldOperation> ops = pendingOperations.listIterator();
while (ops.hasNext()) {
FieldOperation op = ops.next();
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/AliasOperation.java b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/AliasOperation.java
index 60aeb3d50cc..d4fec0cee7f 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/AliasOperation.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/AliasOperation.java
@@ -4,9 +4,10 @@ package com.yahoo.searchdefinition.fieldoperation;
import com.yahoo.searchdefinition.document.SDField;
/**
- * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
+ * @author Einar M R Rosenvinge
*/
public class AliasOperation implements FieldOperation {
+
private String aliasedName;
private String alias;
@@ -37,4 +38,5 @@ public class AliasOperation implements FieldOperation {
}
field.getAliasToName().put(alias, aliasedName);
}
+
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/AttributeOperation.java b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/AttributeOperation.java
index 19ee857c627..b45967b67d5 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/AttributeOperation.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/AttributeOperation.java
@@ -8,9 +8,10 @@ import com.yahoo.tensor.TensorType;
import java.util.Optional;
/**
- * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
+ * @author Einar M R Rosenvinge
*/
public class AttributeOperation implements FieldOperation, FieldOperationContainer {
+
private final String name;
private Boolean huge;
private Boolean fastSearch;
@@ -28,16 +29,18 @@ public class AttributeOperation implements FieldOperation, FieldOperationContain
this.name = name;
}
+ @Override
public void addOperation(FieldOperation op) {
//TODO: Implement this method:
}
+ @Override
public void applyOperations(SDField field) {
//TODO: Implement this method:
-
}
+ @Override
public String getName() {
return name;
}
@@ -150,4 +153,5 @@ public class AttributeOperation implements FieldOperation, FieldOperationContain
attribute.setTensorType(tensorType.get());
}
}
+
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/FieldOperation.java b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/FieldOperation.java
index 20caf0b13c7..3b28f380b2d 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/FieldOperation.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/FieldOperation.java
@@ -4,8 +4,18 @@ package com.yahoo.searchdefinition.fieldoperation;
import com.yahoo.searchdefinition.document.SDField;
/**
- * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
+ * An operation on a field.
+ * Operations has a natural order of execution.
+ *
+ * @author Einar M R Rosenvinge
*/
-public interface FieldOperation {
- public void apply(SDField field);
+public interface FieldOperation extends Comparable<FieldOperation> {
+
+ void apply(SDField field);
+
+ @Override
+ default int compareTo(FieldOperation other) {
+ return 0; // no order by default
+ }
+
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/FieldOperationContainer.java b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/FieldOperationContainer.java
index 30d16e369b1..1730f3380d7 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/FieldOperationContainer.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/FieldOperationContainer.java
@@ -4,10 +4,16 @@ package com.yahoo.searchdefinition.fieldoperation;
import com.yahoo.searchdefinition.document.SDField;
/**
- * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
+ * @author Einar M R Rosenvinge
*/
public interface FieldOperationContainer {
- public void addOperation(FieldOperation op);
- public void applyOperations(SDField field);
- public String getName();
+
+ /** Adds an operation */
+ void addOperation(FieldOperation op);
+
+ /** Apply all operations. Operations must be sorted in thjeir natural order before applying each operation. */
+ void applyOperations(SDField field);
+
+ String getName();
+
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/StructFieldOperation.java b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/StructFieldOperation.java
index f0c3d964934..02b28fe64f8 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/StructFieldOperation.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/StructFieldOperation.java
@@ -3,14 +3,16 @@ package com.yahoo.searchdefinition.fieldoperation;
import com.yahoo.searchdefinition.document.SDField;
+import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
/**
- * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
+ * @author Einar M R Rosenvinge
*/
public class StructFieldOperation implements FieldOperation, FieldOperationContainer {
+
private String structFieldName;
private List<FieldOperation> pendingOperations = new LinkedList<>();
@@ -28,14 +30,16 @@ public class StructFieldOperation implements FieldOperation, FieldOperationConta
applyOperations(structField);
}
+ @Override
public void addOperation(FieldOperation op) {
pendingOperations.add(op);
}
+ @Override
public void applyOperations(SDField field) {
- if (pendingOperations.isEmpty()) {
- return;
- }
+ if (pendingOperations.isEmpty()) return;
+
+ Collections.sort(pendingOperations);
ListIterator<FieldOperation> ops = pendingOperations.listIterator();
while (ops.hasNext()) {
FieldOperation op = ops.next();
@@ -44,7 +48,9 @@ public class StructFieldOperation implements FieldOperation, FieldOperationConta
}
}
+ @Override
public String getName() {
return structFieldName;
}
+
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/SummaryToOperation.java b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/SummaryToOperation.java
index f392b2fdcc8..9491d7b2ab7 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/SummaryToOperation.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/SummaryToOperation.java
@@ -7,9 +7,10 @@ import com.yahoo.vespa.documentmodel.SummaryField;
import java.util.Set;
/**
- * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
+ * @author Einar M R Rosenvinge
*/
public class SummaryToOperation implements FieldOperation {
+
private Set<String> destinations = new java.util.LinkedHashSet<>();
private String name;
@@ -36,4 +37,5 @@ public class SummaryToOperation implements FieldOperation {
summary.addDestination(destination);
}
}
+
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/WeightOperation.java b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/WeightOperation.java
index 3cbd557b850..79541e8901e 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/WeightOperation.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/WeightOperation.java
@@ -4,9 +4,10 @@ package com.yahoo.searchdefinition.fieldoperation;
import com.yahoo.searchdefinition.document.SDField;
/**
- * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
+ * @author Einar M R Rosenvinge
*/
public class WeightOperation implements FieldOperation {
+
private int weight;
public int getWeight() {
@@ -20,4 +21,5 @@ public class WeightOperation implements FieldOperation {
public void apply(SDField field) {
field.setWeight(weight);
}
+
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/WeightedSetOperation.java b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/WeightedSetOperation.java
index c1721a4dbb5..e16cc0a6a9d 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/WeightedSetOperation.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/WeightedSetOperation.java
@@ -7,7 +7,7 @@ import com.yahoo.searchdefinition.document.SDField;
import com.yahoo.document.WeightedSetDataType;
/**
- * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
+ * @author Einar M R Rosenvinge
*/
public class WeightedSetOperation implements FieldOperation {
@@ -53,6 +53,13 @@ public class WeightedSetOperation implements FieldOperation {
}
@Override
+ public int compareTo(FieldOperation other) {
+ // this operation should be executed first because it modifies the type of weighted sets, and other
+ // operation depends on the type of the weighted set
+ return -1;
+ }
+
+ @Override
public String toString() {
return "WeightedSetOperation{" +
"createIfNonExistent=" + createIfNonExistent +
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/ValidateFieldTypes.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/ValidateFieldTypes.java
index 38c7338be3c..1349abc3795 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/ValidateFieldTypes.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/ValidateFieldTypes.java
@@ -19,7 +19,7 @@ import java.util.Map;
* explicitly disregards whether a field is an index field, an attribute or a summary field. This is a requirement if we
* hope to move to a model where index fields, attributes and summary fields share a common field class.
*
- * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a>
+ * @author Simon Thoresen
*/
public class ValidateFieldTypes extends Processor {
@@ -30,33 +30,34 @@ public class ValidateFieldTypes extends Processor {
@Override
public void process() {
String searchName = search.getName();
- Map<String, DataType> fieldTypes = new HashMap<>();
+ Map<String, DataType> seenFields = new HashMap<>();
for (SDField field : search.allFieldsList()) {
- checkFieldType(searchName, "index field", field.getName(), field.getDataType(), fieldTypes);
+ checkFieldType(searchName, "index field", field.getName(), field.getDataType(), seenFields);
for (Map.Entry<String, Attribute> entry : field.getAttributes().entrySet()) {
- checkFieldType(searchName, "attribute", entry.getKey(), entry.getValue().getDataType(), fieldTypes);
+ checkFieldType(searchName, "attribute", entry.getKey(), entry.getValue().getDataType(), seenFields);
}
}
for (DocumentSummary summary : search.getSummaries().values()) {
for (SummaryField field : summary.getSummaryFields()) {
- checkFieldType(searchName, "summary field", field.getName(), field.getDataType(), fieldTypes);
+ checkFieldType(searchName, "summary field", field.getName(), field.getDataType(), seenFields);
}
}
}
private void checkFieldType(String searchName, String fieldDesc, String fieldName, DataType fieldType,
- Map<String, DataType> fieldTypes)
- {
- DataType prevType = fieldTypes.get(fieldName);
- if (prevType == null) {
- fieldTypes.put(fieldName, fieldType);
- } else if (!equalTypes(prevType, fieldType)) {
- throw newProcessException(searchName, fieldName, "Duplicate field name with different types. Expected " + prevType.getName() + " for " + fieldDesc +
+ Map<String, DataType> seenFields) {
+ DataType seenType = seenFields.get(fieldName);
+ if (seenType == null) {
+ seenFields.put(fieldName, fieldType);
+ } else if ( ! equalTypes(seenType, fieldType)) {
+ throw newProcessException(searchName, fieldName, "Duplicate field name with different types. Expected " +
+ seenType.getName() + " for " + fieldDesc +
" '" + fieldName + "', got " + fieldType.getName() + ".");
}
}
-
+
private boolean equalTypes(DataType d1, DataType d2) {
+ // legacy tag field type compatibility; probably not needed any more (Oct 2016)
if ("tag".equals(d1.getName())) {
return "tag".equals(d2.getName()) || "WeightedSet<string>".equals(d2.getName());
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/documentmodel/DocumentSummary.java b/config-model/src/main/java/com/yahoo/vespa/documentmodel/DocumentSummary.java
index b959855b080..769f3e5b95e 100644
--- a/config-model/src/main/java/com/yahoo/vespa/documentmodel/DocumentSummary.java
+++ b/config-model/src/main/java/com/yahoo/vespa/documentmodel/DocumentSummary.java
@@ -11,23 +11,24 @@ import java.util.List;
/**
* A document summary definition - a list of summary fields.
*
- * @author bratseth
+ * @author bratseth
*/
public class DocumentSummary extends FieldView {
-
/**
- * Will create a DocumentSummary with the given name.
+ * Creates a DocumentSummary with the given name.
+ *
* @param name The name to use for this summary.
*/
public DocumentSummary(String name) {
super(name);
}
- /**
+ /**
* The model is constrained to ensure that summary fields of the same name
* in different classes have the same summary transform, because this is
* what is supported by the backend currently.
+ *
* @param summaryField The summaryfield to add
*/
public void add(SummaryField summaryField) {
@@ -51,7 +52,7 @@ public class DocumentSummary extends FieldView {
* Removes implicit fields which shouldn't be included.
* This is implicitly added fields which are sources for
* other fields. We then assume they are not intended to be added
- * implicitly in additon.
+ * implicitly in addition.
* This should be called when this summary is complete.
*/
public void purgeImplicits() {
diff --git a/config-model/src/main/java/com/yahoo/vespa/documentmodel/SummaryField.java b/config-model/src/main/java/com/yahoo/vespa/documentmodel/SummaryField.java
index f6db82785b0..cb5f5d0a1ed 100644
--- a/config-model/src/main/java/com/yahoo/vespa/documentmodel/SummaryField.java
+++ b/config-model/src/main/java/com/yahoo/vespa/documentmodel/SummaryField.java
@@ -21,7 +21,7 @@ public class SummaryField extends Field implements Cloneable, TypedKey {
* This class represents a source (field name) and the type of the source (only used for smart summary)
*/
public static class Source implements Serializable {
- public static enum Type {
+ public enum Type {
CONTEXTUAL("contextual"),
TITLE("title"),
STATIC("static"),
@@ -110,20 +110,20 @@ public class SummaryField extends Field implements Cloneable, TypedKey {
/** Creates a summary field with NONE as transform */
public SummaryField(String name, DataType type) {
- this(name,type,SummaryTransform.NONE);
+ this(name,type, SummaryTransform.NONE);
}
/** Creates a summary field with NONE as transform */
public SummaryField(Field field) {
- this(field,SummaryTransform.NONE);
+ this(field, SummaryTransform.NONE);
}
- public SummaryField(Field field,SummaryTransform transform) {
+ public SummaryField(Field field, SummaryTransform transform) {
this(field.getName(), field.getDataType(), transform);
}
- public SummaryField(String name,DataType type,SummaryTransform transform) {
+ public SummaryField(String name, DataType type, SummaryTransform transform) {
super(name, type);
this.transform=transform;
}
@@ -198,7 +198,7 @@ public class SummaryField extends Field implements Cloneable, TypedKey {
}
private String toString(Collection<?> collection) {
- StringBuffer buffer=new StringBuffer();
+ StringBuilder buffer=new StringBuilder();
for (Iterator<?> i=collection.iterator(); i.hasNext(); ) {
buffer.append(i.next().toString());
if (i.hasNext())
@@ -221,16 +221,13 @@ public class SummaryField extends Field implements Cloneable, TypedKey {
if (merge.isImplicit()) return this;
if (!merge.getName().equals(getName()))
- throw new IllegalArgumentException(merge + " conflicts with " + this +
- ": different names");
+ throw new IllegalArgumentException(merge + " conflicts with " + this + ": different names");
if (!merge.getTransform().equals(getTransform()))
- throw new IllegalArgumentException(merge + " conflicts with " + this +
- ": different transforms");
+ throw new IllegalArgumentException(merge + " conflicts with " + this + ": different transforms");
if (!merge.getDataType().equals(getDataType()))
- throw new IllegalArgumentException(merge + " conflicts with " + this +
- ": different types");
+ throw new IllegalArgumentException(merge + " conflicts with " + this + ": different types");
if (!merge.isImplicit())
setImplicit(false);
@@ -243,7 +240,7 @@ public class SummaryField extends Field implements Cloneable, TypedKey {
}
else {
throw new IllegalArgumentException(merge + " conflicts with " + this +
- ": on source list must be the start of the other");
+ ": on source list must be the start of the other");
}
destinations.addAll(merge.destinations);
@@ -291,7 +288,7 @@ public class SummaryField extends Field implements Cloneable, TypedKey {
"', to '" + toString(destinations) + "']";
}
- /** returns a string which aids locating this field in the source search definition */
+ /** Returns a string which aids locating this field in the source search definition */
public String toLocateString() {
return "'summary " + getName() + " type " + toLowerCase(getDataType().getName()) + "' in '" + getDestinationString() + "'";
}
@@ -330,6 +327,7 @@ public class SummaryField extends Field implements Cloneable, TypedKey {
/**
* The command used when using data from this SummaryField to generate StreamingSummary config (vsmsummary).
* Not used for ordinary Summary config.
+ *
* @author vegardh
*
*/
@@ -347,4 +345,5 @@ public class SummaryField extends Field implements Cloneable, TypedKey {
return cmd;
}
}
+
}
diff --git a/config-model/src/test/examples/weightedset-summaryto.sd b/config-model/src/test/examples/weightedset-summaryto.sd
new file mode 100644
index 00000000000..b72d674e743
--- /dev/null
+++ b/config-model/src/test/examples/weightedset-summaryto.sd
@@ -0,0 +1,15 @@
+search test {
+
+ document test {
+
+ field w type weightedset<string> {
+ summary-to: mysummary
+ weightedset {
+ create-if-nonexistent
+ }
+
+ }
+
+ }
+
+} \ No newline at end of file
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/WeightedSetSummaryToTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/WeightedSetSummaryToTestCase.java
new file mode 100644
index 00000000000..770d11ff18e
--- /dev/null
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/WeightedSetSummaryToTestCase.java
@@ -0,0 +1,25 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.searchdefinition.processing;
+
+import com.yahoo.searchdefinition.Search;
+import com.yahoo.searchdefinition.SearchBuilder;
+import com.yahoo.searchdefinition.SearchDefinitionTestCase;
+import com.yahoo.searchdefinition.parser.ParseException;
+import com.yahoo.vespa.documentmodel.DocumentSummary;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+/** @author bratseth */
+public class WeightedSetSummaryToTestCase extends SearchDefinitionTestCase {
+
+ @Test
+ public void testRequireThatImplicitFieldsAreCreated() throws IOException, ParseException {
+ Search search = SearchBuilder.buildFromFile("src/test/examples/weightedset-summaryto.sd");
+ assertNotNull(search);
+ }
+
+}
diff --git a/document/src/main/java/com/yahoo/document/DataType.java b/document/src/main/java/com/yahoo/document/DataType.java
index 6e6103c61fd..51af799efd9 100644
--- a/document/src/main/java/com/yahoo/document/DataType.java
+++ b/document/src/main/java/com/yahoo/document/DataType.java
@@ -211,7 +211,7 @@ public abstract class DataType extends Identifiable implements Serializable, Com
return new WeightedSetDataType(type, createIfNonExistent, removeIfZero);
}
- public java.lang.String getName() {
+ public String getName() {
return name;
}
diff --git a/document/src/main/java/com/yahoo/document/WeightedSetDataType.java b/document/src/main/java/com/yahoo/document/WeightedSetDataType.java
index 9674d39fea8..0b51fc6a119 100644
--- a/document/src/main/java/com/yahoo/document/WeightedSetDataType.java
+++ b/document/src/main/java/com/yahoo/document/WeightedSetDataType.java
@@ -6,13 +6,14 @@ import com.yahoo.vespa.objects.Ids;
import com.yahoo.vespa.objects.ObjectVisitor;
/**
- * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
+ * @author Einar M R Rosenvinge
*/
public class WeightedSetDataType extends CollectionDataType {
+
// The global class identifier shared with C++.
public static int classId = registerClass(Ids.document + 55, WeightedSetDataType.class);
- /** Should an arith operation to a non-existant member of a weightedset cause the member to be created */
+ /** Should an operation to a non-existent member of a weightedset cause the member to be created */
private boolean createIfNonExistent = false;
/** Should a member of a weightedset with weight 0 be removed */
@@ -23,7 +24,7 @@ public class WeightedSetDataType extends CollectionDataType {
public WeightedSetDataType(DataType nestedType, boolean createIfNonExistent, boolean removeIfZero) {
this(nestedType, createIfNonExistent, removeIfZero, 0);
- if ((nestedType == STRING) && createIfNonExistent && removeIfZero) {
+ if ((nestedType == STRING) && createIfNonExistent && removeIfZero) { // the tag type definition
setId(18);
} else {
setId(getName().toLowerCase().hashCode());
@@ -51,7 +52,8 @@ public class WeightedSetDataType extends CollectionDataType {
/**
* Called by SD parser if a data type is explicitly tag.
- * @param tag True if this is a tag set.
+ *
+ * @param tag true if this is a tag set.
*/
public void setTag(boolean tag) {
this.tag = tag;
@@ -59,18 +61,19 @@ public class WeightedSetDataType extends CollectionDataType {
/**
* Returns whether or not this is a <em>tag</em> type weighted set.
- * @return True if this is a tag set.
+ *
+ * @return true if this is a tag set.
*/
public boolean isTag() {
return tag;
}
- static private String createName(DataType nested, boolean createIfNonExistant, boolean removeIfZero) {
- if (nested == DataType.STRING && createIfNonExistant && removeIfZero) {
+ static private String createName(DataType nested, boolean createIfNonExistent, boolean removeIfZero) {
+ if (nested == DataType.STRING && createIfNonExistent && removeIfZero) {
return "tag";
} else {
String name = "WeightedSet<" + nested.getName() + ">";
- if (createIfNonExistant) name += ";Add";
+ if (createIfNonExistent) name += ";Add";
if (removeIfZero) name += ";Remove";
return name;
}
@@ -103,6 +106,7 @@ public class WeightedSetDataType extends CollectionDataType {
public boolean removeIfZero() {
return removeIfZero;
}
+
@Override
public void visitMembers(ObjectVisitor visitor) {
super.visitMembers(visitor);
@@ -111,8 +115,8 @@ public class WeightedSetDataType extends CollectionDataType {
}
@Override
- public FieldPath buildFieldPath(String remainFieldName)
- {
+ public FieldPath buildFieldPath(String remainFieldName) {
return MapDataType.buildFieldPath(remainFieldName, getNestedType(), DataType.INT);
}
+
}
diff --git a/document/src/main/java/com/yahoo/document/datatypes/WeightedSet.java b/document/src/main/java/com/yahoo/document/datatypes/WeightedSet.java
index 5e56f247a7f..96f9932f4a5 100644
--- a/document/src/main/java/com/yahoo/document/datatypes/WeightedSet.java
+++ b/document/src/main/java/com/yahoo/document/datatypes/WeightedSet.java
@@ -15,7 +15,7 @@ import java.util.*;
* uses an encapsulated Map (actually a LinkedHashMap) that associates each key
* with its weight (value).
*
- * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
+ * @author Einar M R Rosenvinge
*/
public final class WeightedSet<K extends FieldValue> extends CollectionFieldValue<K> implements Map<K, Integer> {
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Flavor.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Flavor.java
index 1039beea7c0..8f870687fd2 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Flavor.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Flavor.java
@@ -47,7 +47,8 @@ public class Flavor {
/**
* Get the monthly cost (total cost of ownership) in USD for this flavor, typically total cost
* divided by 36 months.
- * @return Monthly cost in USD
+ *
+ * @return monthly cost in USD
*/
public int cost() { return cost; }
@@ -65,7 +66,7 @@ public class Flavor {
/**
* Returns the canonical name of this flavor - which is the name which should be used as an interface to users.
- * The canonical name of this flavor is
+ * The canonical name of this flavor is:
* <ul>
* <li>If it replaces one flavor, the canonical name of the flavor it replaces
* <li>If it replaces multiple or no flavors - itself
@@ -122,7 +123,7 @@ public class Flavor {
public String toString() { return "flavor '" + name + "'"; }
public enum Type {
- undefined, // Deafult value in config (node-repository.def)
+ undefined, // Default value in config (node-repository.def)
BARE_METAL,
VIRTUAL_MACHINE,
DOCKER_CONTAINER