Coverage report

  %line %branch
mnemosyne.core.LongVersion
100% 
100% 

 1  
 /*
 2  
  * Copyright 2004 Charles Blaxland
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package mnemosyne.core;
 17  
 
 18  
 
 19  
 /**
 20  
  * An implmentation of the Version interface based on a Java long.
 21  
  * Provides enough capacity for most systems, especially if seeded at
 22  
  * Long.MIN_VALUE.
 23  
  *
 24  
  * This object is immutable.
 25  
  *
 26  
  * @version $Id: LongVersion.java,v 1.1.1.1 2004/08/07 06:41:02 charlesblaxland Exp $
 27  
  */
 28  
 public class LongVersion implements Version
 29  
 {
 30  
     private long value;
 31  
 
 32  
     public LongVersion(long value)
 33  69
     {
 34  69
         this.value = value;
 35  69
     }
 36  
 
 37  
     public final Version getNext()
 38  
     {
 39  4
         return new LongVersion(value + 1);
 40  
     }
 41  
 
 42  
     public final int compareTo(Object o)
 43  
     {
 44  56
         LongVersion other = (LongVersion) o;
 45  56
         if (this.value > other.value)
 46  16
             return 1;
 47  40
         else if (this.value < other.value)
 48  13
             return -1;
 49  
 
 50  27
         return 0;
 51  
     }
 52  
 
 53  
     public final int hashCode()
 54  
     {
 55  3
         return (int) value;
 56  
     }
 57  
 
 58  
     public final boolean equals(Object obj)
 59  
     {
 60  15
         return obj instanceof LongVersion && this.value == ((LongVersion) obj).value;
 61  
     }
 62  
 
 63  
     public final String toString()
 64  
     {
 65  9
         return Long.toString(value);
 66  
     }
 67  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.