public synchronized void updateFromTrackParameters ( TrackParameters track ) { parameters . clear ( ) ; for ( TrackedParameter p : track . getAllParameters ( ) ) { Parameter < ? > option = p . getParameter ( ) ; String value = null ; if ( option . isDefined ( ) ) { if ( option . tookDefaultValue ( ) ) { value = DynamicParameters . STRING_USE_DEFAULT + option . getDefaultValueAsString ( ) ; } else { value = option . getValueAsString ( ) ; } } if ( value == null ) { value = ( option instanceof Flag ) ? Flag . NOT_SET : "" ; } int bits = 0 ; if ( option . isOptional ( ) ) { bits |= BIT_OPTIONAL ; } if ( option . hasDefaultValue ( ) && option . tookDefaultValue ( ) ) { bits |= BIT_DEFAULT_VALUE ; } if ( value . length ( ) <= 0 ) { if ( ( bits & BIT_DEFAULT_VALUE ) == 0 && ( bits & BIT_OPTIONAL ) == 0 ) { bits |= BIT_INCOMPLETE ; } } else { try { if ( ! option . tookDefaultValue ( ) && ! option . isValid ( value ) ) { bits |= BIT_INVALID ; } } catch ( ParameterException e ) { bits |= BIT_INVALID ; } } int depth = 0 ; { Object pos = track . getParent ( option ) ; while ( pos != null ) { pos = track . getParent ( pos ) ; depth += 1 ; if ( depth > 10 ) { break ; } } } parameters . add ( new Node ( option , value , bits , depth ) ) ; } }
Update the Parameter list from the collected options of an ELKI context