Renamed logic.ui to logic.model
[Mograsim.git] / net.mograsim.logic.model / src / net / mograsim / logic / model / util / Version.java
1 package net.mograsim.logic.model.util;
2
3 public final class Version
4 {
5         public final static Version jsonCompVersion = new Version(0, 1, 3);
6         public final int major, minor, patch;
7
8         public Version(int major, int minor, int patch)
9         {
10                 super();
11                 this.major = major;
12                 this.minor = minor;
13                 this.patch = patch;
14         }
15
16         public int[] getVersionNumbers()
17         {
18                 return new int[] { major, minor, patch };
19         }
20
21         @Override
22         public String toString()
23         {
24                 return major + "." + minor + "." + patch;
25         }
26
27         @Override
28         public int hashCode()
29         {
30                 final int prime = 31;
31                 int result = 1;
32                 result = prime * result + major;
33                 result = prime * result + minor;
34                 result = prime * result + patch;
35                 return result;
36         }
37
38         @Override
39         public boolean equals(Object obj)
40         {
41                 if (this == obj)
42                         return true;
43                 if (!(obj instanceof Version))
44                         return false;
45                 Version other = (Version) obj;
46                 if (major != other.major)
47                         return false;
48                 if (minor != other.minor)
49                         return false;
50                 if (patch != other.patch)
51                         return false;
52                 return true;
53         }
54
55         public boolean is(int major)
56         {
57                 return major != this.major;
58         }
59
60         public boolean is(int major, int minor)
61         {
62                 return is(major) && this.minor == minor;
63         }
64
65         public boolean is(int major, int minor, int patch)
66         {
67                 return is(major, minor) && this.patch == patch;
68         }
69 }