aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/documentmodel
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2017-01-12 11:33:39 +0100
committerJon Bratseth <bratseth@yahoo-inc.com>2017-01-12 11:33:39 +0100
commitfd4b4f5bf5169430ce7394b46d7392f391ef1afc (patch)
treeb715f7113ca7f1c1f631bbf60ed887e53f1f31cf /config-model/src/main/java/com/yahoo/documentmodel
parent0e2f505ce41a5c277f74c6a0f7714c66ddd9a552 (diff)
Tensor type information in tensor document fields
Diffstat (limited to 'config-model/src/main/java/com/yahoo/documentmodel')
-rw-r--r--config-model/src/main/java/com/yahoo/documentmodel/DataTypeCollection.java8
-rw-r--r--config-model/src/main/java/com/yahoo/documentmodel/DataTypeRepo.java8
-rw-r--r--config-model/src/main/java/com/yahoo/documentmodel/DocumentTypeRepo.java2
-rw-r--r--config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java5
4 files changed, 11 insertions, 12 deletions
diff --git a/config-model/src/main/java/com/yahoo/documentmodel/DataTypeCollection.java b/config-model/src/main/java/com/yahoo/documentmodel/DataTypeCollection.java
index 9c507d7be05..ff1a582d7fa 100644
--- a/config-model/src/main/java/com/yahoo/documentmodel/DataTypeCollection.java
+++ b/config-model/src/main/java/com/yahoo/documentmodel/DataTypeCollection.java
@@ -9,7 +9,9 @@ import java.util.Collection;
* @author baldersheim
*/
public interface DataTypeCollection {
- public DataType getDataType(String name);
- public DataType getDataType(int id);
- public Collection<DataType> getTypes();
+
+ DataType getDataType(String name);
+ DataType getDataType(int id);
+ Collection<DataType> getTypes();
+
}
diff --git a/config-model/src/main/java/com/yahoo/documentmodel/DataTypeRepo.java b/config-model/src/main/java/com/yahoo/documentmodel/DataTypeRepo.java
index 73f8d7f91c5..2c527201ce4 100644
--- a/config-model/src/main/java/com/yahoo/documentmodel/DataTypeRepo.java
+++ b/config-model/src/main/java/com/yahoo/documentmodel/DataTypeRepo.java
@@ -11,6 +11,7 @@ import java.util.Map;
* @author baldersheim
*/
public class DataTypeRepo implements DataTypeCollection {
+
Map<Integer, DataType> typeById = new LinkedHashMap<>();
Map<String, DataType> typeByName = new LinkedHashMap<>();
@@ -25,10 +26,9 @@ public class DataTypeRepo implements DataTypeCollection {
public Collection<DataType> getTypes() { return typeById.values(); }
public DataTypeRepo add(DataType type) {
- if (typeByName.containsKey(type.getName()) ||
- typeById.containsKey(type.getId()))
- {
- throw new IllegalStateException("Data type '" + type.getName() + "', id '" + type.getId() + "' is already registered.");
+ if (typeByName.containsKey(type.getName()) || typeById.containsKey(type.getId())) {
+ throw new IllegalStateException("Data type '" + type.getName() + "', id '" +
+ type.getId() + "' is already registered.");
}
typeByName.put(type.getName(), type);
typeById.put(type.getId(), type);
diff --git a/config-model/src/main/java/com/yahoo/documentmodel/DocumentTypeRepo.java b/config-model/src/main/java/com/yahoo/documentmodel/DocumentTypeRepo.java
index b71a400666a..1abbf8b3ae1 100644
--- a/config-model/src/main/java/com/yahoo/documentmodel/DocumentTypeRepo.java
+++ b/config-model/src/main/java/com/yahoo/documentmodel/DocumentTypeRepo.java
@@ -9,6 +9,7 @@ import java.util.Map;
* @author baldersheim
*/
public class DocumentTypeRepo implements DocumentTypeCollection {
+
final Map<Integer, NewDocumentType> typeById = new LinkedHashMap<>();
final Map<NewDocumentType.Name, NewDocumentType> typeByName = new LinkedHashMap<>();
@@ -36,4 +37,5 @@ public class DocumentTypeRepo implements DocumentTypeCollection {
typeById.put(type.getFullName().getId(), type);
return this;
}
+
}
diff --git a/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java b/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java
index ccf9bdec302..7c594a4e836 100644
--- a/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java
+++ b/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java
@@ -13,15 +13,10 @@ import com.yahoo.searchdefinition.processing.BuiltInFieldSets;
import java.util.*;
/**
- * TODO: What is this and why?
- *
* @author baldersheim
*/
public final class NewDocumentType extends StructuredDataType implements DataTypeCollection {
- /**
- * TODO: What is this and why?
- */
public static final class Name {
// TODO: privatize