Package com.yahoo.search.query.profile
Class QueryProfileVariants
java.lang.Object
com.yahoo.search.query.profile.QueryProfileVariants
- All Implemented Interfaces:
com.yahoo.component.provider.Freezable
,Cloneable
public class QueryProfileVariants
extends Object
implements com.yahoo.component.provider.Freezable, Cloneable
This class represent a set of query profiles virtually - rather
than storing and instantiating each profile this structure represents explicitly only
the values set in the various virtual profiles. The set of virtual profiles are defined by a set of
dimensions. Values may be set for any point in this multi-dimensional space, and may also be set for
any regular hyper-region by setting values for any point in certain of these dimensions.
The set of virtual profiles defined by this consists of all the combinations of dimension points for
which one or more values is set in this, as well as any possible less specified regions.
A set of virtual profiles are always owned by a single profile, which is also their parent in the inheritance hierarchy.
- Author:
- bratseth
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
-
Constructor Summary
ConstructorDescriptionQueryProfileVariants
(String[] dimensions, QueryProfile owner) Creates a set of virtual query profiles which may return varying values over the set of dimensions given.QueryProfileVariants
(List<String> dimensions, QueryProfile owner) Creates a set of virtual query profiles which may return varying values over the set of dimensions given. -
Method Summary
Modifier and TypeMethodDescriptionclone()
protected void
Throws an IllegalStateException if this is frozenvoid
freeze()
Irreversibly prevents any further modifications to thisget
(String name, QueryProfileType type, boolean allowQueryProfileResult, DimensionBinding dimensionBinding) Returns the most specific matching value of a name for a given set of canonical dimension values.Returns the dimensions over which the virtual profiles in this may return different values.Returns the map of field values of this indexed by field name.Returns the profiles inherited from various variants of thisgetVariant
(DimensionValues dimensionValues, boolean create) Returns the query profile variant having exactly the given dimensions, and creates it if create is set and it is missingReturns all the variants of this, sorted by specificity.void
inherit
(QueryProfile profile, DimensionValues dimensionValues) Inherits a particular profile in a variant of thisboolean
isFrozen()
isOverridable
(String fieldName, DimensionValues dimensionValues) void
set
(String fieldName, DimensionValues dimensionValues, Object value) Sets a value to thisvoid
setOverridable
(String fieldName, boolean overridable, DimensionValues dimensionValues) Makes a value unoverridable in a given context.toString()
-
Constructor Details
-
QueryProfileVariants
Creates a set of virtual query profiles which may return varying values over the set of dimensions given. Each dimension is a name for which a key-value may be supplied in the context properties on lookup time to influence the value returned. -
QueryProfileVariants
Creates a set of virtual query profiles which may return varying values over the set of dimensions given. Each dimension is a name for which a key-value may be supplied in the context properties on lookup time to influence the value returned.- Parameters:
dimensions
- the dimension names this may vary over. The list gets owned by this, so it must not be further modified from outside). This will not modify the list.
-
-
Method Details
-
freeze
public void freeze()Irreversibly prevents any further modifications to this- Specified by:
freeze
in interfacecom.yahoo.component.provider.Freezable
-
isFrozen
public boolean isFrozen()- Specified by:
isFrozen
in interfacecom.yahoo.component.provider.Freezable
-
get
public Object get(String name, QueryProfileType type, boolean allowQueryProfileResult, DimensionBinding dimensionBinding) Returns the most specific matching value of a name for a given set of canonical dimension values.- Parameters:
name
- the name to return the best matching value ofdimensionBinding
- the dimension bindings to use in this
-
inherit
Inherits a particular profile in a variant of this -
set
Sets a value to this- Parameters:
fieldName
- the name of the field to set. This cannot be a compound (dotted) namedimensionValues
- the dimension values for which this value appliesvalue
- the value to set
-
setOverridable
Makes a value unoverridable in a given context. -
isOverridable
-
getDimensions
Returns the dimensions over which the virtual profiles in this may return different values. Each dimension is a name for which a key-value may be supplied in the context properties on lookup time to influence the value returned. The dimensions may not be modified - the returned list is always read only. -
getFieldValues
Returns the map of field values of this indexed by field name. -
getInherited
Returns the profiles inherited from various variants of this -
getVariants
Returns all the variants of this, sorted by specificity. This is content as declared. The returned list is always unmodifiable. -
clone
-
ensureNotFrozen
protected void ensureNotFrozen()Throws an IllegalStateException if this is frozen -
getVariant
Returns the query profile variant having exactly the given dimensions, and creates it if create is set and it is missing- Parameters:
dimensionValues
- the dimension valuescreate
- whether or not to create the variant if missing- Returns:
- the profile variant, or null if not found and create is false
-
toString
-