帮忙注释一下这个字符串匹配方法,没看懂呀
Java codeimport java.io.*;import java.util.*;public class FileDemo06 { //查找符合条件的文件,并返回一个文件名列表 public static List<File> findFiles(String baseDirName, String targetFileName, int count) { LinkedList<File> fileList = new LinkedList<File>(); //创建一个列表,里面装目录或子目录 LinkedList<File> fileList2 = new LinkedList<File>(); //创建一个列表,里面装搜到的文件 File baseDir = new File(baseDirName); if(!baseDir.exists() || !baseDir.isDirectory()) { System.out.println("文件查找失败," + baseDirName + " 不是一个目录!"); return fileList2; } String tempName = null; fileList.addLast(baseDir); File tempFile = null; while(!fileList.isEmpty()) { tempFile = fileList.removeFirst(); //将列表中的第一个元素取出并删除 if(tempFile.exists() && tempFile.isDirectory()) { File[] files = tempFile.listFiles(); for(int i = 0; i < files.length; i ++) { //如果是目录则放进队列 if(files[i].isDirectory()) fileList.add(files[i]); else { //如果是文件则根据文件名与目标文件名进行匹配 tempName = files[i].getName(); if(matchWord(targetFileName, tempName)) { //匹配成功,将文件名添加到结果集 fileList2.add(files[i].getAbsoluteFile()); //如果已经达到指定的数目,则退出循环 if(count != 0 && fileList2.size() > count) { return fileList; } } } } } } return fileList2; } //文件名的通配符匹配,如果匹配成功则返回 true,否则返回 false public static boolean matchWord(String pattern, String str) { int patternLength = pattern.length(); int strLength = str.length(); int strIndex = 0; char ch; for(int patternIndex = 0; patternIndex < patternLength; patternIndex ++) { ch = pattern.charAt(patternIndex); if(ch == '*') { //通配符 * 表示可以匹配任意多个字符 while(strIndex < strLength) { if(matchWord(pattern.substring(patternIndex + 1), str.substring(strIndex))) { return true; } strIndex ++; } } HTTP/1.1 200 OKServer: nginx/0.7.68Date: Fri, 02 Nov 2012 02:14:23 GMTContent-Type: text/html; charset=utf-8Connection: keep-aliveVary: Accept-EncodingX-Powered-By: ASP.NETLast-modified: 2012-10-23 17:58:48Content-Length: 159016Cache-control: private50分相送,急问Hbiernate中“insert into select”的写法? - Java / Java SE