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

org.javasimon.clock.SimonUnit Maven / Gradle / Ivy

The newest version!
package org.javasimon.clock;

/**
 * Units typically used in Java Simon with amount of nanoseconds they contain.
 */
public enum SimonUnit {

	NANOSECOND("ns", 1),
	MICROSECOND("μs", 1000),
	MILLISECOND("ms", 1000_000),
	SECOND("s", 1000_000_000);

	private String symbol;
	private int divisor;

	SimonUnit(String symbol, int divisor) {
		this.symbol = symbol;
		this.divisor = divisor;
	}

	/**
	 * Returns the symbol of time unit.
	 *
	 * @return symbol of time unit
	 */
	public String getSymbol() {
		return symbol;
	}

	/**
	 * Returns number of nanoseconds in this unit.
	 *
	 * @return number of nanoseconds in this unit
	 */
	public int getDivisor() {
		return divisor;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy