Source Code Cross Referenced for CVSArgumentVector.java in  » Source-Control » jcvsweb » com » ice » cvsc » 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 » Source Control » jcvsweb » com.ice.cvsc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         ** Java cvs client library package.
003:         ** Copyright (c) 1997-2002 by Timothy Gerard Endres
004:         ** 
005:         ** This program is free software.
006:         ** 
007:         ** You may redistribute it and/or modify it under the terms of the GNU
008:         ** Library General Public License (LGPL) as published by the Free Software
009:         ** Foundation.
010:         **
011:         ** Version 2 of the license should be included with this distribution in
012:         ** the file LICENSE.txt, as well as License.html. If the license is not
013:         ** included	with this distribution, you may find a copy at the FSF web
014:         ** site at 'www.gnu.org' or 'www.fsf.org', or you may write to the Free
015:         ** Software Foundation at 59 Temple Place - Suite 330, Boston, MA 02111 USA.
016:         **
017:         ** THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY OF ANY KIND,
018:         ** NOT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY. THE AUTHOR
019:         ** OF THIS SOFTWARE, ASSUMES _NO_ RESPONSIBILITY FOR ANY
020:         ** CONSEQUENCE RESULTING FROM THE USE, MODIFICATION, OR
021:         ** REDISTRIBUTION OF THIS SOFTWARE. 
022:         ** 
023:         */
024:
025:        package com.ice.cvsc;
026:
027:        import java.lang.*;
028:        import java.util.*;
029:
030:        /**
031:         * Implements a Vector subclass that handles CVS Arguments used
032:         * in CVSRequest objects.
033:         *
034:         * @version $Revision: 2.3 $
035:         * @author Timothy Gerard Endres, <a href="mailto:time@ice.com">time@ice.com</a>.
036:         * @see CVSClient
037:         * @see CVSProject
038:         */
039:
040:        public class CVSArgumentVector extends Vector {
041:            static public final String RCS_ID = "$Id: CVSArgumentVector.java,v 2.3 2003/07/27 01:08:32 time Exp $";
042:            static public final String RCS_REV = "$Revision: 2.3 $";
043:
044:            public CVSArgumentVector() {
045:                super ();
046:            }
047:
048:            public CVSArgumentVector(int initCap) {
049:                super (initCap);
050:            }
051:
052:            public CVSArgumentVector(int initCap, int capIncr) {
053:                super (initCap, capIncr);
054:            }
055:
056:            public String argumentAt(int index) {
057:                return (String) this .elementAt(index);
058:            }
059:
060:            public void appendArgument(String argument) {
061:                this .addElement(argument);
062:            }
063:
064:            public void appendArguments(Vector args) {
065:                for (int i = 0, sz = args.size(); i < sz; ++i)
066:                    this .addElement(args.elementAt(i));
067:            }
068:
069:            public boolean containsArgument(String argument) {
070:                int i;
071:                String argStr;
072:
073:                for (i = 0; i < this .size(); ++i) {
074:                    argStr = (String) this .elementAt(i);
075:
076:                    if (argStr.equals(argument))
077:                        return true;
078:
079:                    if (argStr.startsWith("-")) {
080:                        ++i; // skip this argument's parameter
081:                    }
082:                }
083:
084:                return false;
085:            }
086:
087:            public boolean containsString(String string) {
088:                int i;
089:                String argStr;
090:
091:                for (i = 0; i < this .size(); ++i) {
092:                    argStr = (String) this .elementAt(i);
093:
094:                    if (argStr.equals(string))
095:                        return true;
096:                }
097:
098:                return false;
099:            }
100:
101:            public static CVSArgumentVector parseArgumentString(String argStr) {
102:                String token;
103:                String newDelim = null;
104:                boolean matchQuote = false;
105:
106:                CVSArgumentVector result = new CVSArgumentVector();
107:
108:                StringTokenizer toker = new StringTokenizer(argStr, " '\"",
109:                        true);
110:
111:                boolean startArg = true;
112:                StringBuffer argBuf = new StringBuffer(argStr.length());
113:
114:                for (; toker.hasMoreTokens();) {
115:                    try {
116:                        token = (newDelim == null ? toker.nextToken() : toker
117:                                .nextToken(newDelim));
118:
119:                        newDelim = null;
120:                    } catch (NoSuchElementException ex) {
121:                        break;
122:                    }
123:
124:                    if (token.equals(" ")) {
125:                        if (!startArg) {
126:                            result.addElement(argBuf.toString());
127:                            argBuf.setLength(0);
128:                        }
129:                        startArg = true;
130:                        continue;
131:                    } else if (token.equals("'")) {
132:                        startArg = false;
133:                        if (matchQuote) {
134:                            newDelim = " '\"";
135:                            matchQuote = false;
136:                        } else {
137:                            newDelim = "'";
138:                            matchQuote = true;
139:                        }
140:                    } else if (token.equals("\"")) {
141:                        startArg = false;
142:                        if (matchQuote) {
143:                            newDelim = " '\"";
144:                            matchQuote = false;
145:                        } else {
146:                            newDelim = "\"";
147:                            matchQuote = true;
148:                        }
149:                    } else {
150:                        startArg = false;
151:                        argBuf.append(token);
152:                    }
153:                }
154:
155:                if (!startArg) {
156:                    result.addElement(argBuf.toString());
157:                }
158:
159:                return result;
160:            }
161:
162:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.