[4] | 1 | /* |
---|
| 2 | * This program is free software; you can redistribute it and/or modify |
---|
| 3 | * it under the terms of the GNU General Public License as published by |
---|
| 4 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 5 | * (at your option) any later version. |
---|
| 6 | * |
---|
| 7 | * This program is distributed in the hope that it will be useful, |
---|
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 10 | * GNU General Public License for more details. |
---|
| 11 | * |
---|
| 12 | * You should have received a copy of the GNU General Public License |
---|
| 13 | * along with this program; if not, write to the Free Software |
---|
| 14 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
| 15 | */ |
---|
| 16 | |
---|
| 17 | /* |
---|
| 18 | * Copyright (C) 2006 University of Waikato |
---|
| 19 | */ |
---|
| 20 | |
---|
| 21 | package weka.attributeSelection; |
---|
| 22 | |
---|
| 23 | import weka.core.CheckGOE; |
---|
| 24 | import weka.core.CheckOptionHandler; |
---|
| 25 | import weka.core.OptionHandler; |
---|
| 26 | import weka.core.CheckScheme.PostProcessor; |
---|
| 27 | |
---|
| 28 | /** |
---|
| 29 | * Abstract Test class for search schemes. Internally it uses the |
---|
| 30 | * class <code>CheckAttributeSelection</code> to determine success or failure |
---|
| 31 | * of the tests. It follows basically the <code>testsPerClassType</code> |
---|
| 32 | * method. |
---|
| 33 | * |
---|
| 34 | * @author FracPete (fracpete at waikato dot ac dot nz) |
---|
| 35 | * @version $Revision: 1.2 $ |
---|
| 36 | * |
---|
| 37 | * @see CheckAttributeSelection |
---|
| 38 | * @see CheckAttributeSelection#testsPerClassType(int, boolean, boolean) |
---|
| 39 | * @see PostProcessor |
---|
| 40 | */ |
---|
| 41 | public abstract class AbstractSearchTest |
---|
| 42 | extends AbstractAttributeSelectionTest { |
---|
| 43 | |
---|
| 44 | /** |
---|
| 45 | * Constructs the <code>AbstractSearchTest</code>. Called by subclasses. |
---|
| 46 | * |
---|
| 47 | * @param name the name of the test class |
---|
| 48 | */ |
---|
| 49 | public AbstractSearchTest(String name) { |
---|
| 50 | super(name); |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | /** |
---|
| 54 | * configures the CheckAttributeSelection instance used throughout the tests |
---|
| 55 | * |
---|
| 56 | * @return the fully configured CheckAttributeSelection instance used for testing |
---|
| 57 | */ |
---|
| 58 | protected CheckAttributeSelection getTester() { |
---|
| 59 | CheckAttributeSelection result; |
---|
| 60 | |
---|
| 61 | result = super.getTester(); |
---|
| 62 | result.setTestEvaluator(false); |
---|
| 63 | |
---|
| 64 | return result; |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | /** |
---|
| 68 | * Configures the CheckOptionHandler uses for testing the optionhandling. |
---|
| 69 | * Sets the scheme to test. |
---|
| 70 | * |
---|
| 71 | * @return the fully configured CheckOptionHandler |
---|
| 72 | */ |
---|
| 73 | protected CheckOptionHandler getOptionTester() { |
---|
| 74 | CheckOptionHandler result; |
---|
| 75 | |
---|
| 76 | result = super.getOptionTester(); |
---|
| 77 | if (getSearch() instanceof OptionHandler) |
---|
| 78 | result.setOptionHandler((OptionHandler) getSearch()); |
---|
| 79 | |
---|
| 80 | return result; |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | /** |
---|
| 84 | * Configures the CheckGOE used for testing GOE stuff. |
---|
| 85 | * |
---|
| 86 | * @return the fully configured CheckGOE |
---|
| 87 | */ |
---|
| 88 | protected CheckGOE getGOETester() { |
---|
| 89 | CheckGOE result; |
---|
| 90 | |
---|
| 91 | result = super.getGOETester(); |
---|
| 92 | result.setObject(getSearch()); |
---|
| 93 | |
---|
| 94 | return result; |
---|
| 95 | } |
---|
| 96 | } |
---|