jadex.extension.envsupport.evaluation.DefaultDataProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-kernel-extension-envsupport Show documentation
Show all versions of jadex-kernel-extension-envsupport Show documentation
The Jadex kernel extension envsupport allows for using 2D spaces in concert with components.
package jadex.extension.envsupport.evaluation;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import jadex.commons.SUtil;
import jadex.extension.envsupport.environment.AbstractEnvironmentSpace;
import jadex.javaparser.IParsedExpression;
import jadex.javaparser.SimpleValueFetcher;
/**
* Provides data on basis of the environment space.
*/
public class DefaultDataProvider implements ITableDataProvider
{
//-------- attributes --------
/** The environment space. */
protected AbstractEnvironmentSpace envspace;
/** The space object selector. */
protected IObjectSource[] rowproviders;
/** The table name. */
protected String tablename;
/** The column names. */
protected String[] columnnames;
/** The expressions. */
protected IParsedExpression[] exps;
//-------- constructors --------
/**
* Create a new space object table data provider.
*/
public DefaultDataProvider(AbstractEnvironmentSpace envspace, IObjectSource[] rowproviders,
String tablename, String[] columnnames, IParsedExpression[] exps)
{
this.envspace = envspace;
this.rowproviders = rowproviders;
this.tablename = tablename;
this.columnnames = columnnames;
this.exps = exps;
}
//-------- methods --------
/**
* Get the data from a data provider.
* @return The data.
*/
public DataTable getTableData(long time, double tick)
{
DataTable ret = new DataTable(tablename, columnnames);
String[] names = new String[rowproviders.length];
Object[] values = new Object[rowproviders.length];
for(int i=0; i