Package adams.data.spreadsheet
Class SheetRange
- java.lang.Object
-
- adams.core.Range
-
- adams.core.AbstractDataBackedRange<String[]>
-
- adams.data.spreadsheet.SheetRange
-
- All Implemented Interfaces:
CloneHandler<Range>
,CustomDisplayStringProvider
,ExampleProvider
,HelpProvider
,Serializable
,Comparable<Range>
public class SheetRange extends AbstractDataBackedRange<String[]>
ExtendedRange
class that also allows sheet names for specifying sheet positions (names are case-insensitive, just like placeholders for 'first', 'second', etc). If sheet names contain "-" or "," then they need to be surrounded by double-quotes.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class adams.core.AbstractDataBackedRange
AbstractDataBackedRange.InvertedStringLengthComparator
-
Nested classes/interfaces inherited from class adams.core.Range
Range.SubRange
-
-
Field Summary
-
Fields inherited from class adams.core.AbstractDataBackedRange
m_Data, m_Indices, m_Names
-
Fields inherited from class adams.core.Range
ALL, FIRST, INV_END, INV_START, LAST, LAST_1, LAST_2, m_ActualRange, m_Inverted, m_Max, m_Range, m_Raw, m_SubRanges, NUMERIC_START, RANGE, SECOND, SEPARATOR, THIRD
-
-
Constructor Summary
Constructors Constructor Description SheetRange()
Initializes with no range.SheetRange(String range)
Initializes with the given range, but no maximum.SheetRange(String range, int max)
Initializes with the given range and maximum.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SheetRange
getClone()
Returns a clone of the object.String
getExample()
Returns the example.protected String
getName(String[] data, int colIndex)
Returns the column name at the specified index.protected int
getNumNames(String[] data)
Returns the number of columns the dataset has.String[]
getSheetNames()
Returns the underlying sheet names.void
setSheetNames(String[] value)
Sets the sheet names to use for interpreting the sheet name.-
Methods inherited from class adams.core.AbstractDataBackedRange
canReplaceInvalidChars, escapeName, getData, getIndices, getIndices, getIntIndices, getIntSegments, getNames, initialize, initLookUp, isInRange, isName, parse, reset, setData, splitList, splitRange, unescapeName
-
Methods inherited from class adams.core.Range
clean, compareTo, equals, getActualRange, getHelpDescription, getHelpIcon, getHelpTitle, getHelpURL, getIntIndices, getIntSegments, getMax, getRange, getSubRanges, hashCode, hasRange, isAllRange, isEmpty, isInRange, isInverted, isPlaceholder, isValid, parse, parse, parsePlaceholder, setIndices, setIndices, setInverted, setMax, setRange, toDisplay, toExplicitRange, toRange, toString
-
-
-
-
Constructor Detail
-
SheetRange
public SheetRange()
Initializes with no range.
-
SheetRange
public SheetRange(String range)
Initializes with the given range, but no maximum.- Parameters:
range
- the range to use
-
SheetRange
public SheetRange(String range, int max)
Initializes with the given range and maximum.- Parameters:
range
- the range 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 names, null if none set
- See Also:
AbstractDataBackedRange.getData()
-
getClone
public SheetRange getClone()
Returns a clone of the object.- Specified by:
getClone
in interfaceCloneHandler<Range>
- Overrides:
getClone
in classAbstractDataBackedRange<String[]>
- Returns:
- the clone
-
getNumNames
protected int getNumNames(String[] data)
Returns the number of columns the dataset has.- Specified by:
getNumNames
in classAbstractDataBackedRange<String[]>
- Parameters:
data
- the sheet names to retrieve the number of columns
-
getName
protected String getName(String[] data, int colIndex)
Returns the column name at the specified index.- Specified by:
getName
in classAbstractDataBackedRange<String[]>
- Parameters:
data
- the sheet names to usecolIndex
- the column index- Returns:
- the column name
-
getExample
public String getExample()
Returns the example.- Specified by:
getExample
in interfaceExampleProvider
- Overrides:
getExample
in classRange
- Returns:
- the example
-
-