1 /*
2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25 /*
26 *******************************************************************************
27 * (C) Copyright IBM Corp. and others, 1996-2009 - All Rights Reserved *
28 * *
29 * The original version of this source code and documentation is copyrighted *
30 * and owned by IBM, These materials are provided under terms of a License *
31 * Agreement between IBM and Sun. This technology is protected by multiple *
32 * US and International patents. This notice and attribution to IBM may not *
33 * to removed. *
34 *******************************************************************************
35 */
36
37 package sun.text.normalizer;
38
39 import java.util.HashMap;
40
41 /**
42 * Class to store version numbers of the form major.minor.milli.micro.
43 * @author synwee
44 * @stable ICU 2.6
45 */
46 public final class VersionInfo
47 {
48
49 // public methods ------------------------------------------------------
50
51 /**
52 * Returns an instance of VersionInfo with the argument version.
53 * @param version version String in the format of "major.minor.milli.micro"
54 * or "major.minor.milli" or "major.minor" or "major",
55 * where major, minor, milli, micro are non-negative numbers
56 * {@literal <=} 255. If the trailing version numbers are
57 * not specified they are taken as 0s. E.g. Version "3.1" is
58 * equivalent to "3.1.0.0".
59 * @return an instance of VersionInfo with the argument version.
60 * @exception throws an IllegalArgumentException when the argument version
61 * is not in the right format
62 * @stable ICU 2.6
63 */
64 public static VersionInfo getInstance(String version)
65 {
66 int length = version.length();
67 int array[] = {0, 0, 0, 0};
|
1 /*
2 * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25 /*
26 *******************************************************************************
27 * (C) Copyright IBM Corp. and others, 1996-2009 - All Rights Reserved *
28 * *
29 * The original version of this source code and documentation is copyrighted *
30 * and owned by IBM, These materials are provided under terms of a License *
31 * Agreement between IBM and Sun. This technology is protected by multiple *
32 * US and International patents. This notice and attribution to IBM may not *
33 * to removed. *
34 *******************************************************************************
35 */
36
37 package jdk.internal.icu.util;
38
39 import java.util.HashMap;
40
41 /**
42 * Class to store version numbers of the form major.minor.milli.micro.
43 * @author synwee
44 * @stable ICU 2.6
45 */
46 public final class VersionInfo
47 {
48 // public data members -------------------------------------------------
49
50 /**
51 * Data version string for ICU's internal data.
52 * Used for appending to data path (e.g. icudt43b)
53 * @internal
54 * @deprecated This API is ICU internal only.
55 */
56 @Deprecated
57 public static final String ICU_DATA_VERSION_PATH = "64b";
58
59 // public methods ------------------------------------------------------
60
61 /**
62 * Returns an instance of VersionInfo with the argument version.
63 * @param version version String in the format of "major.minor.milli.micro"
64 * or "major.minor.milli" or "major.minor" or "major",
65 * where major, minor, milli, micro are non-negative numbers
66 * {@literal <=} 255. If the trailing version numbers are
67 * not specified they are taken as 0s. E.g. Version "3.1" is
68 * equivalent to "3.1.0.0".
69 * @return an instance of VersionInfo with the argument version.
70 * @exception throws an IllegalArgumentException when the argument version
71 * is not in the right format
72 * @stable ICU 2.6
73 */
74 public static VersionInfo getInstance(String version)
75 {
76 int length = version.length();
77 int array[] = {0, 0, 0, 0};
|