diff --git a/common/source/java/ch/systemsx/cisd/common/utilities/NamePrefixFileFilter.java b/common/source/java/ch/systemsx/cisd/common/utilities/NamePrefixFileFilter.java deleted file mode 100644 index 6df806d2476d879dfff21410ac7d7bc3234c91f8..0000000000000000000000000000000000000000 --- a/common/source/java/ch/systemsx/cisd/common/utilities/NamePrefixFileFilter.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2007 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.common.utilities; - -import java.io.File; -import java.io.FileFilter; - -/** - * A {@link FileFilter} that checks whether the name part of the <var>pathname</var> starts (or - * does not start) with the <var>prefix</var> specified. - * - * @author Bernd Rinn - */ -public class NamePrefixFileFilter implements FileFilter -{ - - private final String prefix; - - private boolean shouldStartWithPrefix; - - public NamePrefixFileFilter(String prefix, boolean shouldStartWithPrefix) - { - assert prefix != null; - - this.prefix = prefix; - this.shouldStartWithPrefix = shouldStartWithPrefix; - } - - public boolean accept(File pathname) - { - assert pathname != null; - - final boolean startsWithPrefix = pathname.getName().startsWith(prefix); - return startsWithPrefix == shouldStartWithPrefix; - } - -} diff --git a/common/sourceTest/java/ch/systemsx/cisd/common/utilities/NamePrefixFileFilterTest.java b/common/sourceTest/java/ch/systemsx/cisd/common/utilities/NamePrefixFileFilterTest.java deleted file mode 100644 index 690c687c4777601a56fd971b42e6834e3a930926..0000000000000000000000000000000000000000 --- a/common/sourceTest/java/ch/systemsx/cisd/common/utilities/NamePrefixFileFilterTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2007 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.common.utilities; - -import java.io.File; -import java.io.FileFilter; - -import org.testng.annotations.Test; - -/** - * Test cases for {@link NamePrefixFileFilter}. - * - * @author Bernd Rinn - */ -public class NamePrefixFileFilterTest -{ - - private static final String PREFIX = "PReFiX"; - - @Test - public void testNamePrefixShouldOccurAndFound() - { - final FileFilter filter = new NamePrefixFileFilter(PREFIX, true); - assert filter.accept(new File(PREFIX + "andSomePostFix.txt").getAbsoluteFile()); - } - - @Test - public void testNamePrefixShouldOccurButNotFound() - { - final FileFilter filter = new NamePrefixFileFilter(PREFIX, true); - assert filter.accept(new File("somefilewithouttheprefix.dat").getAbsoluteFile()) == false; - } - - @Test - public void testNamePrefixShouldNotOccurAndNotFound() - { - final FileFilter filter = new NamePrefixFileFilter(PREFIX, false); - assert filter.accept(new File("somefilewithouttheprefix.dat").getAbsoluteFile()); - } - - @Test - public void testNamePrefixShouldNotOccurButFound() - { - final FileFilter filter = new NamePrefixFileFilter(PREFIX, false); - assert filter.accept(new File(PREFIX + "andSomePostFix.txt").getAbsoluteFile()) == false; - } - -}