Package adams.data.spreadsheet
Class SheetIndex
- java.lang.Object
-
- adams.core.Index
-
- adams.core.AbstractDataBackedIndex<String[]>
-
- adams.data.spreadsheet.SheetIndex
-
- All Implemented Interfaces:
CloneHandler<Index>,CustomDisplayStringProvider,ExampleProvider,HelpProvider,Serializable,Comparable<Index>
public class SheetIndex extends AbstractDataBackedIndex<String[]>
ExtendedIndexclass that can use a sheet name to determine an index of a sheet as well.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SheetIndex()Initializes with no index.SheetIndex(String index)Initializes with the given index, but no maximum.SheetIndex(String index, int max)Initializes with the given index and maximum.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SheetIndexgetClone()Returns a clone of the object.StringgetExample()Returns the example.protected StringgetName(String[] data, int colIndex)Returns the column name at the specified index.protected intgetNumNames(String[] data)Returns the number of columns the dataset has.String[]getSheetNames()Returns the underlying sheet names.voidsetSheetNames(String[] value)Sets the sheet names to use for interpreting the sheet 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
-
SheetIndex
public SheetIndex()
Initializes with no index.
-
SheetIndex
public SheetIndex(String index)
Initializes with the given index, but no maximum.- Parameters:
index- the index to use
-
SheetIndex
public SheetIndex(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
-
setSheetNames
public void setSheetNames(String[] value)
Sets the sheet names to use for interpreting the sheet name.- Parameters:
value- the sheet names to use, can be null
-
getSheetNames
public String[] getSheetNames()
Returns the underlying sheet names.- Returns:
- the underlying sheet names, null if none set
- See Also:
AbstractDataBackedIndex.getData()
-
getClone
public SheetIndex getClone()
Returns a clone of the object.- Specified by:
getClonein interfaceCloneHandler<Index>- Overrides:
getClonein classAbstractDataBackedIndex<String[]>- Returns:
- the clone
-
getNumNames
protected int getNumNames(String[] data)
Returns the number of columns the dataset has.- Specified by:
getNumNamesin classAbstractDataBackedIndex<String[]>- Parameters:
data- the dataset to retrieve the number of columns
-
getName
protected String getName(String[] data, int colIndex)
Returns the column name at the specified index.- Specified by:
getNamein classAbstractDataBackedIndex<String[]>- Parameters:
data- the dataset to usecolIndex- the column index- Returns:
- the column name
-
getExample
public String getExample()
Returns the example.- Specified by:
getExamplein interfaceExampleProvider- Overrides:
getExamplein classIndex- Returns:
- the example
-
-