01: /*
02: * This file or a portion of this file is licensed under the terms of
03: * the Globus Toolkit Public License, found in file GTPL, or at
04: * http://www.globus.org/toolkit/download/license.html. This notice must
05: * appear in redistributions of this file, with or without modification.
06: *
07: * Redistributions of this Software, with or without modification, must
08: * reproduce the GTPL in: (1) the Software, or (2) the Documentation or
09: * some other similar material which is provided with the Software (if
10: * any).
11: *
12: * Copyright 1999-2004 University of Chicago and The University of
13: * Southern California. All rights reserved.
14: */
15: package org.griphyn.vdl.diagnozer;
16:
17: import java.io.*;
18:
19: /**
20: * Implements a file filter that searches for one matching suffix.
21: */
22: class FindTheFile implements FilenameFilter {
23: /**
24: * Remembers the suffix.
25: */
26: private String m_suffix;
27:
28: /**
29: * C'tor
30: * @param suffix is the suffix to filter files with
31: */
32: public FindTheFile(String suffix) {
33: m_suffix = suffix;
34: }
35:
36: /**
37: * Tests if a specified file should be included in a file list.
38: *
39: * @param dir the directory in which the file was found.
40: * @param name the name of the file.
41: * @return <code>true</code> iff the name should be included in the
42: * file list; <code>false</code> otherwise.
43: */
44: public boolean accept(File dir, String name) {
45: return name.endsWith(m_suffix);
46: }
47: }
|