filenamefilter.java

来自「一个非常著名的网格模拟器,能够运行网格调度算法!」· Java 代码 · 共 53 行

JAVA
53
字号
/* * Title:        GridSim Toolkit * Description:  GridSim (Grid Simulation) Toolkit for Modeling and Simulation *               of Parallel and Distributed Systems such as Clusters and Grids * Licence:      GPL - http://www.gnu.org/copyleft/gpl.html */package gridsim.datagrid.filter;import gridsim.datagrid.FileAttribute;/** * Creates a filter based on a file name * @author  Uros Cibej and Anthony Sulistio * @since   GridSim Toolkit 4.0 */public class FileNameFilter extends Filter {    private String name_;   // file name    /**     * Creates a new filtering function based on a given filename     * @param fileName  a file name     */    public FileNameFilter(String fileName) {        name_ = fileName;    }    /**     * For each file in the Replica Catalogue list,     * check whether it contains     * a FileAttribute object with a matching file name     * @param attr  a FileAttribute object to compare to     * @return <tt>true</tt> if matching, <tt>false</tt> otherwise     */    public boolean match(FileAttribute attr) {        // check for errors first        if (attr == null || name_ == null) {            return false;        }        // check based on the file name        if (attr.getName().startsWith(name_) == true) {            return true;        } else {            return false;        }    }} // end class

⌨️ 快捷键说明

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