|
14 | 14 | public class VersionUtils
|
15 | 15 | {
|
16 | 16 |
|
17 |
| - public static int[] splitVersion( String version, int size ) |
| 17 | + public static boolean isMaxVersionOK( int[] fdkVersion, int[] maxVersion ) |
18 | 18 | {
|
19 |
| - int[] versions = splitVersion( version ); |
| 19 | + return isVersionOK( maxVersion, fdkVersion ); |
| 20 | + } |
20 | 21 |
|
21 |
| - if ( versions.length != size ) |
| 22 | + public static boolean isMaxVersionOK( String fdkVersion, String maxVersion ) |
| 23 | + { |
| 24 | + return isMaxVersionOK( splitVersion( fdkVersion ), splitVersion( maxVersion ) ); |
| 25 | + } |
| 26 | + |
| 27 | + public static boolean isMinVersionOK( int[] fdkVersion, int[] minVersion ) |
| 28 | + { |
| 29 | + return isVersionOK( fdkVersion, minVersion ); |
| 30 | + } |
| 31 | + |
| 32 | + public static boolean isMinVersionOK( String fdkVersion, String minVersion ) |
| 33 | + { |
| 34 | + return isVersionOK( splitVersion( fdkVersion ), splitVersion( minVersion ) ); |
| 35 | + } |
| 36 | + |
| 37 | + private static boolean isVersionOK( int[] fdkVersion, int[] minVersion ) |
| 38 | + { |
| 39 | + int lenght = min( fdkVersion.length, minVersion.length ); |
| 40 | + |
| 41 | + int result = 0; |
| 42 | + for ( int i = 0; i < lenght; i++ ) |
22 | 43 | {
|
23 |
| - int[] temp = new int[size]; |
24 |
| - Arrays.fill( temp, 0 ); |
25 |
| - System.arraycopy( versions, 0, temp, 0, Math.min( versions.length, size ) ); |
26 |
| - versions = temp; |
| 44 | + result = fdkVersion[i] - minVersion[i]; |
| 45 | + if ( result != 0 ) |
| 46 | + { |
| 47 | + return result > -1; |
| 48 | + } |
27 | 49 | }
|
28 | 50 |
|
29 |
| - return versions; |
| 51 | + return result > -1; |
30 | 52 | }
|
31 | 53 |
|
32 | 54 | public static int[] splitVersion( String version )
|
@@ -60,31 +82,19 @@ public static int[] splitVersion( String version )
|
60 | 82 | return versions;
|
61 | 83 | }
|
62 | 84 |
|
63 |
| - public static boolean isMinVersionOK( int[] fdkVersion, int[] minVersion ) |
64 |
| - { |
65 |
| - return isVersionOK( fdkVersion, minVersion ); |
66 |
| - } |
67 |
| - |
68 |
| - public static boolean isMaxVersionOK( int[] fdkVersion, int[] maxVersion ) |
69 |
| - { |
70 |
| - return isVersionOK( maxVersion, fdkVersion ); |
71 |
| - } |
72 |
| - |
73 |
| - private static boolean isVersionOK( int[] fdkVersion, int[] minVersion ) |
| 85 | + public static int[] splitVersion( String version, int size ) |
74 | 86 | {
|
75 |
| - int lenght = min( fdkVersion.length, minVersion.length ); |
| 87 | + int[] versions = splitVersion( version ); |
76 | 88 |
|
77 |
| - int result = 0; |
78 |
| - for ( int i = 0; i < lenght; i++ ) |
| 89 | + if ( versions.length != size ) |
79 | 90 | {
|
80 |
| - result = fdkVersion[i] - minVersion[i]; |
81 |
| - if ( result != 0 ) |
82 |
| - { |
83 |
| - return result > -1; |
84 |
| - } |
| 91 | + int[] temp = new int[size]; |
| 92 | + Arrays.fill( temp, 0 ); |
| 93 | + System.arraycopy( versions, 0, temp, 0, Math.min( versions.length, size ) ); |
| 94 | + versions = temp; |
85 | 95 | }
|
86 | 96 |
|
87 |
| - return result > -1; |
| 97 | + return versions; |
88 | 98 | }
|
89 | 99 |
|
90 | 100 | }
|
0 commit comments