summaryrefslogtreecommitdiffstats
path: root/vespajlib/src/main/java/com/yahoo/tensor/TensorType.java
diff options
context:
space:
mode:
authorJon Bratseth <jonbratseth@yahoo.com>2018-02-22 16:20:48 +0100
committerGitHub <noreply@github.com>2018-02-22 16:20:48 +0100
commit1791ba9fc169c821bee826ed39d9a42ffa03def0 (patch)
tree4601457cb3cdf0cc2a4b84efc44668748edfd8f3 /vespajlib/src/main/java/com/yahoo/tensor/TensorType.java
parent7358ce6a49eedf51b3761a855921c58a5f813321 (diff)
Revert "Revert "Bratseth/typecheck all 3""
Diffstat (limited to 'vespajlib/src/main/java/com/yahoo/tensor/TensorType.java')
-rw-r--r--vespajlib/src/main/java/com/yahoo/tensor/TensorType.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/tensor/TensorType.java b/vespajlib/src/main/java/com/yahoo/tensor/TensorType.java
index 14cd3e70866..bf1825446e4 100644
--- a/vespajlib/src/main/java/com/yahoo/tensor/TensorType.java
+++ b/vespajlib/src/main/java/com/yahoo/tensor/TensorType.java
@@ -77,6 +77,13 @@ public class TensorType {
return Optional.empty();
}
+ /* Returns the bound of this dimension if it is present and bound in this, empty otherwise */
+ public Optional<Long> sizeOfDimension(String dimension) {
+ Optional<Dimension> d = dimension(dimension);
+ if ( ! d.isPresent()) return Optional.empty();
+ return d.get().size();
+ }
+
/**
* Returns whether this type can be assigned to the given type,
* i.e if the given type is a generalization of this type.