|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectweka.core.SingleIndex
public class SingleIndex
Class representing a single cardinal number. The number is set by a string representation such as:
first
last
1
3
The number 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).
| Constructor Summary | |
|---|---|
SingleIndex()
Default constructor. |
|
SingleIndex(String index)
Constructor to set initial index. |
|
| Method Summary | |
|---|---|
int |
getIndex()
Gets the selected index. |
String |
getRevision()
Returns the revision string. |
String |
getSingleIndex()
Gets the string representing the selected range of values. |
static String |
indexToString(int index)
Creates a string representation of the given index. |
static void |
main(String[] argv)
Main method for testing this class. |
void |
setSingleIndex(String index)
Sets the index from a string representation. |
void |
setUpper(int newUpper)
Sets the value of "last". |
String |
toDisplay()
Returns the custom display string. |
String |
toString()
Constructs a representation of the current range. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SingleIndex()
public SingleIndex(String index)
index - the initial index
IllegalArgumentException - if the index is invalid| Method Detail |
|---|
public void setUpper(int newUpper)
newUpper - the value of "last"public String getSingleIndex()
public void setSingleIndex(String index)
index - the index set
IllegalArgumentException - if the index was not well formedpublic String toString()
toString in class Objectpublic int getIndex()
RuntimeException - if the upper limit of the index hasn't been definedpublic static String indexToString(int index)
index - the index to turn into a string.
Since the index will typically come from a program, indices are assumed
from 0, and thus will have 1 added in the String representation.
public String getRevision()
getRevision in interface RevisionHandlerpublic String toDisplay()
toDisplay in interface CustomDisplayStringProviderpublic static void main(String[] argv)
argv - one parameter: a test index specification
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||