Source Code Cross Referenced for Tag.java in  » Science » weka » weka » core » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Science » weka » weka.core 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    This program is free software; you can redistribute it and/or modify
003:         *    it under the terms of the GNU General Public License as published by
004:         *    the Free Software Foundation; either version 2 of the License, or
005:         *    (at your option) any later version.
006:         *
007:         *    This program is distributed in the hope that it will be useful,
008:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
009:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
010:         *    GNU General Public License for more details.
011:         *
012:         *    You should have received a copy of the GNU General Public License
013:         *    along with this program; if not, write to the Free Software
014:         *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
015:         */
016:
017:        /*
018:         *    Tag.java
019:         *    Copyright (C) 1999 University of Waikato, Hamilton, New Zealand
020:         *
021:         */
022:
023:        package weka.core;
024:
025:        /**
026:         * A <code>Tag</code> simply associates a numeric ID with a String description.
027:         *
028:         * @author <a href="mailto:len@reeltwo.com">Len Trigg</a>
029:         * @version $Revision: 1.9 $
030:         */
031:        public class Tag {
032:
033:            /** The ID */
034:            protected int m_ID;
035:
036:            /** The unique string for this tag, doesn't have to be numeric */
037:            protected String m_IDStr;
038:
039:            /** The descriptive text */
040:            protected String m_Readable;
041:
042:            /**
043:             * Creates a new <code>Tag</code> instance.
044:             *
045:             * @param ident the ID for the new Tag.
046:             * @param readable the description for the new Tag.
047:             */
048:            public Tag(int ident, String readable) {
049:                this (ident, "", readable);
050:            }
051:
052:            /**
053:             * Creates a new <code>Tag</code> instance.
054:             *
055:             * @param ident the ID for the new Tag.
056:             * @param identStr the ID string for the new Tag (case-insensitive).
057:             * @param readable the description for the new Tag.
058:             */
059:            public Tag(int ident, String identStr, String readable) {
060:                m_ID = ident;
061:                if (identStr.length() == 0)
062:                    m_IDStr = "" + ident;
063:                else
064:                    m_IDStr = identStr.toUpperCase();
065:                m_Readable = readable;
066:            }
067:
068:            /**
069:             * Gets the numeric ID of the Tag.
070:             *
071:             * @return the ID of the Tag.
072:             */
073:            public int getID() {
074:                return m_ID;
075:            }
076:
077:            /**
078:             * Gets the string ID of the Tag.
079:             *
080:             * @return the string ID of the Tag.
081:             */
082:            public String getIDStr() {
083:                return m_IDStr;
084:            }
085:
086:            /**
087:             * Gets the string description of the Tag.
088:             *
089:             * @return the description of the Tag.
090:             */
091:            public String getReadable() {
092:                return m_Readable;
093:            }
094:
095:            /**
096:             * returns the IDStr
097:             * 
098:             * @return the IDStr
099:             */
100:            public String toString() {
101:                return m_IDStr;
102:            }
103:
104:            /**
105:             * returns a list that can be used in the listOption methods to list all
106:             * the available ID strings, e.g.: &lt;0|1|2&gt; or &lt;what|ever&gt;
107:             * 
108:             * @param tags the tags to create the list for
109:             * @return a list of all ID strings
110:             */
111:            public static String toOptionList(Tag[] tags) {
112:                String result;
113:                int i;
114:
115:                result = "<";
116:                for (i = 0; i < tags.length; i++) {
117:                    if (i > 0)
118:                        result += "|";
119:                    result += tags[i];
120:                }
121:                result += ">";
122:
123:                return result;
124:            }
125:
126:            /**
127:             * returns a string that can be used in the listOption methods to list all
128:             * the available options, i.e., "\t\tID = Text\n" for each option
129:             * 
130:             * @param tags the tags to create the string for
131:             * @return a string explaining the tags
132:             */
133:            public static String toOptionSynopsis(Tag[] tags) {
134:                String result;
135:                int i;
136:
137:                result = "";
138:                for (i = 0; i < tags.length; i++) {
139:                    result += "\t\t" + tags[i].getIDStr() + " = "
140:                            + tags[i].getReadable() + "\n";
141:                }
142:
143:                return result;
144:            }
145:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.