code: public int compare(final Version other) throws IncomparableException{
  		// Cannot compare branch versions and others 
  		if(!isBranch().equals(other.isBranch())){
  			throw new IncomparableException();
  		}
  		
  		// Compare digits
  		final int minDigitSize = getDigitsSize() < other.getDigitsSize()? getDigitsSize(): other.getDigitsSize();
  		
  		for(int i = 0; i < minDigitSize ; i++){
  			if(!getDigit(i).equals(other.getDigit(i))){
  				return getDigit(i).compareTo(other.getDigit(i));
  			}
  		}
  		
  		// If not the same number of digits and the first digits are equals, the longest is the newer
  		if(!getDigitsSize().equals(other.getDigitsSize())){
  			return getDigitsSize() > other.getDigitsSize()? 1: -1;
  		}
  
          if(isBranch() && !getBranchId().equals(other.getBranchId())){
  			return getBranchId().compareTo(other.getBranchId());
  		}
  		
  		// if the digits are the same, a snapshot is newer than a release
  		if(isSnapshot() && other.isRelease()){
  			return 1;
  		}
  		
  		if(isRelease() && other.isSnapshot()){
  			return -1;
  		}
  		
  		// if both versions are releases, compare the releaseID
  		if(isRelease() && other.isRelease()){
  			return getReleaseId().compareTo(other.getReleaseId());
  		}
  		
  		return 0;
  	}
docs: Compare two versions
  
  @param other
  @return an integer: 0 if equals, -1 if older, 1 if newer
  @throws IncomparableException is thrown when two versions are not coparable