Clover coverage report - Code Coverage for hivemind release 1.0-beta-2
Coverage timestamp: Sun Aug 1 2004 14:03:45 EDT
file stats: LOC: 109   Methods: 9
NCLOC: 68   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
LocationImpl.java 83.3% 96.4% 100% 93.9%
coverage coverage
 1   
 //  Copyright 2004 The Apache Software Foundation
 2   
 //
 3   
 // Licensed under the Apache License, Version 2.0 (the "License");
 4   
 // you may not use this file except in compliance with the License.
 5   
 // You may obtain a copy of the License at
 6   
 //
 7   
 //     http://www.apache.org/licenses/LICENSE-2.0
 8   
 //
 9   
 // Unless required by applicable law or agreed to in writing, software
 10   
 // distributed under the License is distributed on an "AS IS" BASIS,
 11   
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12   
 // See the License for the specific language governing permissions and
 13   
 // limitations under the License.
 14   
 
 15   
 package org.apache.hivemind.impl;
 16   
 
 17   
 import org.apache.hivemind.Location;
 18   
 import org.apache.hivemind.Resource;
 19   
 
 20   
 /**
 21   
  * Implementation of the {@link org.apache.hivemind.Location} interface.
 22   
  *
 23   
  * @author Howard Lewis Ship
 24   
  */
 25   
 public final class LocationImpl implements Location
 26   
 {
 27   
     private Resource _resource;
 28   
     private int _lineNumber = -1;
 29   
     private int _columnNumber = -1;
 30   
 
 31  25873
     public LocationImpl(Resource resource)
 32   
     {
 33  25873
         _resource = resource;
 34   
     }
 35   
 
 36  23
     public LocationImpl(Resource resource, int lineNumber)
 37   
     {
 38  23
         this(resource);
 39   
 
 40  23
         _lineNumber = lineNumber;
 41   
     }
 42   
 
 43  25838
     public LocationImpl(Resource resource, int lineNumber, int columnNumber)
 44   
     {
 45  25838
         this(resource);
 46   
 
 47  25838
         _lineNumber = lineNumber;
 48  25838
         _columnNumber = columnNumber;
 49   
     }
 50   
 
 51  19
     public Resource getResource()
 52   
     {
 53  19
         return _resource;
 54   
     }
 55   
 
 56  21
     public int getLineNumber()
 57   
     {
 58  21
         return _lineNumber;
 59   
     }
 60   
 
 61  17
     public int getColumnNumber()
 62   
     {
 63  17
         return _columnNumber;
 64   
     }
 65   
 
 66  6
     public int hashCode()
 67   
     {
 68  6
         return ((237 + _resource.hashCode()) << 3 + _lineNumber) << 3 + _columnNumber;
 69   
     }
 70   
 
 71  16
     public boolean equals(Object other)
 72   
     {
 73  16
         if (!(other instanceof Location))
 74  0
             return false;
 75   
 
 76  16
         Location l = (Location) other;
 77   
 
 78  16
         if (_lineNumber != l.getLineNumber())
 79  3
             return false;
 80   
 
 81  13
         if (_columnNumber != l.getColumnNumber())
 82  2
             return false;
 83   
 
 84  11
         return _resource.equals(l.getResource());
 85   
     }
 86   
 
 87  44
     public String toString()
 88   
     {
 89  44
         if (_lineNumber <= 0 && _columnNumber <= 0)
 90  1
             return _resource.toString();
 91   
 
 92  43
         StringBuffer buffer = new StringBuffer(_resource.toString());
 93   
 
 94  43
         if (_lineNumber > 0)
 95   
         {
 96  43
             buffer.append(", line ");
 97  43
             buffer.append(_lineNumber);
 98   
         }
 99   
 
 100  43
         if (_columnNumber > 0)
 101   
         {
 102  29
             buffer.append(", column ");
 103  29
             buffer.append(_columnNumber);
 104   
         }
 105   
 
 106  43
         return buffer.toString();
 107   
     }
 108   
 }
 109