diff options
Diffstat (limited to 'vespajlib/src/main/java/com/yahoo/tensor/evaluation/Name.java')
-rw-r--r-- | vespajlib/src/main/java/com/yahoo/tensor/evaluation/Name.java | 28 |
1 files changed, 28 insertions, 0 deletions
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); + } + +} |