Source Code Cross Referenced for RETokenPOSIX.java in  » Template-Engine » JDynamiTe » gnu » regexp » 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 » Template Engine » JDynamiTe » gnu.regexp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  gnu/regexp/RETokenPOSIX.java
003:         *  Copyright (C) 1998 Wes Biggs
004:         *
005:         *  This library is free software; you can redistribute it and/or modify
006:         *  it under the terms of the GNU Library General Public License as published
007:         *  by the Free Software Foundation; either version 2 of the License, or
008:         *  (at your option) any later version.
009:         *
010:         *  This library is distributed in the hope that it will be useful,
011:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013:         *  GNU Library General Public License for more details.
014:         *
015:         *  You should have received a copy of the GNU Library General Public License
016:         *  along with this program; if not, write to the Free Software
017:         *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
018:         */
019:
020:        package gnu.regexp;
021:
022:        import java.util.Hashtable;
023:
024:        class RETokenPOSIX extends REToken {
025:            int m_type;
026:            boolean m_insens;
027:            boolean m_negated;
028:
029:            static final int ALNUM = 0;
030:            static final int ALPHA = 1;
031:            static final int BLANK = 2;
032:            static final int CNTRL = 3;
033:            static final int DIGIT = 4;
034:            static final int GRAPH = 5;
035:            static final int LOWER = 6;
036:            static final int PRINT = 7;
037:            static final int PUNCT = 8;
038:            static final int SPACE = 9;
039:            static final int UPPER = 10;
040:            static final int XDIGIT = 11;
041:
042:            // Array indices correspond to constants defined above.
043:            static final String[] s_nameTable = { "alnum", "alpha", "blank",
044:                    "cntrl", "digit", "graph", "lower", "print", "punct",
045:                    "space", "upper", "xdigit" };
046:
047:            // The RE constructor uses this to look up the constant for a string
048:            static int intValue(String key) {
049:                for (int i = 0; i < s_nameTable.length; i++) {
050:                    if (s_nameTable[i].equals(key))
051:                        return i;
052:                }
053:                return -1;
054:            }
055:
056:            RETokenPOSIX(int f_subIndex, int f_type, boolean f_insens,
057:                    boolean f_negated) {
058:                super (f_subIndex);
059:                m_type = f_type;
060:                m_insens = f_insens;
061:                m_negated = f_negated;
062:            }
063:
064:            int getMinimumLength() {
065:                return 1;
066:            }
067:
068:            int[] match(CharIndexed input, int index, int eflags,
069:                    REMatch mymatch) {
070:                char ch = input.charAt(index);
071:                if (ch == CharIndexed.OUT_OF_BOUNDS)
072:                    return null;
073:
074:                boolean retval = false;
075:                switch (m_type) {
076:                case ALNUM:
077:                    retval = Character.isLetterOrDigit(ch);
078:                    break;
079:                case ALPHA:
080:                    retval = Character.isLetter(ch);
081:                    break;
082:                case BLANK:
083:                    retval = ((ch == ' ') || (ch == '\t'));
084:                    break;
085:                case CNTRL:
086:                    retval = Character.isISOControl(ch);
087:                    break;
088:                case DIGIT:
089:                    retval = Character.isDigit(ch);
090:                    break;
091:                case GRAPH:
092:                    retval = (!(Character.isWhitespace(ch) || Character
093:                            .isISOControl(ch)));
094:                    break;
095:                case LOWER:
096:                    retval = ((m_insens && Character.isLetter(ch)) || Character
097:                            .isLowerCase(ch));
098:                    break;
099:                case PRINT:
100:                    retval = Character.isLetterOrDigit(ch);
101:                    break;
102:                case PUNCT:
103:                    retval = ("`~!@#$%^&*()-_=+[]{}\\|;:'\"/?,.<>".indexOf(ch) != -1);
104:                    break;
105:                case SPACE:
106:                    retval = Character.isWhitespace(ch);
107:                    break;
108:                case UPPER:
109:                    retval = ((m_insens && Character.isLetter(ch)) || Character
110:                            .isUpperCase(ch));
111:                    break;
112:                case XDIGIT:
113:                    retval = (Character.isDigit(ch) || ("abcdefABCDEF"
114:                            .indexOf(ch) != -1));
115:                    break;
116:                }
117:
118:                if (m_negated)
119:                    retval = !retval;
120:                if (retval)
121:                    return next(input, index + 1, eflags, mymatch);
122:                else
123:                    return null;
124:            }
125:
126:            void dump(StringBuffer os) {
127:                if (m_negated)
128:                    os.append('^');
129:                os.append("[:" + s_nameTable[m_type] + ":]");
130:            }
131:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.