Source Code Cross Referenced for Pattern.java in  » Parser » chaperon-3.0 » net » sourceforge » chaperon » model » extended » 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 » Parser » chaperon 3.0 » net.sourceforge.chaperon.model.extended 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Copyright (C) Chaperon. All rights reserved.
003:         *  -------------------------------------------------------------------------
004:         *  This software is published under the terms of the Apache Software License
005:         *  version 1.1, a copy of which has been included  with this distribution in
006:         *  the LICENSE file.
007:         */
008:
009:        package net.sourceforge.chaperon.model.extended;
010:
011:        import net.sourceforge.chaperon.model.Violations;
012:
013:        import java.io.Serializable;
014:
015:        /**
016:         * This class describes an abstract pattern element.
017:         *
018:         * @author <a href="mailto:stephan@apache.org">Stephan Michels</a>
019:         * @version CVS $Id: Pattern.java,v 1.10 2004/01/08 11:30:52 benedikta Exp $
020:         */
021:        public abstract class Pattern implements  Serializable, Cloneable {
022:            private String location = null;
023:            private static int internalPatternCount = 0;
024:            public final int index = internalPatternCount++;
025:            private Definition definition = null;
026:            private PatternSet ancestors = new PatternSet();
027:            private PatternSet successors = new PatternSet();
028:            private PatternSet ascendingAncestors = new PatternSet();
029:            private PatternSet ascendingSuccessors = new PatternSet();
030:            private PatternSet descendingAncestors = new PatternSet();
031:            private PatternSet descendingSuccessors = new PatternSet();
032:
033:            public abstract boolean isNullable();
034:
035:            public abstract PatternSet getFirstSet();
036:
037:            public abstract PatternSet getLastSet();
038:
039:            public abstract boolean contains(char c);
040:
041:            public abstract char[] getLimits();
042:
043:            public abstract boolean contains(char minimum, char maximum);
044:
045:            public abstract String getSymbol();
046:
047:            public PatternSet getAllPattern() {
048:                PatternSet set = new PatternSet();
049:                set.addPattern(this );
050:                return set;
051:            }
052:
053:            public void setDefinition(Definition definition) {
054:                this .definition = definition;
055:            }
056:
057:            public Definition getDefinition() {
058:                return definition;
059:            }
060:
061:            public PatternIterator getAncestors() {
062:                return ancestors.getPattern();
063:            }
064:
065:            public boolean hasAncestor(Pattern pattern) {
066:                for (PatternIterator ancestor = ancestors.getPattern(); ancestor
067:                        .hasNext();)
068:                    if (ancestor.next() == pattern)
069:                        return true;
070:
071:                return false;
072:            }
073:
074:            public boolean addSuccessor(Pattern pattern) {
075:                return successors.addPattern(pattern)
076:                        | pattern.ancestors.addPattern(this );
077:            }
078:
079:            public PatternIterator getSuccessors() {
080:                return successors.getPattern();
081:            }
082:
083:            public boolean hasSuccessor(Pattern pattern) {
084:                for (PatternIterator successor = successors.getPattern(); successor
085:                        .hasNext();)
086:                    if (successor.next() == pattern)
087:                        return true;
088:
089:                return false;
090:            }
091:
092:            public PatternIterator getAscendingAncestors() {
093:                return ascendingAncestors.getPattern();
094:            }
095:
096:            public boolean hasAscendingAncestor(Pattern pattern) {
097:                for (PatternIterator ancestor = ascendingAncestors.getPattern(); ancestor
098:                        .hasNext();)
099:                    if (ancestor.next() == pattern)
100:                        return true;
101:
102:                return false;
103:            }
104:
105:            public boolean addAscendingSuccessor(Pattern pattern) {
106:                return ascendingSuccessors.addPattern(pattern)
107:                        | pattern.ascendingAncestors.addPattern(this );
108:            }
109:
110:            public PatternIterator getAscendingSuccessors() {
111:                return ascendingSuccessors.getPattern();
112:            }
113:
114:            public boolean hasAscendingSuccessor(Pattern pattern) {
115:                for (PatternIterator successor = ascendingSuccessors
116:                        .getPattern(); successor.hasNext();)
117:                    if (successor.next() == pattern)
118:                        return true;
119:
120:                return false;
121:            }
122:
123:            public PatternIterator getDescendingAncestors() {
124:                return descendingAncestors.getPattern();
125:            }
126:
127:            public boolean hasDescendingAncestor(Pattern pattern) {
128:                for (PatternIterator ancestor = descendingAncestors
129:                        .getPattern(); ancestor.hasNext();)
130:                    if (ancestor.next() == pattern)
131:                        return true;
132:
133:                return false;
134:            }
135:
136:            public boolean addDescendingSuccessor(Pattern pattern) {
137:                return descendingSuccessors.addPattern(pattern)
138:                        | pattern.descendingAncestors.addPattern(this );
139:            }
140:
141:            public PatternIterator getDescendingSuccessors() {
142:                return descendingSuccessors.getPattern();
143:            }
144:
145:            public boolean hasDescendingSuccessor(Pattern pattern) {
146:                for (PatternIterator successor = descendingSuccessors
147:                        .getPattern(); successor.hasNext();)
148:                    if (successor.next() == pattern)
149:                        return true;
150:
151:                return false;
152:            }
153:
154:            public void update() {
155:                ancestors.clear();
156:                successors.clear();
157:                ascendingAncestors.clear();
158:                ascendingSuccessors.clear();
159:                descendingAncestors.clear();
160:                descendingSuccessors.clear();
161:            }
162:
163:            /**
164:             * Create a clone this pattern.
165:             *
166:             * @return Clone of this pattern.
167:             *
168:             * @throws CloneNotSupportedException If an exception occurs during the cloning.
169:             */
170:            public abstract Object clone() throws CloneNotSupportedException;
171:
172:            /**
173:             * Set the location from the input source.
174:             *
175:             * @param location Location in the input source.
176:             */
177:            public void setLocation(String location) {
178:                this .location = location;
179:            }
180:
181:            /**
182:             * Returns the location from the input source.
183:             *
184:             * @return Location in the input source.
185:             */
186:            public String getLocation() {
187:                return location;
188:            }
189:
190:            /**
191:             * Validates this pattern.
192:             *
193:             * @return Return a list of violations, if this pattern isn't valid.
194:             */
195:            public abstract Violations validate();
196:
197:            public String toString(PatternSet previous, PatternSet next) {
198:                if ((previous != null) && (previous.contains(this ))) {
199:                    if ((next != null) && (next.contains(this )))
200:                        return "." + toString() + ".";
201:                    else
202:                        return toString() + ".";
203:                } else if ((next != null) && (next.contains(this )))
204:                    return "." + toString();
205:
206:                return toString();
207:            }
208:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.