VersionInfo.java
5.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.agl.util;
import java.util.HashMap;
public final class VersionInfo {
public static final VersionInfo UNICODE_1_0;
public static final VersionInfo UNICODE_1_0_1;
public static final VersionInfo UNICODE_1_1_0;
public static final VersionInfo UNICODE_1_1_5;
public static final VersionInfo UNICODE_2_0;
public static final VersionInfo UNICODE_2_1_2;
public static final VersionInfo UNICODE_2_1_5;
public static final VersionInfo UNICODE_2_1_8;
public static final VersionInfo UNICODE_2_1_9;
public static final VersionInfo UNICODE_3_0;
public static final VersionInfo UNICODE_3_0_1;
public static final VersionInfo UNICODE_3_1_0;
public static final VersionInfo UNICODE_3_1_1;
public static final VersionInfo UNICODE_3_2;
public static final VersionInfo UNICODE_4_0;
public static final VersionInfo UNICODE_4_0_1;
public static final VersionInfo UNICODE_4_1;
public static final VersionInfo UNICODE_5_0;
public static final VersionInfo ICU_VERSION;
public static final VersionInfo UCOL_RUNTIME_VERSION;
public static final VersionInfo UCOL_BUILDER_VERSION;
public static final VersionInfo UCOL_TAILORINGS_VERSION;
private int m_version_;
private static final HashMap MAP_;
public static VersionInfo getInstance(String version) {
int index;
int length = version.length();
int[] array = new int[]{0, 0, 0, 0};
int count = 0;
for (index = 0; count < 4 && index < length; ++index) {
char c = version.charAt(index);
if (c == '.') {
++count;
continue;
}
if ((c = (char)(c - 48)) < '\u0000' || c > '\t') {
throw new IllegalArgumentException("Invalid version number: Version number may be negative or greater than 255");
}
int[] arrn = array;
int n = count;
arrn[n] = arrn[n] * 10;
int[] arrn2 = array;
int n2 = count;
arrn2[n2] = arrn2[n2] + c;
}
if (index != length) {
throw new IllegalArgumentException("Invalid version number: String '" + version + "' exceeds version format");
}
for (int i = 0; i < 4; ++i) {
if (array[i] >= 0 && array[i] <= 255) continue;
throw new IllegalArgumentException("Invalid version number: Version number may be negative or greater than 255");
}
return VersionInfo.getInstance(array[0], array[1], array[2], array[3]);
}
public static VersionInfo getInstance(int major, int minor, int milli, int micro) {
if (major < 0 || major > 255 || minor < 0 || minor > 255 || milli < 0 || milli > 255 || micro < 0 || micro > 255) {
throw new IllegalArgumentException("Invalid version number: Version number may be negative or greater than 255");
}
int version = VersionInfo.getInt(major, minor, milli, micro);
Integer key = new Integer(version);
Object result = MAP_.get(key);
if (result == null) {
result = new VersionInfo(version);
MAP_.put(key, result);
}
return (VersionInfo)result;
}
public static VersionInfo getInstance(int major) {
return VersionInfo.getInstance(major, 0, 0, 0);
}
public String toString() {
StringBuffer result = new StringBuffer(7);
result.append(this.getMajor());
result.append('.');
result.append(this.getMinor());
result.append('.');
result.append(this.getMilli());
result.append('.');
result.append(this.getMicro());
return result.toString();
}
public int getMajor() {
return this.m_version_ >> 24 & 255;
}
public int getMinor() {
return this.m_version_ >> 16 & 255;
}
public int getMilli() {
return this.m_version_ >> 8 & 255;
}
public int getMicro() {
return this.m_version_ & 255;
}
public boolean equals(Object other) {
return other == this;
}
public int compareTo(VersionInfo other) {
return this.m_version_ - other.m_version_;
}
private VersionInfo(int compactversion) {
this.m_version_ = compactversion;
}
private static int getInt(int major, int minor, int milli, int micro) {
return major << 24 | minor << 16 | milli << 8 | micro;
}
static {
MAP_ = new HashMap();
UNICODE_1_0 = VersionInfo.getInstance(1, 0, 0, 0);
UNICODE_1_0_1 = VersionInfo.getInstance(1, 0, 1, 0);
UNICODE_1_1_0 = VersionInfo.getInstance(1, 1, 0, 0);
UNICODE_1_1_5 = VersionInfo.getInstance(1, 1, 5, 0);
UNICODE_2_0 = VersionInfo.getInstance(2, 0, 0, 0);
UNICODE_2_1_2 = VersionInfo.getInstance(2, 1, 2, 0);
UNICODE_2_1_5 = VersionInfo.getInstance(2, 1, 5, 0);
UNICODE_2_1_8 = VersionInfo.getInstance(2, 1, 8, 0);
UNICODE_2_1_9 = VersionInfo.getInstance(2, 1, 9, 0);
UNICODE_3_0 = VersionInfo.getInstance(3, 0, 0, 0);
UNICODE_3_0_1 = VersionInfo.getInstance(3, 0, 1, 0);
UNICODE_3_1_0 = VersionInfo.getInstance(3, 1, 0, 0);
UNICODE_3_1_1 = VersionInfo.getInstance(3, 1, 1, 0);
UNICODE_3_2 = VersionInfo.getInstance(3, 2, 0, 0);
UNICODE_4_0 = VersionInfo.getInstance(4, 0, 0, 0);
UNICODE_4_0_1 = VersionInfo.getInstance(4, 0, 1, 0);
UNICODE_4_1 = VersionInfo.getInstance(4, 1, 0, 0);
UNICODE_5_0 = VersionInfo.getInstance(4, 1, 0, 0);
ICU_VERSION = VersionInfo.getInstance(4, 0, 0, 0);
UCOL_RUNTIME_VERSION = VersionInfo.getInstance(6);
UCOL_BUILDER_VERSION = VersionInfo.getInstance(7);
UCOL_TAILORINGS_VERSION = VersionInfo.getInstance(1);
}
}