Package ca.uqac.lif.cep.tuples
Class ExpandAsColumns
- java.lang.Object
-
- 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 headerprotected java.lang.String
m_columnValue
The name of the column whose value will be used as a value for the newly created column
-
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
-
-
-
-
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 headercol_value
- The name of the column whose value will be used as a value for the newly created column
-
-
Method Detail
-
duplicate
public ExpandAsColumns duplicate(boolean with_state)
-
-