001package org.javasimon.clock;
002
003/**
004 * Units typically used in Java Simon with amount of nanoseconds they contain.
005 */
006public enum SimonUnit {
007
008        NANOSECOND("ns", 1),
009        MICROSECOND("?s", 1000),
010        MILLISECOND("ms", 1000_000),
011        SECOND("s", 1000_000_000);
012
013        private String symbol;
014        private int divisor;
015
016        SimonUnit(String symbol, int divisor) {
017                this.symbol = symbol;
018                this.divisor = divisor;
019        }
020
021        /**
022         * Returns the symbol of time unit.
023         *
024         * @return symbol of time unit
025         */
026        public String getSymbol() {
027                return symbol;
028        }
029
030        /**
031         * Returns number of nanoseconds in this unit.
032         *
033         * @return number of nanoseconds in this unit
034         */
035        public int getDivisor() {
036                return divisor;
037        }
038}