⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 abstractstringmatcher.java

📁 java版的数据结构的完全代码 免费提供了 学习数据结构的请下载
💻 JAVA
字号:
// Introduced in Chapter 13/** Searches for a pattern String in various text Strings. */public abstract class AbstractStringMatcher {  /** The pattern being sought. */  private String pattern;  /** Pattern is the pattern being sought. */  public AbstractStringMatcher(String pattern) {    this.pattern = pattern;  }  /** Return the pattern this StringMatcher seeks. */  protected String getPattern() {    return pattern;  }  /** Return true if the pattern appears in text at position. */  protected boolean matchAt(String text, int position) {    for (int i = 0; i < pattern.length(); i++) {      if (pattern.charAt(i) != text.charAt(i + position)) {        return false;      }    }    return true;  }  /**   * Return the index of the first appearance of the pattern in   * text, or -1 if it does not appear.   */  public abstract int match(String text);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -