2009/04/15 - Apache HiveMind has been retired.

For more information, please explore the Attic.

Clover coverage report - Code Coverage for hivemind release 1.2.1
Coverage timestamp: Fri Feb 10 2006 16:33:43 PST
file stats: LOC: 108   Methods: 9
NCLOC: 68   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
LocationImpl.java 83.3% 96.4% 100% 93.9%
coverage coverage
 1    // Copyright 2004, 2005 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  42160 public LocationImpl(Resource resource)
 32    {
 33  42160 _resource = resource;
 34    }
 35   
 36  52 public LocationImpl(Resource resource, int lineNumber)
 37    {
 38  52 this(resource);
 39   
 40  52 _lineNumber = lineNumber;
 41    }
 42   
 43  42096 public LocationImpl(Resource resource, int lineNumber, int columnNumber)
 44    {
 45  42096 this(resource);
 46   
 47  42096 _lineNumber = lineNumber;
 48  42096 _columnNumber = columnNumber;
 49    }
 50   
 51  37 public Resource getResource()
 52    {
 53  37 return _resource;
 54    }
 55   
 56  32 public int getLineNumber()
 57    {
 58  32 return _lineNumber;
 59    }
 60   
 61  26 public int getColumnNumber()
 62    {
 63  26 return _columnNumber;
 64    }
 65   
 66  6 public int hashCode()
 67    {
 68  6 return ((237 + _resource.hashCode()) << 3 + _lineNumber) << 3 + _columnNumber;
 69    }
 70   
 71  29 public boolean equals(Object other)
 72    {
 73  29 if (!(other instanceof Location))
 74  0 return false;
 75   
 76  29 Location l = (Location) other;
 77   
 78  29 if (_lineNumber != l.getLineNumber())
 79  5 return false;
 80   
 81  24 if (_columnNumber != l.getColumnNumber())
 82  2 return false;
 83   
 84  22 return _resource.equals(l.getResource());
 85    }
 86   
 87  65 public String toString()
 88    {
 89  65 if (_lineNumber <= 0 && _columnNumber <= 0)
 90  1 return _resource.toString();
 91   
 92  64 StringBuffer buffer = new StringBuffer(_resource.toString());
 93   
 94  64 if (_lineNumber > 0)
 95    {
 96  64 buffer.append(", line ");
 97  64 buffer.append(_lineNumber);
 98    }
 99   
 100  64 if (_columnNumber > 0)
 101    {
 102  38 buffer.append(", column ");
 103  38 buffer.append(_columnNumber);
 104    }
 105   
 106  64 return buffer.toString();
 107    }
 108    }