bibliothek.util
Class Version

java.lang.Object
  extended by bibliothek.util.Version
All Implemented Interfaces:
java.lang.Comparable<Version>

public final class Version
extends java.lang.Object
implements java.lang.Comparable<Version>

A version represents a version of this library.

Author:
Benjamin Sigg

Field Summary
static Version CURRENT
          The current version of this library.
static Version VERSION_1_0_4
          the version 1.0.4
static Version VERSION_1_0_5
          the version 1.0.5
static Version VERSION_1_0_6
          the version 1.0.6
static Version VERSION_1_0_7
          the version 1.0.7
static Version VERSION_1_0_8
          the version 1.0.8
static Version VERSION_1_0_8a
          the version 1.0.8 (since preview 4)
static Version VERSION_1_1_0
          the version 1.1.0
static Version VERSION_1_1_0a
          the version 1.1.0 (since preview 5)
 
Constructor Summary
Version(int major, int minor, int mikro, java.lang.String add)
          Creates a new version
 
Method Summary
 void checkCurrent()
          Checks whether this version is greater than the current version and throws an exception if so.
 int compareTo(Version o)
           
 boolean equals(java.lang.Object obj)
           
 java.lang.String getAdd()
          Gets the additional information
 int getMajor()
          Gets the major number.
 int getMikro()
          Gets the mikro number
 int getMinor()
          Gets the minor number
 int hashCode()
           
static Version read(java.io.DataInputStream in)
          Reads a version that was stored earlier.
 java.lang.String toString()
           
static void write(java.io.DataOutputStream out, Version version)
          Writes the contents of a version.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

VERSION_1_0_4

public static final Version VERSION_1_0_4
the version 1.0.4


VERSION_1_0_5

public static final Version VERSION_1_0_5
the version 1.0.5


VERSION_1_0_6

public static final Version VERSION_1_0_6
the version 1.0.6


VERSION_1_0_7

public static final Version VERSION_1_0_7
the version 1.0.7


VERSION_1_0_8

public static final Version VERSION_1_0_8
the version 1.0.8


VERSION_1_0_8a

public static final Version VERSION_1_0_8a
the version 1.0.8 (since preview 4)


VERSION_1_1_0

public static final Version VERSION_1_1_0
the version 1.1.0


VERSION_1_1_0a

public static final Version VERSION_1_1_0a
the version 1.1.0 (since preview 5)


CURRENT

public static final Version CURRENT
The current version of this library. This constant will be changed for every release.

Constructor Detail

Version

public Version(int major,
               int minor,
               int mikro,
               java.lang.String add)
Creates a new version

Parameters:
major - the major version
minor - the minor version
mikro - the mikro version
add - additional comment, null will be replaced by the empty string
Method Detail

write

public static void write(java.io.DataOutputStream out,
                         Version version)
                  throws java.io.IOException
Writes the contents of a version.

Parameters:
out - the stream to write into
version - the version to write
Throws:
java.io.IOException - if an error occurs

read

public static Version read(java.io.DataInputStream in)
                    throws java.io.IOException
Reads a version that was stored earlier.

Parameters:
in - the stream to read from
Returns:
the new version
Throws:
java.io.IOException - if an error occurs or the format is unknown

checkCurrent

public void checkCurrent()
                  throws java.io.IOException
Checks whether this version is greater than the current version and throws an exception if so. This method is intended to be called from code that is loading some file, but other usages are possible as well.

Throws:
java.io.IOException - thrown if the current version is smaller than this.

getAdd

public java.lang.String getAdd()
Gets the additional information

Returns:
the additional information, can be an empty string

getMajor

public int getMajor()
Gets the major number.

Returns:
the major

getMikro

public int getMikro()
Gets the mikro number

Returns:
the mikro

getMinor

public int getMinor()
Gets the minor number

Returns:
the minor

compareTo

public int compareTo(Version o)
Specified by:
compareTo in interface java.lang.Comparable<Version>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object