summaryrefslogtreecommitdiffstats
path: root/vespajlib/src/main/java/com/yahoo/tensor/evaluation
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@verizonmedia.com>2019-11-27 17:55:01 +0200
committerJon Bratseth <bratseth@verizonmedia.com>2019-11-27 17:55:01 +0200
commitd3bb9e1b8f2b36688915fed559a1feac449216d7 (patch)
tree184df4eb34703bd0e2ff1ef7bdd8a593a555178e /vespajlib/src/main/java/com/yahoo/tensor/evaluation
parent9f1564bc8eb6568b54ed344a2c3201bfe634ac0e (diff)
Pull name up
Diffstat (limited to 'vespajlib/src/main/java/com/yahoo/tensor/evaluation')
-rw-r--r--vespajlib/src/main/java/com/yahoo/tensor/evaluation/EvaluationContext.java2
-rw-r--r--vespajlib/src/main/java/com/yahoo/tensor/evaluation/MapEvaluationContext.java2
-rw-r--r--vespajlib/src/main/java/com/yahoo/tensor/evaluation/Name.java28
-rw-r--r--vespajlib/src/main/java/com/yahoo/tensor/evaluation/TypeContext.java28
-rw-r--r--vespajlib/src/main/java/com/yahoo/tensor/evaluation/VariableTensor.java2
5 files changed, 32 insertions, 30 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/tensor/evaluation/EvaluationContext.java b/vespajlib/src/main/java/com/yahoo/tensor/evaluation/EvaluationContext.java
index 9ec105f8174..6e6b42cc1cd 100644
--- a/vespajlib/src/main/java/com/yahoo/tensor/evaluation/EvaluationContext.java
+++ b/vespajlib/src/main/java/com/yahoo/tensor/evaluation/EvaluationContext.java
@@ -8,7 +8,7 @@ import com.yahoo.tensor.Tensor;
*
* @author bratseth
*/
-public interface EvaluationContext<NAMETYPE extends TypeContext.Name> extends TypeContext<NAMETYPE> {
+public interface EvaluationContext<NAMETYPE extends Name> extends TypeContext<NAMETYPE> {
/** Returns the tensor bound to this name, or null if none */
Tensor getTensor(String name);
diff --git a/vespajlib/src/main/java/com/yahoo/tensor/evaluation/MapEvaluationContext.java b/vespajlib/src/main/java/com/yahoo/tensor/evaluation/MapEvaluationContext.java
index 076c73212d1..f684987476f 100644
--- a/vespajlib/src/main/java/com/yahoo/tensor/evaluation/MapEvaluationContext.java
+++ b/vespajlib/src/main/java/com/yahoo/tensor/evaluation/MapEvaluationContext.java
@@ -9,7 +9,7 @@ import java.util.HashMap;
/**
* @author bratseth
*/
-public class MapEvaluationContext<NAMETYPE extends TypeContext.Name> implements EvaluationContext<NAMETYPE> {
+public class MapEvaluationContext<NAMETYPE extends Name> implements EvaluationContext<NAMETYPE> {
private final java.util.Map<String, Tensor> bindings = new HashMap<>();
diff --git a/vespajlib/src/main/java/com/yahoo/tensor/evaluation/Name.java b/vespajlib/src/main/java/com/yahoo/tensor/evaluation/Name.java
new file mode 100644
index 00000000000..9033af1d7ec
--- /dev/null
+++ b/vespajlib/src/main/java/com/yahoo/tensor/evaluation/Name.java
@@ -0,0 +1,28 @@
+// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.tensor.evaluation;
+
+/** A name which is just a string. Names are value objects. */
+public class Name {
+
+ private final String name;
+
+ public Name(String name) {
+ this.name = name;
+ }
+
+ public String name() { return name; }
+
+ @Override
+ public String toString() { return name; }
+
+ @Override
+ public int hashCode() { return name.hashCode(); }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) return true;
+ if ( ! (other instanceof Name)) return false;
+ return ((Name)other).name.equals(this.name);
+ }
+
+}
diff --git a/vespajlib/src/main/java/com/yahoo/tensor/evaluation/TypeContext.java b/vespajlib/src/main/java/com/yahoo/tensor/evaluation/TypeContext.java
index 1437fd91974..84d82b624ba 100644
--- a/vespajlib/src/main/java/com/yahoo/tensor/evaluation/TypeContext.java
+++ b/vespajlib/src/main/java/com/yahoo/tensor/evaluation/TypeContext.java
@@ -8,7 +8,7 @@ import com.yahoo.tensor.TensorType;
*
* @author bratseth
*/
-public interface TypeContext<NAMETYPE extends TypeContext.Name> {
+public interface TypeContext<NAMETYPE extends Name> {
/**
* Returns the type of the tensor with this name.
@@ -26,31 +26,5 @@ public interface TypeContext<NAMETYPE extends TypeContext.Name> {
*/
TensorType getType(String name);
- /** A name which is just a string. Names are value objects. */
- class Name {
-
- private final String name;
-
- public Name(String name) {
- this.name = name;
- }
-
- public String name() { return name; }
-
- @Override
- public String toString() { return name; }
-
- @Override
- public int hashCode() { return name.hashCode(); }
-
- @Override
- public boolean equals(Object other) {
- if (other == this) return true;
- if ( ! (other instanceof Name)) return false;
- return ((Name)other).name.equals(this.name);
- }
-
- }
-
}
diff --git a/vespajlib/src/main/java/com/yahoo/tensor/evaluation/VariableTensor.java b/vespajlib/src/main/java/com/yahoo/tensor/evaluation/VariableTensor.java
index f4e025b3843..8ea82aa4a79 100644
--- a/vespajlib/src/main/java/com/yahoo/tensor/evaluation/VariableTensor.java
+++ b/vespajlib/src/main/java/com/yahoo/tensor/evaluation/VariableTensor.java
@@ -16,7 +16,7 @@ import java.util.Optional;
*
* @author bratseth
*/
-public class VariableTensor<NAMETYPE extends TypeContext.Name> extends PrimitiveTensorFunction<NAMETYPE> {
+public class VariableTensor<NAMETYPE extends Name> extends PrimitiveTensorFunction<NAMETYPE> {
private final String name;
private final Optional<TensorType> requiredType;