diff --git a/Mtnp/src/ca/uqac/lif/cep/mtnp/UpdateTable.java b/Mtnp/src/ca/uqac/lif/cep/mtnp/UpdateTable.java index c39b68c..93fbe74 100644 --- a/Mtnp/src/ca/uqac/lif/cep/mtnp/UpdateTable.java +++ b/Mtnp/src/ca/uqac/lif/cep/mtnp/UpdateTable.java @@ -17,6 +17,8 @@ */ package ca.uqac.lif.cep.mtnp; +import java.util.List; + import ca.uqac.lif.cep.UniformProcessor; import ca.uqac.lif.mtnp.table.HardTable; import ca.uqac.lif.mtnp.table.TableEntry; @@ -54,6 +56,19 @@ public UpdateTable(int in_arity, String ... column_names) m_table = new HardTable(column_names); } + /** + * Creates a new instance of the processor. + * @param in_arity The input arity + * @param column_names The names of the columns in the resulting table + */ + public UpdateTable(int in_arity, List column_names) + { + super(in_arity, 1); + String[] col_names = new String[column_names.size()]; + column_names.toArray(col_names); + m_table = new HardTable(col_names); + } + /** * Creates a new instance of the processor. * @param in_arity The input arity diff --git a/Mtnp/src/ca/uqac/lif/cep/mtnp/UpdateTableMap.java b/Mtnp/src/ca/uqac/lif/cep/mtnp/UpdateTableMap.java index 7dedc3e..4289271 100644 --- a/Mtnp/src/ca/uqac/lif/cep/mtnp/UpdateTableMap.java +++ b/Mtnp/src/ca/uqac/lif/cep/mtnp/UpdateTableMap.java @@ -1,6 +1,6 @@ /* BeepBeep, an event stream processor - Copyright (C) 2008-2017 Sylvain Hallé + Copyright (C) 2008-2023 Sylvain Hallé This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -17,6 +17,7 @@ */ package ca.uqac.lif.cep.mtnp; +import java.util.List; import java.util.Map; import ca.uqac.lif.mtnp.table.TableEntry; @@ -32,6 +33,11 @@ public UpdateTableMap(String ... col_names) { super(1, col_names); } + + public UpdateTableMap(List col_names) + { + super(1, col_names); + } @Override protected boolean compute(Object[] inputs, Object[] outputs) diff --git a/Tuples/src/ca/uqac/lif/cep/tuples/MergeScalars.java b/Tuples/src/ca/uqac/lif/cep/tuples/MergeScalars.java index 5865693..d5c3618 100755 --- a/Tuples/src/ca/uqac/lif/cep/tuples/MergeScalars.java +++ b/Tuples/src/ca/uqac/lif/cep/tuples/MergeScalars.java @@ -1,6 +1,6 @@ /* BeepBeep, an event stream processor - Copyright (C) 2008-2017 Sylvain Hallé + Copyright (C) 2008-2023 Sylvain Hallé This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -17,6 +17,7 @@ */ package ca.uqac.lif.cep.tuples; +import java.util.List; import java.util.Set; import ca.uqac.lif.cep.Connector; @@ -42,7 +43,7 @@ public class MergeScalars extends Function /** * The names given to the attributes corresponding to each scalar */ - protected String[] m_attributeNames; + protected final String[] m_attributeNames; protected FixedTupleBuilder m_builder; @@ -52,6 +53,17 @@ public MergeScalars(String ... names) m_attributeNames = names; m_builder = new FixedTupleBuilder(names); } + + public MergeScalars(List names) + { + super(); + m_attributeNames = new String[names.size()]; + for (int i = 0; i < names.size(); i++) + { + m_attributeNames[i] = names.get(i); + } + m_builder = new FixedTupleBuilder(m_attributeNames); + } @Override public void evaluate(Object[] inputs, Object[] outputs, Context context, EventTracker tracker)