Java Doc for GenericPatternCache.java in  » Library » jakarta-oro-2.0.8 » org » apache » oro » text » 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 » Library » jakarta oro 2.0.8 » org.apache.oro.text 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.oro.text.GenericPatternCache

All known Subclasses:   org.apache.oro.text.PatternCacheRandom,  org.apache.oro.text.PatternCacheFIFO,  org.apache.oro.text.PatternCacheLRU,  org.apache.oro.text.PatternCacheFIFO2,
GenericPatternCache
abstract public class GenericPatternCache implements PatternCache(Code)
This is the base class for all cache implementations provided in the org.apache.oro.text package. Although 4 subclasses of GenericPatternCache are provided with this package, users may not derive subclasses from this class. Rather, users should create their own implmentations of the PatternCache interface.
version:
   @version@
since:
   1.0
See Also:   PatternCache
See Also:   PatternCacheLRU
See Also:   PatternCacheFIFO
See Also:   PatternCacheFIFO2
See Also:   PatternCacheRandom


Field Summary
final public static  intDEFAULT_CAPACITY
     The default capacity to be used by the GenericPatternCache subclasses provided with this package.
 Cache_cache
    
 PatternCompiler_compiler
    

Constructor Summary
 GenericPatternCache(Cache cache, PatternCompiler compiler)
     The primary constructor for GenericPatternCache.

Method Summary
final public synchronized  PatternaddPattern(String expression, int options)
     Adds a pattern to the cache and returns the compiled pattern.
final public synchronized  PatternaddPattern(String expression)
    
final public  intcapacity()
     Returns the maximum number of patterns that can be cached at one time.
final public synchronized  PatterngetPattern(String expression, int options)
     This method fetches a pattern from the cache.
final public synchronized  PatterngetPattern(String expression)
    
final public  intsize()
     Returns the number of elements in the cache, not to be confused with the GenericPatternCache.capacity() which returns the number of elements that can be held in the cache at one time.

Field Detail
DEFAULT_CAPACITY
final public static int DEFAULT_CAPACITY(Code)
The default capacity to be used by the GenericPatternCache subclasses provided with this package. Its value is 20.



_cache
Cache _cache(Code)



_compiler
PatternCompiler _compiler(Code)




Constructor Detail
GenericPatternCache
GenericPatternCache(Cache cache, PatternCompiler compiler)(Code)
The primary constructor for GenericPatternCache. It has default access so it will only be used within the package. It initializes _cache and _compiler to the arguments provided.


Parameters:
  cache - The cache with which to store patterns.
Parameters:
  compiler - The PatternCompiler that should be used to compilepatterns.





Method Detail
addPattern
final public synchronized Pattern addPattern(String expression, int options) throws MalformedPatternException(Code)
Adds a pattern to the cache and returns the compiled pattern. This method is in principle almost identical to GenericPatternCache.getPattern getPattern() except for the fact that it throws a MalformedPatternException if an expression cannot be compiled.

addPattern() is meant to be used when you expressly intend to add an expression to the cache and is useful for front-loading a cache with expressions before use. If the expression added does not already exist in the cache, it is compiled, added to the cache, and returned. If the compiled expression is already in the cache, it is simply returned.

The expected behavior of this method should be to start replacing patterns in the cache only after the cache has been filled to capacity.


Parameters:
  expression - The regular expression to add to the cache.
Parameters:
  options - The compilation options to use when compiling theexpression. The Pattern corresponding to the String representation of theregular expression.
exception:
  MalformedPatternException - If there is an error in compilingthe regular expression.




addPattern
final public synchronized Pattern addPattern(String expression) throws MalformedPatternException(Code)
Same as calling
 addPattern(expression, 0);
 

exception:
  MalformedPatternException - If there is an error in compilingthe regular expression.



capacity
final public int capacity()(Code)
Returns the maximum number of patterns that can be cached at one time.

The maximum number of patterns that can be cached at one time.




getPattern
final public synchronized Pattern getPattern(String expression, int options) throws MalformedCachePatternException(Code)
This method fetches a pattern from the cache. It is nearly identical to GenericPatternCache.addPattern addPattern() except that it doesn't throw a MalformedPatternException. If the pattern is not in the cache, it is compiled, placed in the cache, and returned. If the pattern cannot be compiled successfully, it throws a MalformedCachePatternException. Note that this exception is derived from RuntimeException, which means you are NOT forced to catch it by the compiler. Please refer to MalformedCachePatternException for a discussion of when you should and shouldn't catch this exception.


Parameters:
  expression - The regular expression to fetch from the cache incompiled form.
Parameters:
  options - The compilation options to use when compiling theexpression. The Pattern corresponding to the String representation of theregular expression.
exception:
  MalformedCachePatternException - If there is an error incompiling the regular expression.




getPattern
final public synchronized Pattern getPattern(String expression) throws MalformedCachePatternException(Code)
Same as calling
 getPattern(expression, 0)
 



size
final public int size()(Code)
Returns the number of elements in the cache, not to be confused with the GenericPatternCache.capacity() which returns the number of elements that can be held in the cache at one time.

The current size of the cache (i.e., the number of elementscurrently cached).




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.