cvsimport
[beagle.git] / beagled / Lucene.Net / Index / IndexFileNameFilter.cs
blobd19f94550c0ad51eb893d880952dc869e4ffc6bd
1 /*
2 * Copyright 2005 The Apache Software Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 using System;
19 namespace Lucene.Net.Index
22 /// <summary> Filename filter that accept filenames and extensions only created by Lucene.
23 ///
24 /// </summary>
25 /// <author> Daniel Naber / Bernhard Messer
26 /// </author>
27 /// <version> $rcs = ' $Id: IndexFileNameFilter.cs,v 1.2 2006/10/02 17:08:52 joeshaw Exp $ ' ;
28 /// </version>
29 public class IndexFileNameFilter // : FilenameFilter {{Aroush-1.9}}
32 /* (non-Javadoc)
33 * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
35 public virtual bool Accept(System.IO.FileInfo dir, System.String name)
37 for (int i = 0; i < IndexFileNames.INDEX_EXTENSIONS.Length; i++)
39 if (name.EndsWith("." + IndexFileNames.INDEX_EXTENSIONS[i]))
40 return true;
42 if (name.Equals(IndexFileNames.DELETABLE))
43 return true;
44 else if (name.Equals(IndexFileNames.SEGMENTS))
45 return true;
46 else if (true) // else if (name.Matches(".+\\.f\\d+")) // {{Aroush-1.9}}
47 return true;
48 return false;