All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jadex.extension.envsupport.evaluation.DefaultDataProvider Maven / Gradle / Ivy

Go to download

The Jadex kernel extension envsupport allows for using 2D spaces in concert with components.

There is a newer version: 3.0.117
Show newest version
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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy