Class 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
      • Fields inherited from class ca.uqac.lif.cep.functions.Function

        s_maxInputArity
    • Constructor Summary

      Constructors 
      Constructor Description
      XPathFunction​(ca.uqac.lif.xml.XPathExpression exp)
      Creates a new XPath function
      XPathFunction​(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 string
      protected java.lang.Object postProcess​(java.util.Collection<ca.uqac.lif.xml.XmlElement> col)  
      java.lang.String toString()  
      • Methods inherited from class ca.uqac.lif.cep.functions.Function

        duplicate, evaluate, evaluateLazy, evaluatePartial, print, printState, read, readState, reset
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • m_expression

        protected final ca.uqac.lif.xml.XPathExpression m_expression
        The XPath expression this function evaluates
    • Constructor Detail

      • XPathFunction

        public XPathFunction​(java.lang.String exp)
      • XPathFunction

        public XPathFunction​(ca.uqac.lif.xml.XPathExpression exp)
        Creates a new XPath function
        Parameters:
        exp - The XPath expression to evaluate
    • 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 class java.lang.Object
      • duplicate

        public XPathFunction duplicate​(boolean with_state)
        Specified by:
        duplicate in interface ca.uqac.lif.cep.Duplicable
        Specified by:
        duplicate in class ca.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 expression
        context - 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 class ca.uqac.lif.cep.functions.Function
      • evaluate

        public void evaluate​(java.lang.Object[] inputs,
                             java.lang.Object[] outputs)
        Overrides:
        evaluate in class ca.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 class ca.uqac.lif.cep.functions.Function
      • getOutputArity

        public int getOutputArity()
        Specified by:
        getOutputArity in class ca.uqac.lif.cep.functions.Function
      • getInputTypesFor

        public void getInputTypesFor​(java.util.Set<java.lang.Class<?>> classes,
                                     int index)
        Specified by:
        getInputTypesFor in class ca.uqac.lif.cep.functions.Function
      • getOutputTypeFor

        public java.lang.Class<?> getOutputTypeFor​(int index)
        Specified by:
        getOutputTypeFor in class ca.uqac.lif.cep.functions.Function
      • postProcess

        protected java.lang.Object postProcess​(java.util.Collection<ca.uqac.lif.xml.XmlElement> col)