public void addPenalizingValidation ( Object key , PenalizingValidation penalizingValidation ) { initMapOnce ( ) ; penalties . put ( key , penalizingValidation ) ; // update penalized value if ( ! penalizingValidation . passed ( ) ) { assignedPenalties = true ; double p = penalizingValidation . getPenalty ( ) ; penalizedValue += minimizing ? p : - p ; } }
Add a penalty expressed by a penalizing validation object . A key is required that can be used to retrieve the validation object later .