Java Doc for StringPattern.java in  » Net » j2ssh » com » sshtools » daemon » util » 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 » j2ssh » com.sshtools.daemon.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sshtools.daemon.util.StringPattern

StringPattern
public class StringPattern implements Serializable(Code)
This class provides services for checking strings against string-patterns. Currently it supports the wildcards
'' for any number of any character and
'?' for any one character. The API is very simple:

There are only the two class methods match() and matchIgnoreCase().
Example:
StringPattern.match( 'Hello World", "H W" ) ; --> evaluates to true
StringPattern.matchIgnoreCase( 'StringPattern", "str???pat" ) ; --> evaluates to true

author:
   Manfred Duchrow
version:
   1.7


Field Summary
final protected static  charMULTICHAR_WILDCARD
    
final protected static  StringMULTI_WILDCARD
    
final protected static  charSINGLECHAR_WILDCARD
    

Constructor Summary
public  StringPattern(String pattern, boolean ignoreCase)
     Initializes the new instance with the string pattern and the selecteion, if case should be ignored when comparing characters.
public  StringPattern(String pattern)
     Initializes the new instance with the string pattern.
public  StringPattern(String pattern, char digitWildcard)
     Initializes the new instance with the string pattern and a digit wildcard character.
public  StringPattern(String pattern, boolean ignoreCase, char digitWildcard)
     Initializes the new instance with the string pattern and the selecteion, if case should be ignored when comparing characters plus a wildcard character for digits.

Method Summary
protected  booleancharsAreEqual(char probeChar, char patternChar)
    
protected  CharacterdigitWildcard()
    
protected  voiddigitWildcard(Character newValue)
    
protected  chardigitWildcardChar()
    
protected  booleanendNotReached(char character)
    
protected  booleanendReached(char character)
    
public  booleangetIgnoreCase()
    
public  StringgetPattern()
     Returns the pattern as string.
protected  chargetPatternChar(StringExaminer patternIterator, char probeCh)
    
protected  booleanhasDigitWildcard()
    
public  booleanhasWildcard()
     Returns true if the pattern contains any '' or '?' wildcard character.
public static  booleanmatch(String probe, String pattern)
     Returns true, if the given probe string matches the given pattern.
public static  booleanmatchIgnoreCase(String probe, String pattern)
     Returns true, if the given probe string matches the given pattern.
protected  booleanmatchReverse(String pattern, StringExaminer probeIterator)
    
public  booleanmatches(String probe)
     Tests if a specified string matches the pattern.
protected  StringExaminernewExaminer(String str)
    
public  voidsetDigitWildcardChar(char digitWildcard)
     Sets the given character as a wildcard character in this pattern to match only digits ('0'-'9').
public  voidsetIgnoreCase(boolean newValue)
    
public  voidsetPattern(String newValue)
    
protected  booleanskipAfter(StringExaminer examiner, String matchString)
     Increments the given iterator up to the last character that matched the character sequence in the given matchString.
protected  charskipWildcards(StringExaminer iterator)
     Moves the iterator position to the next character that is no wildcard.
protected  StringUtilstrUtil()
    
public  StringtoString()
     Returns the pattern string.
protected  StringupToEnd(StringExaminer iterator)
    

Field Detail
MULTICHAR_WILDCARD
final protected static char MULTICHAR_WILDCARD(Code)



MULTI_WILDCARD
final protected static String MULTI_WILDCARD(Code)



SINGLECHAR_WILDCARD
final protected static char SINGLECHAR_WILDCARD(Code)




Constructor Detail
StringPattern
public StringPattern(String pattern, boolean ignoreCase)(Code)
Initializes the new instance with the string pattern and the selecteion, if case should be ignored when comparing characters.
Parameters:
  pattern - The pattern to check against ( May contain '' and '?'wildcards )
Parameters:
  ignoreCase - Definition, if case sensitive character comparison ornot.



StringPattern
public StringPattern(String pattern)(Code)
Initializes the new instance with the string pattern. The default is case sensitive checking.
Parameters:
  pattern - The pattern to check against ( May contain '' and '?'wildcards )



StringPattern
public StringPattern(String pattern, char digitWildcard)(Code)
Initializes the new instance with the string pattern and a digit wildcard character. The default is case sensitive checking.
Parameters:
  pattern - The pattern to check against ( May contain '', '?'wildcards and the digit wildcard )
Parameters:
  digitWildcard - A wildcard character that stands as placeholder fordigits



StringPattern
public StringPattern(String pattern, boolean ignoreCase, char digitWildcard)(Code)
Initializes the new instance with the string pattern and the selecteion, if case should be ignored when comparing characters plus a wildcard character for digits.
Parameters:
  pattern - The pattern to check against ( May contain '' and '?'wildcards )
Parameters:
  ignoreCase - Definition, if case sensitive character comparison ornot.
Parameters:
  digitWildcard - A wildcard character that stands as placeholder fordigits




Method Detail
charsAreEqual
protected boolean charsAreEqual(char probeChar, char patternChar)(Code)



digitWildcard
protected Character digitWildcard()(Code)



digitWildcard
protected void digitWildcard(Character newValue)(Code)

Parameters:
  newValue -



digitWildcardChar
protected char digitWildcardChar()(Code)



endNotReached
protected boolean endNotReached(char character)(Code)



endReached
protected boolean endReached(char character)(Code)



getIgnoreCase
public boolean getIgnoreCase()(Code)
Returns whether or not the pattern matching ignores upper and lower case



getPattern
public String getPattern()(Code)
Returns the pattern as string.



getPatternChar
protected char getPatternChar(StringExaminer patternIterator, char probeCh)(Code)



hasDigitWildcard
protected boolean hasDigitWildcard()(Code)



hasWildcard
public boolean hasWildcard()(Code)
Returns true if the pattern contains any '' or '?' wildcard character.



match
public static boolean match(String probe, String pattern)(Code)
Returns true, if the given probe string matches the given pattern.
The character comparison is done case sensitive.
Parameters:
  probe - The string to check against the pattern.
Parameters:
  pattern - The patter, that probably contains wildcards ( '' or '?')



matchIgnoreCase
public static boolean matchIgnoreCase(String probe, String pattern)(Code)
Returns true, if the given probe string matches the given pattern.
The character comparison is done ignoring upper/lower-case.
Parameters:
  probe - The string to check against the pattern.
Parameters:
  pattern - The patter, that probably contains wildcards ( '' or '?')



matchReverse
protected boolean matchReverse(String pattern, StringExaminer probeIterator)(Code)



matches
public boolean matches(String probe)(Code)
Tests if a specified string matches the pattern.
Parameters:
  probe - The string to compare to the pattern true if and only if the probe matches the pattern, falseotherwise.



newExaminer
protected StringExaminer newExaminer(String str)(Code)



setDigitWildcardChar
public void setDigitWildcardChar(char digitWildcard)(Code)
Sets the given character as a wildcard character in this pattern to match only digits ('0'-'9').

Parameters:
  digitWildcard - The placeholder character for digits



setIgnoreCase
public void setIgnoreCase(boolean newValue)(Code)
Sets whether the pattern matching should ignore case or not
Parameters:
  newValue -



setPattern
public void setPattern(String newValue)(Code)
Sets the pattern to a new value
Parameters:
  newValue -



skipAfter
protected boolean skipAfter(StringExaminer examiner, String matchString)(Code)
Increments the given iterator up to the last character that matched the character sequence in the given matchString. Returns true, if the matchString was found, otherwise false.
Parameters:
  examiner -
Parameters:
  matchString - The string to be found (must not contain )



skipWildcards
protected char skipWildcards(StringExaminer iterator)(Code)
Moves the iterator position to the next character that is no wildcard. Doesn't skip digit wildcards !
Parameters:
  iterator -



strUtil
protected StringUtil strUtil()(Code)



toString
public String toString()(Code)
Returns the pattern string.
See Also:   java.lang.Object.toString



upToEnd
protected String upToEnd(StringExaminer iterator)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.