Source Code Cross Referenced for PAutomaton.java in  » Net » Terracotta » com » tc » jrexx » regex » 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 » Net » Terracotta » com.tc.jrexx.regex 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * 01/07/2003 - 15:19:32
003:         *
004:         * PAutomaton.java -
005:         * Copyright (C) 2003 Buero fuer Softwarearchitektur GbR
006:         * ralf.meyer@karneim.com
007:         * http://jrexx.sf.net
008:         *
009:         * This program is free software; you can redistribute it and/or
010:         * modify it under the terms of the GNU Lesser General Public License
011:         * as published by the Free Software Foundation; either version 2
012:         * of the License, or (at your option) any later version.
013:         *
014:         * This program is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
017:         * GNU Lesser General Public License for more details.
018:         *
019:         * You should have received a copy of the GNU Lesser General Public License
020:         * along with this program; if not, write to the Free Software
021:         * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
022:         */
023:        package com.tc.jrexx.regex;
024:
025:        import com.tc.jrexx.set.*;
026:
027:        import java.util.*;
028:        import java.io.*;
029:
030:        public class PAutomaton extends SAutomaton {
031:            private static final HashMap AUTOMATON_MAP = new HashMap();
032:
033:            protected PAutomaton(Automaton_Pattern automaton) {
034:                super (automaton);
035:            }
036:
037:            protected AutomatonSet_String getAutomaton() {
038:                return this .automaton;
039:            }
040:
041:            public PAutomaton() {
042:                super (new Automaton_Pattern());
043:            }
044:
045:            public PAutomaton(String regEx) {
046:                super (new Automaton_Pattern(regEx));
047:            }
048:
049:            public PAutomaton(FSAData data) {
050:                super (new Automaton_Pattern());
051:                this .init(data);
052:            }
053:
054:            public PAutomaton(InputStream automatonDataStream)
055:                    throws java.io.IOException, ClassNotFoundException {
056:                super (new Automaton_Pattern());
057:                //    this.init((FSAData)automatonDataStream.readObject());
058:                this .init(toFSAData(new ObjectInputStream(automatonDataStream)
059:                        .readObject()));
060:                try {
061:                    ObjectInputStream oin = new ObjectInputStream(
062:                            automatonDataStream) {
063:                        /**
064:                         * The readStreamHeader method is provided to allow subclasses to
065:                         * read and verify their own stream headers. It reads and
066:                         * verifies the magic number and version number.
067:                         *
068:                         * @throws IOException if there are I/O errors while reading from the
069:                         * underlying <code>InputStream</code>
070:                         * @throws StreamCorruptedException if control information in the
071:                         * stream is inconsistent
072:                         */
073:                        protected void readStreamHeader() throws IOException,
074:                                StreamCorruptedException {
075:                            short incoming_magic = 0;
076:                            short incoming_version = 0;
077:                            //            try {
078:                            incoming_magic = readShort();
079:                            incoming_version = readShort();
080:                            //            } catch (EOFException e) {
081:                            //                throw new StreamCorruptedException("Caught EOFException " +
082:                            //                                                   "while reading the stream header");
083:                            //            }
084:                            if (incoming_magic != STREAM_MAGIC)
085:                                throw new StreamCorruptedException(
086:                                        "InputStream does not contain a serialized object");
087:
088:                            if (incoming_version != STREAM_VERSION)
089:                                throw new StreamCorruptedException(
090:                                        "Version Mismatch, Expected "
091:                                                + STREAM_VERSION + " and got "
092:                                                + incoming_version);
093:                        }
094:                    };
095:                    ((Automaton_Pattern) this .automaton).regEx = (String) oin
096:                            .readObject();
097:                } catch (EOFException e) {
098:
099:                }
100:            }
101:
102:            /**
103:             * writes this.toData() to the automatonDataStream and appends this.getRegEx() to the automatonDataStream.
104:             */
105:            public void toData(OutputStream automatonDataStream)
106:                    throws IOException {
107:                super .toData(automatonDataStream);
108:                ObjectOutputStream oOut = new ObjectOutputStream(
109:                        automatonDataStream) {
110:                    /**
111:                     * The writeStreamHeader method is provided so subclasses can
112:                     * append or prepend their own header to the stream.
113:                     * It writes the magic number and version to the stream.
114:                     *
115:                     * @throws IOException if I/O errors occur while writing to the underlying
116:                     * stream
117:                     */
118:                    protected void writeStreamHeader() throws IOException {
119:                        writeShort(STREAM_MAGIC);
120:                        writeShort(STREAM_VERSION);
121:                    }
122:                };
123:
124:                oOut.writeObject(this .getRegEx());
125:            }
126:
127:            public void addAll(String regEx) {
128:                ((Automaton_Pattern) this .automaton).addAll(regEx);
129:            }
130:
131:            public void retainAll(String regEx) {
132:                ((Automaton_Pattern) this .automaton).retainAll(regEx);
133:            }
134:
135:            public void removeAll(String regEx) {
136:                ((Automaton_Pattern) this .automaton).removeAll(regEx);
137:            }
138:
139:            public String getRegEx() {
140:                return ((Automaton_Pattern) this.automaton).regEx;
141:            }
142:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.