Subversion Repositories Projects

Rev

Rev 206 | Go to most recent revision | 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="";
206 ligi 23
 
24
 
25
    // version known?
26
    public boolean known=false;
27
 
28
    public final byte VERSION_AFTER=0;
29
    public final byte VERSION_EQUAL=1;
30
    public final byte VERSION_PREVIOUS=2;
31
 
32
 
33
    public void set_by_mk_data(int[] data)
34
    {
35
        major=data[0];
36
        minor=data[1];
255 ligi 37
        proto_major=data[2];
38
        proto_minor=data[3];
39
        patch=data[4];
40
 
41
        version_str="v"+major+"."+minor + (char)('a'+patch);
42
 
43
        proto_str="v"+proto_major+"."+proto_minor ;
206 ligi 44
        known=true;
45
    }
46
 
47
    public byte compare(int major_c,int minor_c)
48
    {
49
        if ((major_c==major)&&(minor_c==minor))
50
            return VERSION_EQUAL;
51
        // TODO - compare major - PC-COMPATIBLE
52
        else if (minor_c>minor) return VERSION_AFTER;
53
        return VERSION_PREVIOUS;
54
 
55
    }
56
 
57
}