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

jadex.micro.testcases.nfproperties.FakeNetworkBandwidthProperty Maven / Gradle / Ivy

Go to download

The Jadex micro applications package contains several example applications, benchmarks and testcases using micro agents.

There is a newer version: 4.0.267
Show newest version
package jadex.micro.testcases.nfproperties;

import jadex.bridge.nonfunctional.AbstractNFProperty;
import jadex.bridge.nonfunctional.NFPropertyMetaInfo;
import jadex.bridge.sensor.unit.MemoryUnit;
import jadex.commons.future.Future;
import jadex.commons.future.IFuture;

/**
 *  Property simulating a random amount of network bandwidth.
 *
 */
public class FakeNetworkBandwidthProperty extends AbstractNFProperty
{
	/** Persistent simulated bandwidth. */
	long fakenet = (long) Math.round(Math.random() * 1000.0);
	
	/**
	 * Creates the property.
	 */
	public FakeNetworkBandwidthProperty()
	{
		super(new NFPropertyMetaInfo("fakenetworkbandwith", Long.class, MemoryUnit.class, false, -1, false, null));
	}
	
	/**
	 *  Returns the property value.
	 */
	public IFuture getValue(MemoryUnit unit)
	{
		long ret = fakenet;
		if(unit!=null)
		{
			ret = unit.convert(ret);
		}
		
		return new Future(ret);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy