protected double [ ] alignLabels ( List < ClassLabel > l1 , double [ ] d1 , Collection < ClassLabel > l2 ) { assert ( l1 . size ( ) == d1 . length ) ; if ( l1 == l2 ) { return d1 . clone ( ) ; } double [ ] d2 = new double [ l2 . size ( ) ] ; Iterator < ClassLabel > i2 = l2 . iterator ( ) ; for ( int i = 0 ; i2 . hasNext ( ) ; ) { ClassLabel l = i2 . next ( ) ; int idx = l1 . indexOf ( l ) ; if ( idx < 0 && getLogger ( ) . isDebuggingFiner ( ) ) { getLogger ( ) . debugFiner ( "Label not found: " + l ) ; } d2 [ i ] = ( idx >= 0 ) ? d1 [ idx ] : 0. ; // Default to 0 for unknown labels! } return d2 ; }
Align the labels for a label query .