Clover coverage report - ATP library for Java - 3.6.4-stable-060214
Coverage timestamp: Вт фев 14 2006 13:45:22 MSK
file stats: LOC: 149   Methods: 9
NCLOC: 51   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
Position.java 83,3% 85,7% 88,9% 86,2%
coverage coverage
 1    /*
 2    * Copyright (c) 2001-2004,
 3    * RedVerst Group, ISP RAS http://www.ispras.ru
 4    * All rights reserved.
 5    *
 6    * Redistribution and use in source and binary forms, with or without
 7    * modification, are permitted provided that the following conditions are met:
 8    *
 9    * 1. Redistributions of source code must retain the above copyright notice, this
 10    * list of conditions and the following disclaimer.
 11    *
 12    * 2. Redistributions in binary form must reproduce the above copyright notice,
 13    * this list of conditions and the following disclaimer in the documentation
 14    * and/or other materials provided with the distribution.
 15    *
 16    * 3. The names "ATP", "TreeDL", "RedVerst", "ISP RAS"
 17    * may not be used to endorse or promote products derived from this software
 18    * without specific prior written permission.
 19    *
 20    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 21    * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 22    * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 23    * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 24    * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 25    * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 26    * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 27    * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 28    * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 29    * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 30    */
 31   
 32    package com.unitesk.atp.text.location;
 33   
 34    /**
 35    * Text position is specified by <I>line</I> and <I>column</I>.
 36    * Valid <I>lines</I> and <I>columns</I> are counted from 1.
 37    *
 38    * @author <A href="mailto:demakov@ispras.ru">Alexey Demakov</A>
 39    * @version $Id: Position.java,v 1.3 2004/11/15 07:53:05 all-x Exp $
 40    */
 41    public class Position
 42    {
 43    /**
 44    * Stub constructor sets <I>line</I> and <I>column</I> in <code>(0,0)</code>.
 45    * They are stub values because real lines and columns are counted from 1.
 46    */
 47  8 public Position()
 48    {
 49  8 line = 0;
 50  8 column = 0;
 51    }
 52   
 53    /**
 54    * Creates position with the specified <I>line</I> and <I>column</I>.
 55    *
 56    * @param line The <I>line</I> of new position.
 57    * @param column The <I>column</I> of new position.
 58    */
 59  204 public Position( int line, int column )
 60    {
 61  204 setLine( line );
 62  204 setColumn( column );
 63    }
 64   
 65    /**
 66    * Returns the <I>line</I> of this position.
 67    *
 68    * @return The <I>line</I> of this position.
 69    */
 70  111 public int getLine()
 71    {
 72  111 return line;
 73    }
 74   
 75    /**
 76    * Sets the new value of <I>line</I> of this position.
 77    *
 78    * @param line value to be set as <I>line</I>.
 79    */
 80  214 public void setLine( int line )
 81    {
 82  214 this.line = line;
 83    }
 84   
 85    /**
 86    * Returns the <I>column</I> of this position.
 87    *
 88    * @return The <I>column</I> of this position.
 89    */
 90  111 public int getColumn()
 91    {
 92  111 return column;
 93    }
 94   
 95   
 96    /**
 97    * Sets the new value of <I>column</I> of this position.
 98    *
 99    * @param column value to be set as <I>column</I>.
 100    */
 101  204 public void setColumn( int column )
 102    {
 103  204 this.column = column;
 104    }
 105   
 106    /**
 107    * Returns the string representation of this position.
 108    *
 109    * @return The string representation of this position
 110    * as <code>"(${line},${column})"</code>.
 111    * Invalid (non-positive) value of <I>line</I> or <I>column</I>
 112    * is represented as <code>'?'</code>.
 113    */
 114  104 public String toString()
 115    {
 116  104 return "("
 117  104 + (line > 0 ? Integer.toString( line ) : "?")
 118    + ","
 119  104 + (column > 0 ? Integer.toString( column ) : "?")
 120    + ")";
 121    }
 122   
 123    /**
 124    * Positions are equal if lines and columns are equal.
 125    *
 126    * @param obj The object to compare with.
 127    */
 128  4 public boolean equals( Object obj )
 129    {
 130  0 if( !(obj instanceof Position) ) return false;
 131  4 Position pos = (Position)obj;
 132  4 return getLine() == pos.getLine()
 133    && getColumn() == pos.getColumn();
 134    }
 135   
 136    /**
 137    * @return This implementation returns line of position.
 138    */
 139  0 public int hashCode()
 140    {
 141  0 return getLine();
 142    }
 143   
 144    //--------------------------------------------------------------------------
 145    // implementation
 146   
 147    private int line;
 148    private int column;
 149    }