- Design Patterns and Best Practices in Java
- Kamalmeet Singh Adrian Ianculescu LUCIAN PAUL TORJE
- 98字
- 2021-06-25 20:52:37
Applicability and examples
The interpreter pattern can be used whenever an expression should be interpreted and transformed to its internal representation. The pattern cannot be applied to complex grammars since the internal representation is based on a composite pattern.
Java implements the interpreter pattern in java.util.Parser and it is used to interpret regular expressions. First, when a regular expression is interpreted, a matcher object is returned. The matcher uses the internal structure that was created by the pattern class based on the regular expression:
Pattern p = Pattern. compile("a*b");
Matcher m = p.matcher ("aaaaab");
boolean b = m.matches();
推薦閱讀
- Dynamics 365 for Finance and Operations Development Cookbook(Fourth Edition)
- 新一代通用視頻編碼H.266/VVC:原理、標準與實現
- PHP程序設計(慕課版)
- Java高手真經(高級編程卷):Java Web高級開發技術
- Java加密與解密的藝術(第2版)
- Neo4j Essentials
- SEO實戰密碼
- Hands-On Natural Language Processing with Python
- Kotlin編程實戰:創建優雅、富于表現力和高性能的JVM與Android應用程序
- 用案例學Java Web整合開發
- 持續集成與持續交付實戰:用Jenkins、Travis CI和CircleCI構建和發布大規模高質量軟件
- 深入實踐Kotlin元編程
- SQL Server 2008 R2數據庫技術及應用(第3版)
- Vue.js光速入門及企業項目開發實戰
- Hack與HHVM權威指南