private void readInstance ( StreamTokenizer tokenizer , AttributeDataset data , Attribute [ ] attributes ) throws IOException , ParseException { double [ ] x = responseIndex >= 0 ? new double [ attributes . length - 1 ] : new double [ attributes . length ] ; double y = Double . NaN ; // Get values for all attributes. for ( int i = 0 , k = 0 ; i < attributes . length ; i ++ ) { // Get next token if ( i > 0 ) { getNextToken ( tokenizer ) ; } if ( i == responseIndex ) { if ( tokenizer . ttype == ' ' ) { y = Double . NaN ; } else { y = attributes [ i ] . valueOf ( tokenizer . sval ) ; } } else { if ( tokenizer . ttype == ' ' ) { x [ k ++ ] = Double . NaN ; } else { x [ k ++ ] = attributes [ i ] . valueOf ( tokenizer . sval ) ; } } } if ( Double . isNaN ( y ) ) data . add ( x ) ; else data . add ( x , y ) ; }
Reads a single instance .