Class SerializationContext
java.lang.Object
com.yahoo.searchlib.rankingexpression.rule.FunctionReferenceContext
com.yahoo.searchlib.rankingexpression.rule.SerializationContext
Context needed to serialize an expression to a string. This has the lifetime of a single serialization
- Author:
- bratseth
-
Constructor Summary
ConstructorDescriptionCreate a context for a single serialization taskSerializationContext
(Collection<ExpressionFunction> functions, Map<String, String> bindings, com.yahoo.tensor.evaluation.TypeContext<Reference> typeContext) Create a context for a single serialization taskSerializationContext
(Collection<ExpressionFunction> functions, Optional<com.yahoo.tensor.evaluation.TypeContext<Reference>> typeContext) Create a context for a single serialization taskSerializationContext
(Map<String, ExpressionFunction> functions, Map<String, String> bindings, Optional<com.yahoo.tensor.evaluation.TypeContext<Reference>> typeContext, Map<String, String> serializedFunctions) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addArgumentTypeSerialization
(String functionName, String argumentName, com.yahoo.tensor.TensorType type) Adds the serialization of the argument type to a functionvoid
addFunctionSerialization
(String name, String expressionString) Adds the serialization of a functionvoid
addFunctionTypeSerialization
(String functionName, com.yahoo.tensor.TensorType type) Adds the serialization of the return type of a functionboolean
needSerialization
(String functionName) Returns the type context of this, if it is able to resolve types.withBindings
(Map<String, String> bindings) Returns a new context with the bindings replaced by the given bindingsReturns a fresh context without bindingsMethods inherited from class com.yahoo.searchlib.rankingexpression.rule.FunctionReferenceContext
getBinding, getFunction, getFunctions
-
Constructor Details
-
SerializationContext
public SerializationContext()Create a context for a single serialization task -
SerializationContext
public SerializationContext(Collection<ExpressionFunction> functions, Optional<com.yahoo.tensor.evaluation.TypeContext<Reference>> typeContext) Create a context for a single serialization task- Parameters:
functions
- the functions of thistypeContext
- the type context of this: Serialization may depend on type resolution
-
SerializationContext
public SerializationContext(Collection<ExpressionFunction> functions, Map<String, String> bindings, com.yahoo.tensor.evaluation.TypeContext<Reference> typeContext) Create a context for a single serialization task- Parameters:
functions
- the functions of thisbindings
- the arguments of thistypeContext
- the type context of this: Serialization may depend on type resolution
-
SerializationContext
-
-
Method Details
-
typeContext
Returns the type context of this, if it is able to resolve types. -
addFunctionSerialization
Adds the serialization of a function -
addArgumentTypeSerialization
public void addArgumentTypeSerialization(String functionName, String argumentName, com.yahoo.tensor.TensorType type) Adds the serialization of the argument type to a function -
addFunctionTypeSerialization
Adds the serialization of the return type of a function -
withBindings
Description copied from class:FunctionReferenceContext
Returns a new context with the bindings replaced by the given bindings- Overrides:
withBindings
in classFunctionReferenceContext
-
withoutBindings
Returns a fresh context without bindings- Overrides:
withoutBindings
in classFunctionReferenceContext
-
serializedFunctions
-
needSerialization
-