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

jadex.bridge.sensor.unit.PercentUnit Maven / Gradle / Ivy

Go to download

Jadex bridge is a base package for kernels and platforms, i.e., it is used by both and provides commonly used interfaces and classes for active components and their management.

There is a newer version: 4.0.267
Show newest version
package jadex.bridge.sensor.unit;

/**
 *  Percent unit.
 */
public enum PercentUnit implements IConvertableUnit, IPrettyPrintUnit
{
	PERCENT;
	
	/**
	 *  Convert to a known unit.
	 */
	public Double convert(Double value)
	{
		int val = (int)(value*10000);
		double ret = ((double)val)/100;
		return ret;
	}
	
	/**
	 *  Pretty print a value according to the underlying unit to a string.
	 *  @param value The value.
	 *  @return The pretty printed string.
	 */
	public String prettyPrint(Double value)
	{
		return ""+convert(value)+" %";
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy