Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010 JBoss Inc
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 package org.drools.planner.config.localsearch.decider.deciderscorecomparator;
 
 
 @XStreamAlias("deciderScoreComparatorFactory")
 
 
     private Integer hardScoreActivationThreshold = null;
     private Integer successiveNoHardChangeMinimum = null;
     private Integer successiveNoHardChangeMaximum = null;
     private Double hardWeightSurvivalRatio = null;
     private Integer startingHardWeight = null// TODO determine dynamically
 
         return ;
     }
 
     public void setDeciderScoreComparatorClass(Class<DeciderScoreComparatorFactorydeciderScoreComparatorClass) {
         this. = deciderScoreComparatorClass;
     }
 
         return ;
     }
 
     public void setDeciderScoreComparatorFactoryType(DeciderScoreComparatorFactoryType deciderScoreComparatorFactoryType) {
         this. = deciderScoreComparatorFactoryType;
     }
 
         return ;
     }
 
     public void setHardScoreActivationThreshold(Integer hardScoreActivationThreshold) {
         this. = hardScoreActivationThreshold;
     }
 
         return ;
     }
 
     public void setSuccessiveNoHardChangeMinimum(Integer successiveNoHardChangeMinimum) {
         this. = successiveNoHardChangeMinimum;
     }
 
         return ;
     }
 
     public void setSuccessiveNoHardChangeMaximum(Integer successiveNoHardChangeMaximum) {
         this. = successiveNoHardChangeMaximum;
     }
 
     }
 
     public void setSuccessiveNoHardChangeRepetitionMultiplicand(Double successiveNoHardChangeRepetitionMultiplicand) {
         this. = successiveNoHardChangeRepetitionMultiplicand;
     }
 
     public Double getHardWeightSurvivalRatio() {
         return ;
     }
 
     public void setHardWeightSurvivalRatio(Double hardWeightSurvivalRatio) {
         this. = hardWeightSurvivalRatio;
     }
 
     public Integer getStartingHardWeight() {
         return ;
     }
 
     public void setStartingHardWeight(Integer startingHardWeight) {
         this. = startingHardWeight;
     }
    // ************************************************************************
    // Builder methods
    // ************************************************************************
        if ( != null) {
            try {
                return .newInstance();
            } catch (InstantiationException e) {
                throw new IllegalArgumentException("deciderScoreComparatorClass ("
                        + .getName() + ") does not have a public no-arg constructor"e);
            } catch (IllegalAccessException e) {
                throw new IllegalArgumentException("deciderScoreComparatorClass ("
                        + .getName() + ") does not have a public no-arg constructor"e);
            }
        } else if ( != null) {
            switch () {
                case :
                    return new NaturalDeciderScoreComparatorFactory();
                case :
                    ShiftingHardPenaltyDeciderScoreComparatorFactory deciderScoreComparator
                            = new ShiftingHardPenaltyDeciderScoreComparatorFactory();
                    if ( != null) {
                        deciderScoreComparator.setHardScoreActivationThreshold();
                    }
                    if ( != null) {
                        deciderScoreComparator.setSuccessiveNoHardChangeMinimum();
                    }
                    if ( != null) {
                        deciderScoreComparator.setSuccessiveNoHardChangeMaximum();
                    }
                    if ( != null) {
                        deciderScoreComparator.setSuccessiveNoHardChangeRepetitionMultiplicand(
                                );
                    }
                    if ( != null) {
                        deciderScoreComparator.setHardWeightSurvivalRatio();
                    }
                    if ( != null) {
                        deciderScoreComparator.setStartingHardWeight();
                    }
                    return deciderScoreComparator;
                default:
                    throw new IllegalStateException("The deciderScoreComparatorFactoryType ("
                            +  + ") is not implemented");
            }
        } else {
            return new NaturalDeciderScoreComparatorFactory();
        }
    }
    public void inherit(DeciderScoreComparatorFactoryConfig inheritedConfig) {
        if ( == null &&  == null) {
             = inheritedConfig.getDeciderScoreComparatorClass();
             = inheritedConfig.getDeciderScoreComparatorFactoryType();
        }
        if ( == null) {
             = inheritedConfig.getHardScoreActivationThreshold();
        }
        if ( == null) {
             = inheritedConfig.getSuccessiveNoHardChangeMinimum();
        }
        if ( == null) {
             = inheritedConfig.getSuccessiveNoHardChangeMaximum();
        }
        if ( == null) {
             = inheritedConfig
                    .getSuccessiveNoHardChangeRepetitionMultiplicand();
        }
        if ( == null) {
             = inheritedConfig.getHardWeightSurvivalRatio();
        }
        if ( == null) {
             = inheritedConfig.getStartingHardWeight();
        }
    }
    public static enum DeciderScoreComparatorFactoryType {
        NATURAL,
        SHIFTING_HARD_PENALTY
    }
New to GrepCode? Check out our FAQ X