Class Reference

  • All Implemented Interfaces:
    java.lang.Comparable<Reference>

    public class Reference
    extends com.yahoo.tensor.evaluation.Name
    implements java.lang.Comparable<Reference>
    A reference to a feature, function, or value in ranking expressions
    Author:
    bratseth
    • Constructor Summary

      Constructors 
      Constructor Description
      Reference​(java.lang.String name, Arguments arguments, java.lang.String output)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Arguments arguments()  
      int compareTo​(Reference o)  
      boolean equals​(java.lang.Object o)  
      static Reference fromIdentifier​(java.lang.String identifier)  
      int hashCode()  
      boolean isIdentifier()
      Returns true if this was created by fromIdentifier.
      boolean isSimple()
      A simple feature reference is a reference with a single identifier argument (and an optional output).
      java.lang.String output()  
      static java.util.Optional<Reference> simple​(java.lang.String feature)
      Returns the given simple feature as a reference, or empty if it is not a valid simple feature string on the form name(argument).
      static Reference simple​(java.lang.String name, java.lang.String argumentValue)
      Creates a reference to a simple feature consisting of a name and a single argument
      java.util.Optional<java.lang.String> simpleArgument()
      If the arguments of this contains a single argument which is an identifier, it is returned.
      java.lang.String toString()  
      java.lang.StringBuilder toString​(java.lang.StringBuilder b, SerializationContext context, java.util.Deque<java.lang.String> path, CompositeNode parent)  
      Reference withArguments​(Arguments arguments)  
      Reference withOutput​(java.lang.String output)  
      • Methods inherited from class com.yahoo.tensor.evaluation.Name

        name
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Reference

        public Reference​(java.lang.String name,
                         Arguments arguments,
                         java.lang.String output)
    • Method Detail

      • fromIdentifier

        public static Reference fromIdentifier​(java.lang.String identifier)
      • output

        public java.lang.String output()
      • simple

        public static Reference simple​(java.lang.String name,
                                       java.lang.String argumentValue)
        Creates a reference to a simple feature consisting of a name and a single argument
      • simple

        public static java.util.Optional<Reference> simple​(java.lang.String feature)
        Returns the given simple feature as a reference, or empty if it is not a valid simple feature string on the form name(argument).
      • isIdentifier

        public boolean isIdentifier()
        Returns true if this was created by fromIdentifier. Identifiers have no arguments or outputs.
      • isSimple

        public boolean isSimple()
        A simple feature reference is a reference with a single identifier argument (and an optional output).
      • simpleArgument

        public java.util.Optional<java.lang.String> simpleArgument()
        If the arguments of this contains a single argument which is an identifier, it is returned. Otherwise null is returned.
      • withOutput

        public Reference withOutput​(java.lang.String output)
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class com.yahoo.tensor.evaluation.Name
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class com.yahoo.tensor.evaluation.Name
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class com.yahoo.tensor.evaluation.Name
      • toString

        public java.lang.StringBuilder toString​(java.lang.StringBuilder b,
                                                SerializationContext context,
                                                java.util.Deque<java.lang.String> path,
                                                CompositeNode parent)
      • compareTo

        public int compareTo​(Reference o)
        Specified by:
        compareTo in interface java.lang.Comparable<Reference>