001package com.pi4j.temperature;
002
003/*
004 * #%L
005 * **********************************************************************
006 * ORGANIZATION  :  Pi4J
007 * PROJECT       :  Pi4J :: Java Library (Core)
008 * FILENAME      :  TemperatureScale.java  
009 * 
010 * This file is part of the Pi4J project. More information about 
011 * this project can be found here:  http://www.pi4j.com/
012 * **********************************************************************
013 * %%
014 * Copyright (C) 2012 - 2013 Pi4J
015 * %%
016 * Licensed under the Apache License, Version 2.0 (the "License");
017 * you may not use this file except in compliance with the License.
018 * You may obtain a copy of the License at
019 * 
020 *      http://www.apache.org/licenses/LICENSE-2.0
021 * 
022 * Unless required by applicable law or agreed to in writing, software
023 * distributed under the License is distributed on an "AS IS" BASIS,
024 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
025 * See the License for the specific language governing permissions and
026 * limitations under the License.
027 * #L%
028 */
029
030
031public enum TemperatureScale {
032    
033    CELSIUS("Celsius","°C",TemperatureConversion.ABSOLUTE_ZERO_CELSIUS),
034    FARENHEIT("Farenheit","°F", TemperatureConversion.ABSOLUTE_ZERO_FARENHEIT),
035    KELVIN("Kelvin","K", TemperatureConversion.ABSOLUTE_ZERO_KELVIN),
036    RANKINE("Rankine","°R", TemperatureConversion.ABSOLUTE_ZERO_RANKINE);
037    
038    private String name;
039    private String units;
040    private double absoluteZero = 0;
041    
042    TemperatureScale(String name, String units, double absoluteZero){
043        this.name= name;
044        this.units = units;
045        this.absoluteZero = absoluteZero;
046    }
047    
048    public String getName() {
049        return name;
050    }
051
052    public String getUnits() {
053        return units;
054    }
055
056    public String getValueString(double temperature) {
057        return temperature + " " + units;
058    }
059    
060    public double getAbsoluteZero() {
061        return absoluteZero;
062    }
063    
064    @Override
065    public String toString() {
066        return name;
067    }
068    
069}