| 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 | *    Option.java | 
|---|
| 19 | *    Copyright (C) 1999 University of Waikato, Hamilton, New Zealand | 
|---|
| 20 | * | 
|---|
| 21 | */ | 
|---|
| 22 |  | 
|---|
| 23 | package weka.core; | 
|---|
| 24 |  | 
|---|
| 25 | /** | 
|---|
| 26 | * Class to store information about an option. <p> | 
|---|
| 27 | * | 
|---|
| 28 | * Typical usage: <p> | 
|---|
| 29 | * | 
|---|
| 30 | * <code>Option myOption = new Option("Uses extended mode.", "E", 0, "-E")); </code><p> | 
|---|
| 31 | * | 
|---|
| 32 | * @author Eibe Frank (eibe@cs.waikato.ac.nz) | 
|---|
| 33 | * @version $Revision: 5953 $ | 
|---|
| 34 | */ | 
|---|
| 35 | public class Option | 
|---|
| 36 | implements RevisionHandler { | 
|---|
| 37 |  | 
|---|
| 38 | /** What does this option do? */ | 
|---|
| 39 | private String m_Description; | 
|---|
| 40 |  | 
|---|
| 41 | /** The synopsis. */ | 
|---|
| 42 | private String m_Synopsis; | 
|---|
| 43 |  | 
|---|
| 44 | /** What's the option's name? */ | 
|---|
| 45 | private String m_Name; | 
|---|
| 46 |  | 
|---|
| 47 | /** How many arguments does it take? */ | 
|---|
| 48 | private int m_NumArguments; | 
|---|
| 49 |  | 
|---|
| 50 | /** | 
|---|
| 51 | * Creates new option with the given parameters. | 
|---|
| 52 | * | 
|---|
| 53 | * @param description the option's description | 
|---|
| 54 | * @param name the option's name | 
|---|
| 55 | * @param numArguments the number of arguments | 
|---|
| 56 | */ | 
|---|
| 57 | public Option(String description, String name, | 
|---|
| 58 | int numArguments, String synopsis) { | 
|---|
| 59 |  | 
|---|
| 60 | m_Description = description; | 
|---|
| 61 | m_Name = name; | 
|---|
| 62 | m_NumArguments = numArguments; | 
|---|
| 63 | m_Synopsis = synopsis; | 
|---|
| 64 | } | 
|---|
| 65 |  | 
|---|
| 66 | /** | 
|---|
| 67 | * Returns the option's description. | 
|---|
| 68 | * | 
|---|
| 69 | * @return the option's description | 
|---|
| 70 | */ | 
|---|
| 71 | public String description() { | 
|---|
| 72 |  | 
|---|
| 73 | return m_Description; | 
|---|
| 74 | } | 
|---|
| 75 |  | 
|---|
| 76 | /** | 
|---|
| 77 | * Returns the option's name. | 
|---|
| 78 | * | 
|---|
| 79 | * @return the option's name | 
|---|
| 80 | */ | 
|---|
| 81 | public String name() { | 
|---|
| 82 |  | 
|---|
| 83 | return m_Name; | 
|---|
| 84 | } | 
|---|
| 85 |  | 
|---|
| 86 | /** | 
|---|
| 87 | * Returns the option's number of arguments. | 
|---|
| 88 | * | 
|---|
| 89 | * @return the option's number of arguments | 
|---|
| 90 | */ | 
|---|
| 91 | public int numArguments() { | 
|---|
| 92 |  | 
|---|
| 93 | return m_NumArguments; | 
|---|
| 94 | } | 
|---|
| 95 |  | 
|---|
| 96 | /** | 
|---|
| 97 | * Returns the option's synopsis. | 
|---|
| 98 | * | 
|---|
| 99 | * @return the option's synopsis | 
|---|
| 100 | */ | 
|---|
| 101 | public String synopsis() { | 
|---|
| 102 |  | 
|---|
| 103 | return m_Synopsis; | 
|---|
| 104 | } | 
|---|
| 105 |  | 
|---|
| 106 | /** | 
|---|
| 107 | * Returns the revision string. | 
|---|
| 108 | * | 
|---|
| 109 | * @return            the revision | 
|---|
| 110 | */ | 
|---|
| 111 | public String getRevision() { | 
|---|
| 112 | return RevisionUtils.extract("$Revision: 5953 $"); | 
|---|
| 113 | } | 
|---|
| 114 | } | 
|---|
| 115 |  | 
|---|