Class MapContext
- java.lang.Object
-
- com.yahoo.searchlib.rankingexpression.evaluation.Context
-
- com.yahoo.searchlib.rankingexpression.evaluation.MapContext
-
-
Constructor Summary
Constructors Constructor Description MapContext()
MapContext(Value missingValue)
MapContext(java.util.Map<java.lang.String,Value> bindings)
MapContext(java.util.Map<java.lang.String,Value> bindings, Value missingValue)
Creates a map context from a map.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,Value>
bindings()
Returns an immutable view of the bindings of this.MapContext
freeze()
Freezes this.static MapContext
fromString(java.lang.String contextString)
A convenience constructor which returns a map context from a string on the formname1:value1, name2:value2 ...
.Value
get(java.lang.String key)
Returns the value of a key.com.yahoo.tensor.TensorType
getType(Reference key)
Returns the type of the given value key, or null if it is not bound.java.util.Set<java.lang.String>
names()
Returns an unmodifiable map of the names of thisvoid
put(java.lang.String key, Value value)
Sets the value of a key.MapContext
thawedCopy()
Returns a new, modifiable context containing all the bindings of thisjava.lang.String
toString()
-
-
-
Method Detail
-
freeze
public MapContext freeze()
Freezes this. Returns this for convenience.
-
getType
public com.yahoo.tensor.TensorType getType(Reference key)
Returns the type of the given value key, or null if it is not bound.
-
get
public Value get(java.lang.String key)
Returns the value of a key. 0 is returned if the given key is not bound in this.
-
put
public void put(java.lang.String key, Value value)
Sets the value of a key. The value is frozen by this.
-
bindings
public java.util.Map<java.lang.String,Value> bindings()
Returns an immutable view of the bindings of this.
-
thawedCopy
public MapContext thawedCopy()
Returns a new, modifiable context containing all the bindings of this
-
names
public java.util.Set<java.lang.String> names()
Returns an unmodifiable map of the names of this
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
fromString
public static MapContext fromString(java.lang.String contextString)
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.
-
-