# Class: com.pnfsoftware.jeb.core.Version

Version number object. The syntax is as follows: `major.minor.buildid.timestamp.channel` or `major.minor-channelString.buildid.timestamp`. 

 Details:
 \- A valid version string must contain the fields `major`, `minor` and `buildid`
 \- Timestamp format: `YYYYMMDDhhmm`
 \- Allowed channels: `RELEASE(0,"")`, `BETA(1,"beta")`, `ALPHA(2,"alpha")`
 

 Examples of valid version strings:  

```

 1.0.0
 1.0.2.201801021400
 1.0.2.201801021400.0
 1.0.2.201801021400.1
 1.0.2.201801021400.2
 1.2.123
 1.2-beta.123
 1.2-alpha.123
 1.2-beta.123.201807140000
 
```
  Version objects can be persisted.

## Constructor: Version
- parameter: `v`, type: `com.pnfsoftware.jeb.core.Version`

Description: Copy constructor.
parameter: v: a version object

## Constructor: Version
- parameter: `major`, type: `int`
- parameter: `minor`, type: `int`

Description: Create a new version object "major.minor.0.0".
parameter: major: zero or positive number
parameter: minor: zero or positive number

## Constructor: Version
- parameter: `major`, type: `int`
- parameter: `minor`, type: `int`
- parameter: `buildid`, type: `int`

Description: Create a new version object "major.minor.buildid.0".
parameter: major: zero or positive number
parameter: minor: zero or positive number
parameter: buildid: zero or positive number

## Constructor: Version
- parameter: `major`, type: `int`
- parameter: `minor`, type: `int`
- parameter: `buildid`, type: `int`
- parameter: `timestamp`, type: `long`

Description: Create a new version object "major.minor.buildid.timestamp".
parameter: major: zero or positive number
parameter: minor: zero or positive number
parameter: buildid: zero or positive number
parameter: timestamp: zero or positive number

## Constructor: Version
- parameter: `major`, type: `int`
- parameter: `minor`, type: `int`
- parameter: `buildid`, type: `int`
- parameter: `timestamp`, type: `long`
- parameter: `channel`, type: `int`

Description: Create a new version object "major.minor.buildid.timestamp".
parameter: major: zero or positive number
parameter: minor: zero or positive number
parameter: buildid: zero or positive number
parameter: timestamp: zero or positive number
parameter: channel: optional; 0=release, 1=beta, 2=alpha

## Static Field: ALPHA
Type: `int`

Constant value: `2`

## Static Field: BETA
Type: `int`

Constant value: `1`

## Static Field: CHANNEL_MOST_UNSTABLE
Type: `int`

Constant value: `2`

## Static Field: CHANNEL_STABLE
Type: `int`

Constant value: `0`

## Static Field: RELEASE
Type: `int`

Constant value: `0`

## Method: compareTo
- parameter: `o`, type: `com.pnfsoftware.jeb.core.Version`
- return type: `int`


## Method: compareToIgnoreChannel
- parameter: `o`, type: `com.pnfsoftware.jeb.core.Version`
- return type: `int`


## Method: compareToIgnoreTimestamp
- parameter: `o`, type: `com.pnfsoftware.jeb.core.Version`
- return type: `int`


## Method: compareToIgnoreTimestampAndChannel
- parameter: `o`, type: `com.pnfsoftware.jeb.core.Version`
- return type: `int`


## Method: equals
- parameter: `obj`, type: `java.lang.Object`
- return type: `boolean`


## Method: format
- parameter: `useChannelString`, type: `boolean`
- return type: `java.lang.String`

Description: 
parameter: useChannelString: true to format the channel \(if present\) as a string appended to the            Minor version number; else, the channel value, if non 0, will be appended to the            version Timestamp
return: 

## Method: formatCompact
- return type: `java.lang.String`


## Method: getBuildid
- return type: `int`

Description: Get the build id number.
return: 

## Method: getChannel
- return type: `int`

Description: Get the channel.
return: 

## Method: getChannelString
- return type: `java.lang.String`


## Method: getMajor
- return type: `int`

Description: Get the major number.
return: 

## Method: getMinor
- return type: `int`

Description: Get the minor number.
return: 

## Method: getTimestamp
- return type: `long`

Description: Get the timestamp.
return: 

## Method: hashCode
- return type: `int`


## Method: like
- parameter: `major`, type: `int`
- return type: `boolean`

Description: Determine if the version is like "major.?.?.?"
parameter: major: 
return: 

## Method: like
- parameter: `major`, type: `int`
- parameter: `minor`, type: `int`
- return type: `boolean`

Description: Determine if the version is like "major.minor.?.?"
parameter: major: 
parameter: minor: 
return: 

## Method: like
- parameter: `major`, type: `int`
- parameter: `minor`, type: `int`
- parameter: `buildid`, type: `int`
- return type: `boolean`

Description: Determine if the version is like "major.minor.buildid.?"
parameter: major: 
parameter: minor: 
parameter: buildid: 
return: 

## Method: setBuildid
- parameter: `buildid`, type: `int`


## Method: setChannel
- parameter: `channel`, type: `int`


## Method: setMajor
- parameter: `major`, type: `int`


## Method: setMinor
- parameter: `minor`, type: `int`


## Method: setTimestamp
- parameter: `timestamp`, type: `long`


## Method: toInt
- return type: `int`

Description: Generate a 4\-byte integer representing the three most relevant components of this version object. The resulting int is as such: {00AABBCC} where AA=[#getMajor()](#getMajor()), BB=[#getMinor()](#getMinor()), CC=[#getBuildid()](#getBuildid()). If any of AA, BB, CC exceeds 255, it is truncated to 255.
return: a version\-int

## Method: toString
- return type: `java.lang.String`

Description: Same as [format\(true\)](#format(boolean)).

## Static Method: create
- parameter: `major`, type: `int`
- parameter: `minor`, type: `int`
- return type: `com.pnfsoftware.jeb.core.Version`

Description: Static builder, equivalent of [#Version(int, int)](#Version(int, int)).
parameter: major: 
parameter: minor: 
return: 

## Static Method: create
- parameter: `major`, type: `int`
- parameter: `minor`, type: `int`
- parameter: `buildid`, type: `int`
- return type: `com.pnfsoftware.jeb.core.Version`

Description: Static builder, equivalent of [#Version(int, int, int)](#Version(int, int, int)).
parameter: major: 
parameter: minor: 
parameter: buildid: 
return: 

## Static Method: create
- parameter: `major`, type: `int`
- parameter: `minor`, type: `int`
- parameter: `buildid`, type: `int`
- parameter: `timestamp`, type: `long`
- return type: `com.pnfsoftware.jeb.core.Version`

Description: Static builder, equivalent of [#Version(int, int, int, long)](#Version(int, int, int, long)).
parameter: major: 
parameter: minor: 
parameter: buildid: 
parameter: timestamp: 
return: 

## Static Method: create
- parameter: `major`, type: `int`
- parameter: `minor`, type: `int`
- parameter: `buildid`, type: `int`
- parameter: `timestamp`, type: `long`
- parameter: `channel`, type: `int`
- return type: `com.pnfsoftware.jeb.core.Version`

Description: Static builder, equivalent of [#Version(int, int, int, long, int)](#Version(int, int, int, long, int)).
parameter: major: 
parameter: minor: 
parameter: buildid: 
parameter: timestamp: 
parameter: channel: 
return: 

## Static Method: fromInt
- parameter: `val`, type: `int`
- return type: `com.pnfsoftware.jeb.core.Version`

Description: Create a version object from an integer generated by [#toInt()](#toInt()).
parameter: val: a version\-int, as generated by [#toInt()](#toInt())
return: a version Object

## Static Method: getChannelInfo
- parameter: `channel`, type: `int`
- return type: `java.lang.String`


## Static Method: getChannelName
- parameter: `channel`, type: `int`
- return type: `java.lang.String`


## Static Method: getChannelNames
- return type: `java.lang.String[]`


## Static Method: parseFromFile
- parameter: `f`, type: `java.io.File`
- return type: `com.pnfsoftware.jeb.core.Version`

Description: Read a file which should contain a single string containing a version number.
parameter: f: a file
return: the version object, null on error

## Static Method: parseFromString
- parameter: `s`, type: `java.lang.String`
- return type: `com.pnfsoftware.jeb.core.Version`

Description: Parse a version string into a Version object.
parameter: s: a string
return: a version object, null on error

