Class DimensionValues

java.lang.Object
com.yahoo.search.query.profile.DimensionValues
All Implemented Interfaces:
Comparable<DimensionValues>

public class DimensionValues extends Object implements Comparable<DimensionValues>
An immutable set of dimension values. Note that this may contain more or fewer values than needed given a set of dimensions. Any missing values are treated as null.
Author:
bratseth
  • Field Details

  • Method Details

    • createFrom

      public static DimensionValues createFrom(String[] values)
    • matches

      public boolean matches(DimensionValues givenValues)
      Returns true if this is has the same value every place it has a value as the given values.
    • compareTo

      public int compareTo(DimensionValues other)
      Implements the sort order of this which is based on specificity where dimensions to the left are more significant: -1 is returned if this is more specific than other, 1 is returned if other is more specific than this, 0 is returned if none is more specific than the other.

      Note: This ordering is not consistent with equals - it returns 0 when the same dimensions are set, regardless of what they are set to.

      Specified by:
      compareTo in interface Comparable<DimensionValues>
    • isMoreSpecificThan

      public boolean isMoreSpecificThan(DimensionValues other)
      Helper method which uses compareTo to return whether this is most specific
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isEmpty

      public boolean isEmpty()
    • asContext

      public Map<String,String> asContext(List<String> dimensions)
    • get

      public String get(int index)
      Returns the string at the given index, or null if it has no value at this index
    • size

      public int size()
      Returns the number of values in this (some of which may be null)
    • getValues

      public String[] getValues()
      Returns a copy of the values in this in an array