001    /*
002     * This file is part of McIDAS-V
003     *
004     * Copyright 2007-2013
005     * Space Science and Engineering Center (SSEC)
006     * University of Wisconsin - Madison
007     * 1225 W. Dayton Street, Madison, WI 53706, USA
008     * https://www.ssec.wisc.edu/mcidas
009     * 
010     * All Rights Reserved
011     * 
012     * McIDAS-V is built on Unidata's IDV and SSEC's VisAD libraries, and
013     * some McIDAS-V source code is based on IDV and VisAD source code.  
014     * 
015     * McIDAS-V is free software; you can redistribute it and/or modify
016     * it under the terms of the GNU Lesser Public License as published by
017     * the Free Software Foundation; either version 3 of the License, or
018     * (at your option) any later version.
019     * 
020     * McIDAS-V is distributed in the hope that it will be useful,
021     * but WITHOUT ANY WARRANTY; without even the implied warranty of
022     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
023     * GNU Lesser Public License for more details.
024     * 
025     * You should have received a copy of the GNU Lesser Public License
026     * along with this program.  If not, see http://www.gnu.org/licenses.
027     */
028    
029    package edu.wisc.ssec.mcidasv.data.cyclone;
030    
031    import visad.DateTime;
032    
033    /**
034     * Created by IntelliJ IDEA. User: yuanho Date: Apr 9, 2008 Time: 4:57:21 PM To
035     * change this template use File | Settings | File Templates.
036     */
037    
038    public class StormInfo implements Comparable {
039    
040            /** _more_ */
041            private String stormID;
042    
043            /** _more_ */
044            private String name;
045    
046            /** _more_ */
047            private String basin;
048    
049            /** _more_ */
050            private String number;
051    
052            /** _more_ */
053            private DateTime startTime;
054    
055            /**
056             * _more_
057             */
058            public StormInfo() {
059            }
060    
061            /**
062             * _more_
063             * 
064             * @param id
065             *            _more_
066             * @param sTime
067             *            _more_
068             */
069            public StormInfo(String id, DateTime sTime) {
070                    this(id, id, sTime);
071            }
072    
073            /**
074             * _more_
075             * 
076             * @param id
077             *            _more_
078             * @param name
079             *            _more_
080             * @param sTime
081             *            _more_
082             */
083            public StormInfo(String id, String name, DateTime sTime) {
084                    this(id, name, null, null, sTime);
085            }
086    
087            /**
088             * _more_
089             * 
090             * @param id
091             *            _more_
092             * @param name
093             *            _more_
094             * @param basin
095             *            _more_
096             * @param number
097             *            _more_
098             * @param sTime
099             *            _more_
100             */
101            public StormInfo(String id, String name, String basin, String number,
102                            DateTime sTime) {
103                    this.stormID = id;
104                    this.name = name;
105                    this.basin = basin;
106                    this.startTime = sTime;
107                    this.number = number;
108            }
109    
110            /**
111             * Compare this object to another.
112             * 
113             * @param o
114             *            object in question.
115             * @return spec from Comparable interface.
116             */
117            public int compareTo(Object o) {
118                    if (o instanceof StormInfo) {
119                            StormInfo that = (StormInfo) o;
120                            if (startTime.getValue() < that.startTime.getValue()) {
121                                    return -1;
122                            }
123                            if (startTime.getValue() > that.startTime.getValue()) {
124                                    return 1;
125                            }
126                            return 0;
127                    }
128                    return toString().compareTo(o.toString());
129            }
130    
131            /**
132             * _more_
133             * 
134             * @param id
135             *            _more_
136             */
137            public void setStormId(String id) {
138                    this.stormID = id;
139            }
140    
141            /**
142             * _more_
143             * 
144             * @return _more_
145             */
146            public String getStormId() {
147                    return stormID;
148            }
149    
150            /**
151             * _more_
152             * 
153             * @param dt
154             *            _more_
155             */
156            public void setStartTime(DateTime dt) {
157                    this.startTime = dt;
158            }
159    
160            /**
161             * _more_
162             * 
163             * @return _more_
164             */
165            public DateTime getStartTime() {
166                    return startTime;
167            }
168    
169            /**
170             * _more_
171             * 
172             * @return _more_
173             */
174            public String toString() {
175                    if (name != null) {
176                            return name;
177                    }
178                    return stormID;
179            }
180    
181            /**
182             * _more_
183             * 
184             * @return _more_
185             */
186            public int hashCode() {
187                    return stormID.hashCode();
188            }
189    
190            /**
191             * _more_
192             * 
193             * @param o
194             *            _more_
195             * 
196             * @return _more_
197             */
198            public boolean equals(Object o) {
199                    if (o == null) {
200                            return false;
201                    }
202                    if (!(o instanceof StormInfo)) {
203                            return false;
204                    }
205                    StormInfo other = (StormInfo) o;
206                    return (this.stormID.equals(other.stormID));
207            }
208    
209            /**
210             * Set the Name property.
211             * 
212             * @param value
213             *            The new value for Name
214             */
215            public void setName(String value) {
216                    name = value;
217            }
218    
219            /**
220             * Get the Name property.
221             * 
222             * @return The Name
223             */
224            public String getName() {
225                    return name;
226            }
227    
228            /**
229             * Set the Basin property.
230             * 
231             * @param value
232             *            The new value for Basin
233             */
234            public void setBasin(String value) {
235                    basin = value;
236            }
237    
238            /**
239             * Get the Basin property.
240             * 
241             * @return The Basin
242             */
243            public String getBasin() {
244                    return basin;
245            }
246    
247            /**
248             * Set the Number property.
249             * 
250             * @param value
251             *            The new value for Number
252             */
253            public void setNumber(String value) {
254                    number = value;
255            }
256    
257            /**
258             * Get the Number property.
259             * 
260             * @return The Number
261             */
262            public String getNumber() {
263                    return number;
264            }
265    
266    }