adams.data.spreadsheet.cellfinder
Class CorrespondingColumn

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.core.option.AbstractOptionHandler
          extended by adams.data.spreadsheet.cellfinder.AbstractCellFinder
              extended by adams.data.spreadsheet.cellfinder.CorrespondingColumn
All Implemented Interfaces:
Debuggable, Destroyable, OptionHandler, ShallowCopySupporter<AbstractCellFinder>, SizeOfHandler, Serializable

public class CorrespondingColumn
extends AbstractCellFinder

Rather than return a cell that was located using the given cell finder, you can return a corresponding cell (within the same row).
This allows you to locate cells with certain value but then update a different column in the same row. You can specify whether the position of the corresponding column is relative (+3 or -4) or absolute (5th).

Valid options are:

-D <int> (property: debugLevel)
    The greater the number the more additional info the scheme may output to 
    the console (0 = off).
    default: 0
    minimum: 0
 
-finder <adams.data.spreadsheet.cellfinder.AbstractCellFinder> (property: finder)
    The base cell finder to locate the cells.
    default: adams.data.spreadsheet.cellfinder.ColumnFinderRange -column-finder adams.data.spreadsheet.columnfinder.ByIndex
 
-corresponding-position <ABSOLUTE|RELATIVE> (property: correspondingPosition)
    How to interpret the column position.
    default: RELATIVE
 
-corresponding-column <int> (property: correspondingColumn)
    The location of the column: 1-based if absolute mode; 0 in relative mode 
    is the column itself.
    default: 0
 

Version:
$Revision: 6614 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Nested Class Summary
static class CorrespondingColumn.CorrespondingColumnIterator
          Cell iterator that returns the locations for the corresponding cells.
 
Field Summary
protected  int m_CorrespondingColumn
          the position of the corresponding column.
protected  PositionType m_CorrespondingPosition
          whether the corresponding column is relative or absolute.
protected  AbstractCellFinder m_Finder
          the base cell finder to use.
 
Fields inherited from class adams.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Constructor Summary
CorrespondingColumn()
           
 
Method Summary
 String correspondingColumnTipText()
          Returns the tip text for this property.
 String correspondingPositionTipText()
          Returns the tip text for this property.
 void defineOptions()
          Adds options to the internal list of options.
protected  Iterator<CellLocation> doFindCells(SpreadSheet sheet)
          Performs the actual locating.
 String finderTipText()
          Returns the tip text for this property.
 int getCorrespondingColumn()
          Returns the column location (abs/rel).
 PositionType getCorrespondingPosition()
          Returns how to interpret the column position.
 AbstractCellFinder getFinder()
          Returns the base cell finder.
 String globalInfo()
           
 void setCorrespondingColumn(int value)
          Sets the column location (abs/rel).
 void setCorrespondingPosition(PositionType value)
          Sets how to interpret the column position.
 void setFinder(AbstractCellFinder value)
          Sets the base cell finder.
 
Methods inherited from class adams.data.spreadsheet.cellfinder.AbstractCellFinder
check, findCells, forCommandLine, forName, getCellFinders, shallowCopy, shallowCopy
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debug, debugLevelTipText, destroy, finishInit, getDebugLevel, getOptionManager, initialize, isDebugOn, newOptionManager, reset, setDebugLevel, toCommandLine, toString
 
Methods inherited from class adams.core.ConsoleObject
getDebugging, getSystemErr, getSystemOut, sizeOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_Finder

protected AbstractCellFinder m_Finder
the base cell finder to use.


m_CorrespondingPosition

protected PositionType m_CorrespondingPosition
whether the corresponding column is relative or absolute.


m_CorrespondingColumn

protected int m_CorrespondingColumn
the position of the corresponding column.

Constructor Detail

CorrespondingColumn

public CorrespondingColumn()
Method Detail

globalInfo

public String globalInfo()
Specified by:
globalInfo in class AbstractOptionHandler
Returns:

defineOptions

public void defineOptions()
Adds options to the internal list of options.

Specified by:
defineOptions in interface OptionHandler
Overrides:
defineOptions in class AbstractOptionHandler

setFinder

public void setFinder(AbstractCellFinder value)
Sets the base cell finder.

Parameters:
value - the finder

getFinder

public AbstractCellFinder getFinder()
Returns the base cell finder.

Returns:
the finder

finderTipText

public String finderTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the gui

setCorrespondingPosition

public void setCorrespondingPosition(PositionType value)
Sets how to interpret the column position.

Parameters:
value - the position type

getCorrespondingPosition

public PositionType getCorrespondingPosition()
Returns how to interpret the column position.

Returns:
the position type

correspondingPositionTipText

public String correspondingPositionTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the gui

setCorrespondingColumn

public void setCorrespondingColumn(int value)
Sets the column location (abs/rel).

Parameters:
value - the location

getCorrespondingColumn

public int getCorrespondingColumn()
Returns the column location (abs/rel).

Returns:
the location

correspondingColumnTipText

public String correspondingColumnTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the gui

doFindCells

protected Iterator<CellLocation> doFindCells(SpreadSheet sheet)
Performs the actual locating.

Specified by:
doFindCells in class AbstractCellFinder
Parameters:
sheet - the sheet to locate the cells in
Returns:
the iterator over the locations


Copyright © 2013 University of Waikato, Hamilton, NZ. All Rights Reserved.