diff options
Diffstat (limited to 'vespajlib/src/main/java/com/yahoo/tensor/TensorType.java')
-rw-r--r-- | vespajlib/src/main/java/com/yahoo/tensor/TensorType.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/tensor/TensorType.java b/vespajlib/src/main/java/com/yahoo/tensor/TensorType.java index bf1825446e4..0176dac6821 100644 --- a/vespajlib/src/main/java/com/yahoo/tensor/TensorType.java +++ b/vespajlib/src/main/java/com/yahoo/tensor/TensorType.java @@ -214,7 +214,7 @@ public class TensorType { /** Returns a copy of this with the name set to the given name */ public abstract Dimension withName(String name); - /** Returns true if this is an indexed bound or unboun type */ + /** Returns true if this is an indexed bound or unbound type */ public boolean isIndexed() { return type() == Type.indexedBound || type() == Type.indexedUnbound; } /** @@ -261,6 +261,14 @@ public class TensorType { return new IndexedBoundDimension(name, size); } + public static Dimension indexed(String name) { + return new IndexedUnboundDimension(name); + } + + public static Dimension mapped(String name) { + return new MappedDimension(name); + } + } public static class IndexedBoundDimension extends TensorType.Dimension { @@ -374,6 +382,15 @@ public class TensorType { addDimensionsOf(type); } + /** + * Creates a builder from the given dimensions. + */ + public Builder(Iterable<Dimension> dimensions) { + for (TensorType.Dimension dimension : dimensions) { + dimension(dimension); + } + } + private static final boolean supportsMixedTypes = false; private void addDimensionsOf(TensorType type) { |