Package com.yahoo.search.query.profile
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 Summary
Fields Modifier and Type Field Description static DimensionValues
empty
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>
asContext(List<String> dimensions)
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.static DimensionValues
createFrom(String[] values)
boolean
equals(Object o)
String
get(int index)
Returns the string at the given index, or null if it has no value at this indexString[]
getValues()
Returns a copy of the values in this in an arrayint
hashCode()
boolean
isEmpty()
boolean
isMoreSpecificThan(DimensionValues other)
Helper method which uses compareTo to return whether this is most specificboolean
matches(DimensionValues givenValues)
Returns true if this is has the same value every place it has a value as the given values.int
size()
Returns the number of values in this (some of which may be null)String
toString()
-
-
-
Field Detail
-
empty
public static final DimensionValues empty
-
-
Method Detail
-
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 interfaceComparable<DimensionValues>
-
isMoreSpecificThan
public boolean isMoreSpecificThan(DimensionValues other)
Helper method which uses compareTo to return whether this is most specific
-
isEmpty
public boolean isEmpty()
-
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
-
-