Package adams.data.spreadsheet
Class SpreadSheetColumnIndex
- java.lang.Object
-
- adams.core.Index
-
- adams.core.AbstractDataBackedIndex<SpreadSheet>
-
- adams.data.spreadsheet.SpreadSheetColumnIndex
-
- All Implemented Interfaces:
CloneHandler<Index>
,CustomDisplayStringProvider
,ExampleProvider
,HelpProvider
,Serializable
,Comparable<Index>
public class SpreadSheetColumnIndex extends AbstractDataBackedIndex<SpreadSheet>
ExtendedIndex
class that can use a column name to determine an index of a column as well.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SpreadSheetColumnIndex()
Initializes with no index.SpreadSheetColumnIndex(String index)
Initializes with the given index, but no maximum.SpreadSheetColumnIndex(String index, int max)
Initializes with the given index and maximum.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SpreadSheetColumnIndex
getClone()
Returns a clone of the object.String
getExample()
Returns the example.protected String
getName(SpreadSheet data, int colIndex)
Returns the column name at the specified index.protected int
getNumNames(SpreadSheet data)
Returns the number of columns the dataset has.SpreadSheet
getSpreadSheet()
Returns the underlying spreadsheet.void
setSpreadSheet(SpreadSheet value)
Sets the spreadsheet to use for interpreting the column name.-
Methods inherited from class adams.core.AbstractDataBackedIndex
clean, getData, getIndices, getIntIndex, getNames, initialize, isName, parse, replaceName, setData
-
Methods inherited from class adams.core.Index
compareTo, equals, getHelpDescription, getHelpIcon, getHelpTitle, getHelpURL, getIndex, getIntIndex, getMax, hashCode, hasIndex, isEmpty, isPlaceholder, parsePlaceholder, reset, setIndex, setMax, toDisplay, toString
-
-
-
-
Constructor Detail
-
SpreadSheetColumnIndex
public SpreadSheetColumnIndex()
Initializes with no index.
-
SpreadSheetColumnIndex
public SpreadSheetColumnIndex(String index)
Initializes with the given index, but no maximum.- Parameters:
index
- the index to use
-
SpreadSheetColumnIndex
public SpreadSheetColumnIndex(String index, int max)
Initializes with the given index and maximum.- Parameters:
index
- the index to usemax
- the maximum of the 1-based index (e.g., use "10" to allow "1-10" or -1 for uninitialized)
-
-
Method Detail
-
setSpreadSheet
public void setSpreadSheet(SpreadSheet value)
Sets the spreadsheet to use for interpreting the column name.- Parameters:
value
- the spreadsheet to use, can be null
-
getSpreadSheet
public SpreadSheet getSpreadSheet()
Returns the underlying spreadsheet.- Returns:
- the underlying spreadsheet, null if none set
- See Also:
AbstractDataBackedIndex.getData()
-
getClone
public SpreadSheetColumnIndex getClone()
Returns a clone of the object.- Specified by:
getClone
in interfaceCloneHandler<Index>
- Overrides:
getClone
in classAbstractDataBackedIndex<SpreadSheet>
- Returns:
- the clone
-
getNumNames
protected int getNumNames(SpreadSheet data)
Returns the number of columns the dataset has.- Specified by:
getNumNames
in classAbstractDataBackedIndex<SpreadSheet>
- Parameters:
data
- the dataset to retrieve the number of columns
-
getName
protected String getName(SpreadSheet data, int colIndex)
Returns the column name at the specified index.- Specified by:
getName
in classAbstractDataBackedIndex<SpreadSheet>
- Parameters:
data
- the dataset to usecolIndex
- the column index- Returns:
- the column name
-
getExample
public String getExample()
Returns the example.- Specified by:
getExample
in interfaceExampleProvider
- Overrides:
getExample
in classIndex
- Returns:
- the example
-
-