Package weka.core

Class SingleIndex

    • Constructor Detail

      • SingleIndex

        public SingleIndex()
        Default constructor.
      • SingleIndex

        public SingleIndex​(String index)
        Constructor to set initial index.
        Parameters:
        index - the initial index
        Throws:
        IllegalArgumentException - if the index is invalid
    • Method Detail

      • setUpper

        public void setUpper​(int newUpper)
        Sets the value of "last".
        Parameters:
        newUpper - the value of "last"
      • getSingleIndex

        public String getSingleIndex()
        Gets the string representing the selected range of values.
        Returns:
        the range selection string
      • setSingleIndex

        public void setSingleIndex​(String index)
        Sets the index from a string representation. Note that setUpper() must be called for the value to be actually set
        Parameters:
        index - the index set
        Throws:
        IllegalArgumentException - if the index was not well formed
      • toString

        public String toString()
        Constructs a representation of the current range. Being a string representation, the numbers are based from 1.
        Overrides:
        toString in class Object
        Returns:
        the string representation of the current range
      • getIndex

        public int getIndex()
        Gets the selected index.
        Returns:
        the selected index
        Throws:
        RuntimeException - if the upper limit of the index hasn't been defined
      • indexToString

        public static String indexToString​(int index)
        Creates a string representation of the given index.
        Parameters:
        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.
        Returns:
        the string representation
      • main

        public static void main​(String[] argv)
        Main method for testing this class.
        Parameters:
        argv - one parameter: a test index specification