001 /*
002 * $Id: Way.java,v 1.1 2012/01/04 20:40:52 tommyj Exp $
003 *
004 * This file is part of McIDAS-V
005 *
006 * Copyright 2007-2012
007 * Space Science and Engineering Center (SSEC)
008 * University of Wisconsin - Madison
009 * 1225 W. Dayton Street, Madison, WI 53706, USA
010 * https://www.ssec.wisc.edu/mcidas
011 *
012 * All Rights Reserved
013 *
014 * McIDAS-V is built on Unidata's IDV and SSEC's VisAD libraries, and
015 * some McIDAS-V source code is based on IDV and VisAD source code.
016 *
017 * McIDAS-V is free software; you can redistribute it and/or modify
018 * it under the terms of the GNU Lesser Public License as published by
019 * the Free Software Foundation; either version 3 of the License, or
020 * (at your option) any later version.
021 *
022 * McIDAS-V is distributed in the hope that it will be useful,
023 * but WITHOUT ANY WARRANTY; without even the implied warranty of
024 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
025 * GNU Lesser Public License for more details.
026 *
027 * You should have received a copy of the GNU Lesser Public License
028 * along with this program. If not, see http://www.gnu.org/licenses.
029 */
030
031 package edu.wisc.ssec.mcidasv.data.cyclone;
032
033 /**
034 * Created by IntelliJ IDEA. User: yuanho Date: Apr 9, 2008 Time: 4:57:38 PM To
035 * change this template use File | Settings | File Templates.
036 */
037
038 public class Way implements Comparable {
039
040 /** _more_ */
041 public static final Way OBSERVATION = new Way("Observation");
042
043 /** _more_ */
044 private String id;
045
046 /** _more_ */
047 private String name;
048
049 /**
050 * _more_
051 */
052 public Way() {
053 }
054
055 /**
056 * _more_
057 *
058 * @param id
059 * _more_
060 */
061 public Way(String id) {
062 this.id = id;
063 }
064
065 /**
066 * _more_
067 *
068 * @param id
069 * _more_
070 * @param name
071 * _more_
072 */
073 public Way(String id, String name) {
074 this.id = id;
075 this.name = name;
076 }
077
078 /**
079 * _more_
080 *
081 * @return _more_
082 */
083 public boolean isObservation() {
084 return this.equals(OBSERVATION);
085 }
086
087 /**
088 * _more_
089 *
090 * @param id
091 * _more_
092 */
093 public void setId(String id) {
094 this.id = id;
095 }
096
097 /**
098 * _more_
099 *
100 * @return _more_
101 */
102 public String getId() {
103 return id;
104 }
105
106 /**
107 * _more_
108 *
109 * @return _more_
110 */
111 public String toString() {
112 if (name != null) {
113 return id + ": " + name;
114 }
115 return id;
116 }
117
118 /**
119 * _more_
120 *
121 * @return _more_
122 */
123 public int hashCode() {
124 return id.hashCode();
125 }
126
127 /**
128 * _more_
129 *
130 * @param o
131 * _more_
132 *
133 * @return _more_
134 */
135 public boolean equals(Object o) {
136 if (o == null) {
137 return false;
138 }
139 if (!(o instanceof Way)) {
140 return false;
141 }
142 Way other = (Way) o;
143
144 return (this.id.equals(other.id));
145 }
146
147 /**
148 * Set the Name property.
149 *
150 * @param value
151 * The new value for Name
152 */
153 public void setName(String value) {
154 name = value;
155 }
156
157 /**
158 * Get the Name property.
159 *
160 * @return The Name
161 */
162 public String getName() {
163 return name;
164 }
165
166 /**
167 * _more_
168 *
169 * @param o
170 * _more_
171 *
172 * @return _more_
173 */
174 public int compareTo(Object o) {
175 if (o instanceof Way) {
176 Way that = (Way) o;
177 return this.id.toLowerCase().compareTo(that.id.toLowerCase());
178 }
179 return toString().compareTo(o.toString());
180 }
181
182 }