Package ca.uqac.lif.cep.xml
Class XPathFunction
- java.lang.Object
-
- ca.uqac.lif.cep.functions.Function
-
- ca.uqac.lif.cep.xml.XPathFunction
-
- All Implemented Interfaces:
ca.uqac.lif.azrael.Printable
,ca.uqac.lif.azrael.Readable
,ca.uqac.lif.cep.Duplicable
,ca.uqac.lif.cep.functions.DuplicableFunction
- Direct Known Subclasses:
XPathFunctionGet
public class XPathFunction extends ca.uqac.lif.cep.functions.Function
Function that converts a string into an XML element
-
-
Field Summary
Fields Modifier and Type Field Description protected ca.uqac.lif.xml.XPathExpression
m_expression
The XPath expression this function evaluates
-
Constructor Summary
Constructors Constructor Description XPathFunction(ca.uqac.lif.xml.XPathExpression exp)
Creates a new XPath functionXPathFunction(java.lang.String exp)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description XPathFunction
duplicate(boolean with_state)
void
evaluate(java.lang.Object[] inputs, java.lang.Object[] outputs)
void
evaluate(java.lang.Object[] inputs, java.lang.Object[] outputs, ca.uqac.lif.cep.Context context, ca.uqac.lif.cep.EventTracker tracker)
protected static ca.uqac.lif.xml.XPathExpression
evaluatePlaceholders(ca.uqac.lif.xml.XPathExpression expression, ca.uqac.lif.cep.Context context, ca.uqac.lif.cep.EventTracker tracker)
Replaces all occurrences of placeholders in an XPath expression by concrete values fetched from some context.int
getInputArity()
void
getInputTypesFor(java.util.Set<java.lang.Class<?>> classes, int index)
int
getOutputArity()
java.lang.Class<?>
getOutputTypeFor(int index)
java.util.Collection<ca.uqac.lif.xml.XmlElement>
getValue(ca.uqac.lif.xml.XmlElement x)
static ca.uqac.lif.xml.XPathExpression
parseExpression(java.lang.String s)
Parses an XPath expression from a stringprotected java.lang.Object
postProcess(java.util.Collection<ca.uqac.lif.xml.XmlElement> col)
java.lang.String
toString()
-
-
-
Method Detail
-
parseExpression
public static ca.uqac.lif.xml.XPathExpression parseExpression(java.lang.String s)
Parses an XPath expression from a string- Parameters:
s
- The string to parse- Returns:
- An expression, or
null
if the parsing failed
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
duplicate
public XPathFunction duplicate(boolean with_state)
- Specified by:
duplicate
in interfaceca.uqac.lif.cep.Duplicable
- Specified by:
duplicate
in classca.uqac.lif.cep.functions.Function
-
evaluatePlaceholders
protected static ca.uqac.lif.xml.XPathExpression evaluatePlaceholders(ca.uqac.lif.xml.XPathExpression expression, ca.uqac.lif.cep.Context context, ca.uqac.lif.cep.EventTracker tracker)
Replaces all occurrences of placeholders in an XPath expression by concrete values fetched from some context. Placeholders are currently only supported in binary predicates, and are identified by a "$" symbol followed by some name- Parameters:
expression
- The original expressioncontext
- The context- Returns:
- The new expression where placeholders have been replaced
-
evaluate
public void evaluate(java.lang.Object[] inputs, java.lang.Object[] outputs, ca.uqac.lif.cep.Context context, ca.uqac.lif.cep.EventTracker tracker)
- Specified by:
evaluate
in classca.uqac.lif.cep.functions.Function
-
evaluate
public void evaluate(java.lang.Object[] inputs, java.lang.Object[] outputs)
- Overrides:
evaluate
in classca.uqac.lif.cep.functions.Function
-
getValue
public java.util.Collection<ca.uqac.lif.xml.XmlElement> getValue(ca.uqac.lif.xml.XmlElement x)
-
getInputArity
public int getInputArity()
- Specified by:
getInputArity
in classca.uqac.lif.cep.functions.Function
-
getOutputArity
public int getOutputArity()
- Specified by:
getOutputArity
in classca.uqac.lif.cep.functions.Function
-
getInputTypesFor
public void getInputTypesFor(java.util.Set<java.lang.Class<?>> classes, int index)
- Specified by:
getInputTypesFor
in classca.uqac.lif.cep.functions.Function
-
getOutputTypeFor
public java.lang.Class<?> getOutputTypeFor(int index)
- Specified by:
getOutputTypeFor
in classca.uqac.lif.cep.functions.Function
-
postProcess
protected java.lang.Object postProcess(java.util.Collection<ca.uqac.lif.xml.XmlElement> col)
-
-