Package adams.data.spreadsheet
Class SpreadSheetUnorderedColumnRange
- java.lang.Object
-
- adams.core.UnorderedRange
-
- adams.core.AbstractDataBackedUnorderedRange<SpreadSheet>
-
- adams.data.spreadsheet.SpreadSheetUnorderedColumnRange
-
- All Implemented Interfaces:
CloneHandler<UnorderedRange>
,CustomDisplayStringProvider
,ExampleProvider
,HelpProvider
,Serializable
,Comparable<UnorderedRange>
public class SpreadSheetUnorderedColumnRange extends AbstractDataBackedUnorderedRange<SpreadSheet>
ExtendedUnorderedRange
class that also allows column names for specifying column positions (names are case-insensitive, just like placeholders for 'first', 'second', etc). If column 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.AbstractDataBackedUnorderedRange
AbstractDataBackedUnorderedRange.InvertedStringLengthComparator
-
-
Constructor Summary
Constructors Constructor Description SpreadSheetUnorderedColumnRange()
Initializes with no range.SpreadSheetUnorderedColumnRange(String range)
Initializes with the given range, but no maximum.SpreadSheetUnorderedColumnRange(String range, int max)
Initializes with the given range and maximum.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SpreadSheetUnorderedColumnRange
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.protected int[]
parseSubRange(String subrange)
Parses the subrange.void
setSpreadSheet(SpreadSheet value)
Sets the spreadsheet to use for interpreting the column name.-
Methods inherited from class adams.core.AbstractDataBackedUnorderedRange
getData, getIntIndices, initialize, isInRange, setData
-
Methods inherited from class adams.core.UnorderedRange
compareTo, getHelpDescription, getHelpIcon, getHelpTitle, getHelpURL, getIntIndices, getMax, getRange, hasRange, isAllRange, isEmpty, isInRange, isValid, parse, reset, setIndices, setIndices, setMax, setRange, splitRange, toDisplay, toExplicitRange, toRange, toString
-
-
-
-
Constructor Detail
-
SpreadSheetUnorderedColumnRange
public SpreadSheetUnorderedColumnRange()
Initializes with no range.
-
SpreadSheetUnorderedColumnRange
public SpreadSheetUnorderedColumnRange(String range)
Initializes with the given range, but no maximum.- Parameters:
range
- the range to use
-
SpreadSheetUnorderedColumnRange
public SpreadSheetUnorderedColumnRange(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
-
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:
AbstractDataBackedUnorderedRange.getData()
-
getClone
public SpreadSheetUnorderedColumnRange getClone()
Returns a clone of the object.- Specified by:
getClone
in interfaceCloneHandler<UnorderedRange>
- Overrides:
getClone
in classAbstractDataBackedUnorderedRange<SpreadSheet>
- Returns:
- the clone
-
getNumNames
protected int getNumNames(SpreadSheet data)
Returns the number of columns the dataset has.- Specified by:
getNumNames
in classAbstractDataBackedUnorderedRange<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 classAbstractDataBackedUnorderedRange<SpreadSheet>
- Parameters:
data
- the dataset to usecolIndex
- the column index- Returns:
- the column name
-
parseSubRange
protected int[] parseSubRange(String subrange)
Parses the subrange.- Overrides:
parseSubRange
in classUnorderedRange
- Parameters:
subrange
- the subrange- Returns:
- the indices
-
getExample
public String getExample()
Returns the example.- Specified by:
getExample
in interfaceExampleProvider
- Overrides:
getExample
in classUnorderedRange
- Returns:
- the example
-
-