001/*******************************************************************************
002 * Crown Copyright (c) 2006 - 2014, Copyright (c) 2006 - 2014 Kestral Computing P/L.
003 * All rights reserved. This program and the accompanying materials
004 * are made available under the terms of the Eclipse Public License v1.0
005 * which accompanies this distribution, and is available at
006 * http://www.eclipse.org/legal/epl-v10.html
007 * 
008 * Contributors:
009 *    Kestral Computing P/L - initial implementation
010 *******************************************************************************/
011
012package org.hl7.fhir.utilities.ucum;
013
014
015public class Symbol extends Component {
016
017        private Unit unit; // may be Base Unit or DefinedUnit
018        private Prefix prefix;  // only if unit is metric 
019        private int exponent;
020        
021        
022        /**
023         * 
024         */
025        public Symbol() {
026                super();
027        }
028
029
030        /**
031         * @param unit
032         * @param prefix
033         * @param exponent
034         */
035        public Symbol(Unit unit, Prefix prefix, int exponent) {
036                super();
037                this.unit = unit;
038                this.prefix = prefix;
039                this.exponent = exponent;
040        }
041
042
043        /**
044         * @return the unit
045         */
046        public Unit getUnit() {
047                return unit;
048        }
049
050
051        /**
052         * @param unit the unit to set
053         */
054        public void setUnit(Unit unit) {
055                this.unit = unit;
056        }
057
058
059        /**
060         * @return the prefix
061         */
062        public Prefix getPrefix() {
063                return prefix;
064        }
065
066
067        /**
068         * @param prefix the prefix to set
069         */
070        public void setPrefix(Prefix prefix) {
071                this.prefix = prefix;
072        }
073
074
075        /**
076         * @return the exponent
077         */
078        public int getExponent() {
079                return exponent;
080        }
081
082
083        /**
084         * @param exponent the exponent to set
085         */
086        public void setExponent(int exponent) {
087                this.exponent = exponent;
088        }
089        
090        public boolean hasPrefix() {
091                return prefix != null;
092        }
093
094
095        public void invertExponent() {
096                exponent = -exponent;
097                
098        }
099        
100}