Class ExpandAsColumns

  • All Implemented Interfaces:
    ca.uqac.lif.azrael.Printable, ca.uqac.lif.azrael.Readable, ca.uqac.lif.cep.Duplicable, ca.uqac.lif.cep.functions.DuplicableFunction

    public class ExpandAsColumns
    extends ca.uqac.lif.cep.functions.UnaryFunction<Tuple,​Tuple>
    Transforms a tuple by replacing two key-value pairs by a single new key-value pair. The new pair is created by taking the value of a column as the key, and the value of another column as the value.

    For example, with the tuple: {(foo,1), (bar,2), (baz,3)}, using "foo" as the "key" column and "baz" as the value column, the resulting tuple would be: {(1,3), (bar,2)}. The value of foo is the new key, and the value of baz is the new value.

    If the value of the "key" pair is not a string, it is converted into a string by calling its toString() method (since the key of a tuple is always a string).

    Author:
    Sylvain Hallé
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String m_columnName
      The name of the column whose value will be used as a column header
      protected java.lang.String m_columnValue
      The name of the column whose value will be used as a value for the newly created column
      • Fields inherited from class ca.uqac.lif.cep.functions.Function

        s_maxInputArity
    • Constructor Summary

      Constructors 
      Constructor Description
      ExpandAsColumns​(java.lang.String col_name, java.lang.String col_value)
      Creates a new instance of the function.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ExpandAsColumns duplicate​(boolean with_state)  
      Tuple getValue​(Tuple x)  
      • Methods inherited from class ca.uqac.lif.cep.functions.UnaryFunction

        evaluate, getInputArity, getInputTypesFor, getOutputArity, getOutputTypeFor, reset
      • Methods inherited from class ca.uqac.lif.cep.functions.Function

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

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

      • m_columnName

        protected java.lang.String m_columnName
        The name of the column whose value will be used as a column header
      • m_columnValue

        protected java.lang.String m_columnValue
        The name of the column whose value will be used as a value for the newly created column
    • Constructor Detail

      • ExpandAsColumns

        public ExpandAsColumns​(java.lang.String col_name,
                               java.lang.String col_value)
        Creates a new instance of the function.
        Parameters:
        col_name - The name of the column whose value will be used as a column header
        col_value - The name of the column whose value will be used as a value for the newly created column
    • Method Detail

      • getValue

        public Tuple getValue​(Tuple x)
        Specified by:
        getValue in class ca.uqac.lif.cep.functions.UnaryFunction<Tuple,​Tuple>
      • duplicate

        public ExpandAsColumns duplicate​(boolean with_state)
        Specified by:
        duplicate in interface ca.uqac.lif.cep.Duplicable
        Overrides:
        duplicate in class ca.uqac.lif.cep.functions.UnaryFunction<Tuple,​Tuple>