~ubuntu-branches/ubuntu/vivid/herold/vivid

« back to all changes in this revision

Viewing changes to java/org/dbdoclet/io/StartsWithFilter.java

  • Committer: Package Import Robot
  • Author(s): Mathieu Malaterre
  • Date: 2012-09-20 10:00:14 UTC
  • Revision ID: package-import@ubuntu.com-20120920100014-5pcwbw2err6on8yg
Tags: upstream-6.0.1
Import upstream version 6.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 * Copyright (C) 2001-2012 Michael Fuchs
 
3
 *
 
4
 * This file is part of herold.
 
5
 * 
 
6
 * herold is free software: you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation, either version 3 of the License, or
 
9
 * (at your option) any later version.
 
10
 * 
 
11
 * herold is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 * 
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with herold.  If not, see <http://www.gnu.org/licenses/>.  
 
18
 */
 
19
package org.dbdoclet.io;
 
20
 
 
21
import java.io.File;
 
22
import java.io.FilenameFilter;
 
23
 
 
24
/**
 
25
 * Die Klasse <code>EndsWithFilter</code> überprüft ob der Name einer
 
26
 * Datei mit dem definierten Anfang übereinstimmt.
 
27
 *
 
28
 * @author <a href="mailto:michael.fuchs@unico-group.com">Michael Fuchs</a>
 
29
 * @version 1.0
 
30
 */
 
31
public class StartsWithFilter
 
32
    implements FilenameFilter {
 
33
 
 
34
    /** Der Anfang, der überprüft werden soll. */
 
35
    private String start;
 
36
    
 
37
    /**
 
38
     * Erzeugt eine neue Instanz der Klasse
 
39
     * <code>StartsWithFileNameFilter</code>.
 
40
     *
 
41
     * @param start <code>String</code>
 
42
     */
 
43
    public StartsWithFilter(String start) {
 
44
        this.start = start;
 
45
    }
 
46
    
 
47
    /**
 
48
     * Die Methode <code>accept</code> überprüft ob der angegebene Dateiname auf
 
49
     * den definierten Anfang passt.
 
50
     *
 
51
     * Die Überprüfung des Anfangs erfolgt ohne Beachtung der Groß- und
 
52
     * Kleinschreibung.
 
53
     *
 
54
     * @param file <code>File</code>
 
55
     * @param name <code>String</code>
 
56
     * @return <code>boolean</code>
 
57
     */
 
58
    public boolean accept(File file, String name) {
 
59
 
 
60
        String s1 = name.toLowerCase();
 
61
        String s2 = start.toLowerCase();
 
62
 
 
63
        return s1.startsWith(s2);
 
64
    }
 
65
}
 
66
/*
 
67
 * $Log: StartsWithFileNameFilter.java,v $
 
68
 * Revision 1.1.1.1  2004/12/21 14:06:38  mfuchs
 
69
 * Reimport
 
70
 *
 
71
 * Revision 1.3  2004/09/03 08:26:54  mfuchs
 
72
 * Sicherung
 
73
 *
 
74
 * Revision 1.2  2004/08/27 19:30:32  mfuchs
 
75
 * Dokumentation
 
76
 *
 
77
 * Revision 1.1.1.1  2004/05/13 17:14:37  mfuchs
 
78
 * Services
 
79
 *
 
80
 */