aboutsummaryrefslogtreecommitdiffstats
path: root/vespajlib/src/main/java/com/yahoo/tensor/evaluation/MapEvaluationContext.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@verizonmedia.com>2019-11-27 15:58:06 +0200
committerJon Bratseth <bratseth@verizonmedia.com>2019-11-27 15:58:06 +0200
commit77bb8f5117b7a0f78b2dc99a3937430339e4291d (patch)
tree9037b54f17e3175a8d11e1b43b55b71887f867a4 /vespajlib/src/main/java/com/yahoo/tensor/evaluation/MapEvaluationContext.java
parentf4203c3cc571722f08ee65047437c1290ed63f69 (diff)
Support index generating expressions in tensor value functions
Diffstat (limited to 'vespajlib/src/main/java/com/yahoo/tensor/evaluation/MapEvaluationContext.java')
-rw-r--r--vespajlib/src/main/java/com/yahoo/tensor/evaluation/MapEvaluationContext.java12
1 files changed, 6 insertions, 6 deletions
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 e302e317418..076c73212d1 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 implements EvaluationContext<TypeContext.Name> {
+public class MapEvaluationContext<NAMETYPE extends TypeContext.Name> implements EvaluationContext<NAMETYPE> {
private final java.util.Map<String, Tensor> bindings = new HashMap<>();
@@ -17,14 +17,14 @@ public class MapEvaluationContext implements EvaluationContext<TypeContext.Name>
@Override
public TensorType getType(String name) {
- return getType(new Name(name));
+ Tensor tensor = bindings.get(name);
+ if (tensor == null) return null;
+ return tensor.type();
}
@Override
- public TensorType getType(Name name) {
- Tensor tensor = bindings.get(name.toString());
- if (tensor == null) return null;
- return tensor.type();
+ public TensorType getType(NAMETYPE name) {
+ return getType(name.name());
}
@Override