Rev 255 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
206 | ligi | 1 | /************************************ |
2 | * |
||
3 | * class representing the MK-Version |
||
4 | * Author: Marcus -LiGi- Bueschleb |
||
5 | * Project-Start: 9/2007 * |
||
6 | * |
||
7 | * see README for further Infos |
||
8 | * |
||
9 | ****************************************/ |
||
10 | package org.ligi.ufo; |
||
11 | |||
12 | public class MKVersion |
||
13 | |||
14 | { |
||
15 | public int major=-1; |
||
16 | public int minor=-1; |
||
255 | ligi | 17 | public int proto_major=-1; |
18 | public int proto_minor=-1; |
||
19 | public int patch=-1; |
||
20 | |||
21 | public String version_str=""; |
||
22 | public String proto_str=""; |
||
266 | ligi | 23 | |
24 | public void reset() |
||
25 | { |
||
26 | major=-1; |
||
27 | minor=-1; |
||
28 | proto_major=-1; |
||
29 | proto_minor=-1; |
||
30 | patch=-1; |
||
31 | |||
32 | version_str=""; |
||
33 | proto_str=""; |
||
34 | } |
||
206 | ligi | 35 | |
36 | |||
37 | // version known? |
||
38 | public boolean known=false; |
||
39 | |||
40 | public final byte VERSION_AFTER=0; |
||
41 | public final byte VERSION_EQUAL=1; |
||
42 | public final byte VERSION_PREVIOUS=2; |
||
43 | |||
44 | |||
45 | public void set_by_mk_data(int[] data) |
||
46 | { |
||
47 | major=data[0]; |
||
48 | minor=data[1]; |
||
255 | ligi | 49 | proto_major=data[2]; |
50 | proto_minor=data[3]; |
||
51 | patch=data[4]; |
||
52 | |||
53 | version_str="v"+major+"."+minor + (char)('a'+patch); |
||
54 | |||
55 | proto_str="v"+proto_major+"."+proto_minor ; |
||
206 | ligi | 56 | known=true; |
57 | } |
||
58 | |||
59 | public byte compare(int major_c,int minor_c) |
||
60 | { |
||
61 | if ((major_c==major)&&(minor_c==minor)) |
||
62 | return VERSION_EQUAL; |
||
63 | // TODO - compare major - PC-COMPATIBLE |
||
64 | else if (minor_c>minor) return VERSION_AFTER; |
||
65 | return VERSION_PREVIOUS; |
||
66 | |||
67 | } |
||
68 | |||
69 | } |