adams.data.spreadsheet.cellfinder
Class AbstractCellFinder

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

public abstract class AbstractCellFinder
extends AbstractOptionHandler
implements ShallowCopySupporter<AbstractCellFinder>

Ancestor for schemes that locate cells of interest in a spreadsheet.

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

Field Summary
 
Fields inherited from class adams.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Constructor Summary
AbstractCellFinder()
           
 
Method Summary
protected  void check(SpreadSheet sheet)
          Checks whether the spreadsheet can be processed.
protected abstract  Iterator<CellLocation> doFindCells(SpreadSheet sheet)
          Performs the actual locating.
 Iterator<CellLocation> findCells(SpreadSheet sheet)
          Locates the cells in the spreadsheet.
static AbstractCellFinder forCommandLine(String cmdline)
          Instantiates the cell finder from the given commandline (i.e., classname and optional options).
static AbstractCellFinder forName(String classname, String[] options)
          Instantiates the cell finder with the given options.
static String[] getCellFinders()
          Returns a list with classnames of cell finders.
 AbstractCellFinder shallowCopy()
          Returns a shallow copy of itself, i.e., based on the commandline options.
 AbstractCellFinder shallowCopy(boolean expand)
          Returns a shallow copy of itself, i.e., based on the commandline options.
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debug, debugLevelTipText, defineOptions, destroy, finishInit, getDebugLevel, getOptionManager, globalInfo, 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
 

Constructor Detail

AbstractCellFinder

public AbstractCellFinder()
Method Detail

check

protected void check(SpreadSheet sheet)
Checks whether the spreadsheet can be processed.

Default implementation only checks whether a spreadsheet was provided.

Parameters:
sheet - the spreadsheet to check

doFindCells

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

Parameters:
sheet - the sheet to locate the cells in
Returns:
the iterator over the locations

findCells

public Iterator<CellLocation> findCells(SpreadSheet sheet)
Locates the cells in the spreadsheet.

Parameters:
sheet - the sheet to locate the cells in
Returns:
the iterator over the locations

shallowCopy

public AbstractCellFinder shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.

Specified by:
shallowCopy in interface ShallowCopySupporter<AbstractCellFinder>
Returns:
the shallow copy

shallowCopy

public AbstractCellFinder shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.

Specified by:
shallowCopy in interface ShallowCopySupporter<AbstractCellFinder>
Parameters:
expand - whether to expand variables to their current values
Returns:
the shallow copy

getCellFinders

public static String[] getCellFinders()
Returns a list with classnames of cell finders.

Returns:
the cell finder classnames

forName

public static AbstractCellFinder forName(String classname,
                                         String[] options)
Instantiates the cell finder with the given options.

Parameters:
classname - the classname of the cell finder to instantiate
options - the options for the cell finder
Returns:
the instantiated cell finder or null if an error occurred

forCommandLine

public static AbstractCellFinder forCommandLine(String cmdline)
Instantiates the cell finder from the given commandline (i.e., classname and optional options).

Parameters:
cmdline - the classname (and optional options) of the cell finder to instantiate
Returns:
the instantiated cell finder or null if an error occurred


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