Class MapContext
java.lang.Object
com.yahoo.searchlib.rankingexpression.evaluation.Context
com.yahoo.searchlib.rankingexpression.evaluation.MapContext
- All Implemented Interfaces:
com.yahoo.tensor.evaluation.EvaluationContext<Reference>
,com.yahoo.tensor.evaluation.TypeContext<Reference>
A context backed by a Map
- Author:
- bratseth
-
Constructor Summary
ConstructorDescriptionMapContext
(Value missingValue) MapContext
(Map<String, Value> bindings) MapContext
(Map<String, Value> bindings, Value missingValue) Creates a map context from a map. -
Method Summary
Modifier and TypeMethodDescriptionbindings()
Returns an immutable view of the bindings of this.freeze()
Freezes this.static MapContext
fromString
(String contextString) A convenience constructor which returns a map context from a string on the formname1:value1, name2:value2 ...
.Returns the value of a key.com.yahoo.tensor.TensorType
Returns the type of the given value key, or null if it is not bound.names()
Returns an unmodifiable map of the names of thisvoid
Sets the value of a key.Returns a new, modifiable context containing all the bindings of thistoString()
-
Constructor Details
-
MapContext
public MapContext() -
MapContext
-
MapContext
-
MapContext
Creates a map context from a map. All the Values of the map will be frozen.
-
-
Method Details
-
freeze
Freezes this. Returns this for convenience. -
getType
Returns the type of the given value key, or null if it is not bound. -
get
Returns the value of a key. 0 is returned if the given key is not bound in this. -
put
Sets the value of a key. The value is frozen by this. -
bindings
Returns an immutable view of the bindings of this. -
thawedCopy
Returns a new, modifiable context containing all the bindings of this -
names
Returns an unmodifiable map of the names of this -
toString
-
fromString
A convenience constructor which returns a map context from a string on the formname1:value1, name2:value2 ...
. Extra spaces are allowed anywhere. Any other deviation from the syntax causes an exception to be thrown.
-