001    /**
002     * Copyright (C) 2007-2011, Jens Lehmann
003     *
004     * This file is part of DL-Learner.
005     *
006     * DL-Learner is free software; you can redistribute it and/or modify
007     * it under the terms of the GNU General Public License as published by
008     * the Free Software Foundation; either version 3 of the License, or
009     * (at your option) any later version.
010     *
011     * DL-Learner is distributed in the hope that it will be useful,
012     * but WITHOUT ANY WARRANTY; without even the implied warranty of
013     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014     * GNU General Public License for more details.
015     *
016     * You should have received a copy of the GNU General Public License
017     * along with this program.  If not, see <http://www.gnu.org/licenses/>.
018     */
019    
020    package org.dllearner.core.configurators;
021    
022    import org.dllearner.algorithms.RandomGuesser;
023    import org.dllearner.core.ComponentManager;
024    import org.dllearner.core.AbstractLearningProblem;
025    import org.dllearner.core.LearningProblemUnsupportedException;
026    import org.dllearner.core.AbstractReasonerComponent;
027    
028    /**
029    * automatically generated, do not edit manually.
030    * run org.dllearner.scripts.ConfigJavaGenerator to update
031    **/
032    public  class RandomGuesserConfigurator  implements Configurator {
033    
034    private boolean reinitNecessary = false;
035    private RandomGuesser randomGuesser;
036    
037    /**
038    * @param randomGuesser see RandomGuesser
039    **/
040    public RandomGuesserConfigurator(RandomGuesser randomGuesser){
041    this.randomGuesser = randomGuesser;
042    }
043    
044    /**
045    * @param reasoningService see reasoningService
046    * @param learningProblem see learningProblem
047    * @throws LearningProblemUnsupportedException see 
048    * @return RandomGuesser
049    **/
050    public static RandomGuesser getRandomGuesser(AbstractLearningProblem learningProblem, AbstractReasonerComponent reasoningService) throws LearningProblemUnsupportedException{
051    RandomGuesser component = ComponentManager.getInstance().learningAlgorithm(RandomGuesser.class, learningProblem, reasoningService);
052    return component;
053    }
054    
055    /**
056    * numberOfGuesses number of randomly generated concepts/trees.
057    * mandatory: false| reinit necessary: true
058    * default value: 100
059    * @return int 
060    **/
061    public int getNumberOfGuesses() {
062    return (Integer) ComponentManager.getInstance().getConfigOptionValue(randomGuesser,  "numberOfGuesses") ;
063    }
064    /**
065    * maxDepth maximum depth of generated concepts/trees.
066    * mandatory: false| reinit necessary: true
067    * default value: 5
068    * @return int 
069    **/
070    public int getMaxDepth() {
071    return (Integer) ComponentManager.getInstance().getConfigOptionValue(randomGuesser,  "maxDepth") ;
072    }
073    
074    /**
075    * @param numberOfGuesses number of randomly generated concepts/trees.
076    * mandatory: false| reinit necessary: true
077    * default value: 100
078    **/
079    public void setNumberOfGuesses(int numberOfGuesses) {
080    ComponentManager.getInstance().applyConfigEntry(randomGuesser, "numberOfGuesses", numberOfGuesses);
081    reinitNecessary = true;
082    }
083    /**
084    * @param maxDepth maximum depth of generated concepts/trees.
085    * mandatory: false| reinit necessary: true
086    * default value: 5
087    **/
088    public void setMaxDepth(int maxDepth) {
089    ComponentManager.getInstance().applyConfigEntry(randomGuesser, "maxDepth", maxDepth);
090    reinitNecessary = true;
091    }
092    
093    /**
094    * true, if this component needs reinitializsation.
095    * @return boolean
096    **/
097    public boolean isReinitNecessary(){
098    return reinitNecessary;
099    }
100    
101    
102    }