001    /**
002     * Copyright (C) 2007-2009, 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.tools.protege;
021    
022    import java.awt.Dimension;
023    
024    import javax.swing.JLabel;
025    import javax.swing.JPanel;
026    import javax.swing.JSlider;
027    /**
028     * This Class is responsible for the Options of the DL-Learner.
029     * @author Christian Koetteritzsch
030     *
031     */
032    public class OptionPanel extends JPanel {
033    
034            
035            private static final long serialVersionUID = 2190682281812478244L;
036            private final JLabel minAccuracyLabel;
037            private final JLabel maxExecutionTimeLabel;
038            private final JLabel nrOfConceptsLabel;
039            private final JSlider minAccuracy;
040            private final JSlider maxExecutionTime;
041            private final JSlider nrOfConcepts;
042            private double accuracy;
043            /**
044             * Constructor for the Option Panel. 
045             */
046            public OptionPanel() {
047                    setPreferredSize(new Dimension(490, 150));
048                    setLayout(null);
049                    minAccuracyLabel = new JLabel("noise in %");
050                    minAccuracyLabel.setBounds(5, 0, 150, 40);
051                    maxExecutionTimeLabel = new JLabel("maximum execution time");
052                    maxExecutionTimeLabel.setBounds(5, 60, 150, 40);
053                    nrOfConceptsLabel = new JLabel("max. number of results");
054                    nrOfConceptsLabel.setBounds(5, 120, 150, 40);
055                    
056                    minAccuracy = new JSlider(0, 50, 5);
057                    minAccuracy.setPaintTicks(true);
058                    minAccuracy.setMajorTickSpacing(10);
059                    minAccuracy.setMinorTickSpacing(1);
060                    minAccuracy.setPaintLabels(true);
061                    minAccuracy.setBounds(200, 0, 200, 40);
062    
063                    
064                    maxExecutionTime = new JSlider(0, 40, 8);
065                    maxExecutionTime.setPaintTicks(true);
066                    maxExecutionTime.setMajorTickSpacing(10);
067                    maxExecutionTime.setMinorTickSpacing(1);
068                    maxExecutionTime.setPaintLabels(true);
069                    maxExecutionTime.setBounds(200, 60, 200, 40);
070    
071                    
072                    nrOfConcepts = new JSlider(2, 20, 10);
073                    nrOfConcepts.setPaintTicks(true);
074                    nrOfConcepts.setMajorTickSpacing(2);
075                    nrOfConcepts.setMinorTickSpacing(1);
076                    nrOfConcepts.setPaintLabels(true);
077                    nrOfConcepts.setBounds(200, 120, 200, 40);
078    
079                    add(minAccuracyLabel);
080                    add(minAccuracy);
081                    add(maxExecutionTimeLabel);
082                    add(maxExecutionTime);
083                    add(nrOfConceptsLabel);
084                    add(nrOfConcepts);
085            }
086            
087            /**
088             * This method returns the min accuracy chosen in the slider.
089             * @return double minAccuracy
090             */
091            public double getMinAccuracy() {
092                    double acc = minAccuracy.getValue();
093                    accuracy = (acc/100.0);
094                    return accuracy;
095            }
096            
097            /**
098             * This method returns the max executiontime chosen in the slider.
099             * @return int maxExecutionTime
100             */
101            public int getMaxExecutionTime() {
102                    return maxExecutionTime.getValue();
103            }
104            
105            /**
106             * This method returns the nr. of concepts chosen in the slider.
107             * @return int nrOfConcepts
108             */
109            public int getNrOfConcepts() {
110                    return nrOfConcepts.getValue();
111            }
112            
113    }