程序包 weka.core
类 Range
java.lang.Object
weka.core.Range
- 所有已实现的接口:
Serializable
,RevisionHandler
Class representing a range of cardinal numbers. The range is set by a
string representation such as:
first-last
1,2,3,4
or combinations thereof. The range is internally converted from 1-based to 0-based (so methods that set or get numbers not in string format should use 0-based numbers).
- 版本:
- $Revision: 1.18 $
- 作者:
- Len Trigg (trigg@cs.waikato.ac.nz)
- 另请参阅:
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明boolean
Gets whether the range sense is inverted, i.e.Gets the string representing the selected range of valuesReturns the revision string.int[]
Gets an array containing all the selected values, in the order that they were selected (or ascending order if range inversion is on)static String
indicesToRangeList
(int[] indices) Creates a string representation of the indices in the supplied array.boolean
isInRange
(int index) Gets whether the supplied cardinal number is included in the current range.static void
Main method for testing this class.void
setInvert
(boolean newSetting) Sets whether the range sense is inverted, i.e.void
Sets the ranges from a string representation.void
setUpper
(int newUpper) Sets the value of "last".toString()
Constructs a representation of the current range.
-
构造器详细资料
-
Range
public Range()Default constructor. -
Range
Constructor to set initial range.- 参数:
rangeList
- the initial range- 抛出:
IllegalArgumentException
- if the range list is invalid
-
-
方法详细资料
-
setUpper
public void setUpper(int newUpper) Sets the value of "last".- 参数:
newUpper
- the value of "last"
-
getInvert
public boolean getInvert()Gets whether the range sense is inverted, i.e. all except the values included by the range string are selected.- 返回:
- whether the matching sense is inverted
-
setInvert
public void setInvert(boolean newSetting) Sets whether the range sense is inverted, i.e. all except the values included by the range string are selected.- 参数:
newSetting
- true if the matching sense is inverted
-
getRanges
Gets the string representing the selected range of values- 返回:
- the range selection string
-
setRanges
Sets the ranges from a string representation. Note that setUpper() must be called afterwards for ranges to be actually set internally.- 参数:
rangeList
- the comma separated list of ranges. The empty string sets the range to empty.- 抛出:
IllegalArgumentException
- if the rangeList was not well formed
-
isInRange
public boolean isInRange(int index) Gets whether the supplied cardinal number is included in the current range.- 参数:
index
- the number of interest- 返回:
- true if index is in the current range
- 抛出:
RuntimeException
- if the upper limit of the range hasn't been defined
-
toString
Constructs a representation of the current range. Being a string representation, the numbers are based from 1. -
getSelection
public int[] getSelection()Gets an array containing all the selected values, in the order that they were selected (or ascending order if range inversion is on)- 返回:
- the array of selected values
- 抛出:
RuntimeException
- if the upper limit of the range hasn't been defined
-
indicesToRangeList
Creates a string representation of the indices in the supplied array.- 参数:
indices
- an array containing indices to select. Since the array will typically come from a program, indices are assumed from 0, and thus will have 1 added in the String representation.- 返回:
- the string representation of the indices
-
getRevision
Returns the revision string.- 指定者:
getRevision
在接口中RevisionHandler
- 返回:
- the revision
-
main
Main method for testing this class.- 参数:
argv
- one parameter: a test range specification
-