private String mergeConfigValue ( String key , Set < String > corpora , CorpusConfigMap corpusConfigurations ) { Set < String > values = new TreeSet <> ( ) ; for ( String corpus : corpora ) { CorpusConfig config = corpusConfigurations . get ( corpus ) ; if ( config != null ) { String v = config . getConfig ( key ) ; if ( v != null ) { values . add ( v ) ; } } } if ( values . size ( ) > 1 || values . isEmpty ( ) ) { // fallback to the default values CorpusConfig defaultConfig = corpusConfigurations . get ( DEFAULT_CONFIG ) ; if ( defaultConfig != null && defaultConfig . containsKey ( key ) ) { return defaultConfig . getConfig ( key ) ; } } // ok, just return the first value as a fallback of the fallback if ( ! values . isEmpty ( ) ) { return values . iterator ( ) . next ( ) ; } return null ; }
If all values of a specific corpus property have the same value this value is returned otherwise the value of the default configuration is choosen .