/*
** Module   : AbsoluteRowExclusion.java
** Abstract : represent a portion line that is to be excluded from comparisons
**
** Copyright (c) 2009, Golden Code Development Corporation.
**
** -#- -I- --Date-- -----------------------Description------------------------
** 001 GES 20090218 Represent a portion of a line that is to be excluded from
**                  comparisons.
*/

/*
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU Affero General Public License as
** published by the Free Software Foundation, either version 3 of the
** License, or (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License
** along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

package com.goldencode.harness.test;

/**
 * Represent a portion of a line that is to be excluded from comparisons. Each
 * row is represented as a non-negative number that is indexed with the first
 * line in the file as line number 0.
 */
public class AbsoluteRowExclusion
extends RowExclusion
{
   /**
    * Create an instance given explicit starting and ending indexes.
    *
    * @param    row
    *           The row number in which the exclusion should occur.
    * @param    start
    *           Starting index.
    * @param    end
    *           Ending index.
    */
   public AbsoluteRowExclusion(int row, int start, int end)
   {
      super(row, start, end);
   }
   
   /**              
    * Report if the current line is the line that is referenced by this
    * exclusion region.
    * <p>
    * The row number must be matched based on the configuration and type of
    * this instance. All row number processing is 0-based.
    *
    * @param    absNum
    *           Absolute row number as calculated from the beginning of the
    *           file.
    * @param    relNum
    *           Relative row number as calculated from the beginning of the
    *           current page.
    * @param    pageNum
    *           Current page number (0-based).
    * @param    pageSz
    *           Size (in number of lines) of the current page.
    * @param    isLast   
    *           <code>true</code> if the current page is the last page in the
    *           file.
    *
    * @return   <code>true</code> if the given row is the same row as is
    *           excluded by this instance.
    */
   public boolean isRow(int     absNum,
                        int     relNum,
                        int     pageNum,
                        int     pageSz,
                        boolean isLast)
   {
      return (row == absNum);
   }
   
   /**
    * Obtain a descriptive string representation of this instance.
    *
    * @return   The details of this instance.
    */
   public String toString()
   {
      return String.format("absolute row %d (columns %d - %d)",
                           row,
                           start,
                           end);
   }
}
