122 // checks if it is in the hashmap
123 // else
124 if (major < 0 || major > 255 || minor < 0 || minor > 255 ||
125 milli < 0 || milli > 255 || micro < 0 || micro > 255) {
126 throw new IllegalArgumentException(INVALID_VERSION_NUMBER_);
127 }
128 int version = getInt(major, minor, milli, micro);
129 Integer key = Integer.valueOf(version);
130 Object result = MAP_.get(key);
131 if (result == null) {
132 result = new VersionInfo(version);
133 MAP_.put(key, result);
134 }
135 return (VersionInfo)result;
136 }
137
138 /**
139 * Compares other with this VersionInfo.
140 * @param other VersionInfo to be compared
141 * @return 0 if the argument is a VersionInfo object that has version
142 * information equals to this object.
143 * Less than 0 if the argument is a VersionInfo object that has
144 * version information greater than this object.
145 * Greater than 0 if the argument is a VersionInfo object that
146 * has version information less than this object.
147 * @stable ICU 2.6
148 */
149 public int compareTo(VersionInfo other)
150 {
151 return m_version_ - other.m_version_;
152 }
153
154 // private data members ----------------------------------------------
155
156 /**
157 * Version number stored as a byte for each of the major, minor, milli and
158 * micro numbers in the 32 bit int.
159 * Most significant for the major and the least significant contains the
160 * micro numbers.
161 */
162 private int m_version_;
|
122 // checks if it is in the hashmap
123 // else
124 if (major < 0 || major > 255 || minor < 0 || minor > 255 ||
125 milli < 0 || milli > 255 || micro < 0 || micro > 255) {
126 throw new IllegalArgumentException(INVALID_VERSION_NUMBER_);
127 }
128 int version = getInt(major, minor, milli, micro);
129 Integer key = Integer.valueOf(version);
130 Object result = MAP_.get(key);
131 if (result == null) {
132 result = new VersionInfo(version);
133 MAP_.put(key, result);
134 }
135 return (VersionInfo)result;
136 }
137
138 /**
139 * Compares other with this VersionInfo.
140 * @param other VersionInfo to be compared
141 * @return 0 if the argument is a VersionInfo object that has version
142 * information equal to this object.
143 * Less than 0 if the argument is a VersionInfo object that has
144 * version information greater than this object.
145 * Greater than 0 if the argument is a VersionInfo object that
146 * has version information less than this object.
147 * @stable ICU 2.6
148 */
149 public int compareTo(VersionInfo other)
150 {
151 return m_version_ - other.m_version_;
152 }
153
154 // private data members ----------------------------------------------
155
156 /**
157 * Version number stored as a byte for each of the major, minor, milli and
158 * micro numbers in the 32 bit int.
159 * Most significant for the major and the least significant contains the
160 * micro numbers.
161 */
162 private int m_version_;
|