/*
* Meviz - Various tools collection to work with multimedia.
- * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- *
+ * Copyright (C) 2012 -- 2019, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ *
* This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public License
- * as published by the Free Software Foundation.
- */
+ * modify it under the terms of version 3 of the GNU Lesser General Public License
+ * or later as published by the Free Software Foundation.
+*/
package eu.svjatoslav.meviz.renamer;
-import eu.svjatoslav.commons.string.WildCardMatcher;
+import eu.svjatoslav.commons.string.GlobMatcher;
import eu.svjatoslav.meviz.Module;
import java.io.File;
public class Main implements Module {
- public int processedFilesCount;
- CommandlineHandler commandlineHandler = new CommandlineHandler();
- RenamingOptions options;
+ private final CommandlineHandler commandlineHandler = new CommandlineHandler();
+ private int processedFilesCount;
+ private RenamingOptions options;
/**
* Verify that program has enough information to start executing
*
* @return true if all is ok, false if errors were found
*/
- public boolean checkThatThereIsEnoughDataToProceed() {
+ private boolean checkThatThereIsEnoughDataToProceed() {
if (options.inputPatterns.size() == 0) {
System.out.println("Error: no input patterns given.");
return false;
return true;
}
- public boolean fileMatchesInputPattern(final File file) {
+ private boolean fileMatchesInputPattern(final File file) {
final String fileName = file.getName();
for (final String inputPattern : options.inputPatterns)
- if (WildCardMatcher.match(fileName, inputPattern))
+ if (GlobMatcher.match(fileName, inputPattern))
return true;
return false;
}
}
- public void processFileOrDirectory(final File file) {
+ private void processFileOrDirectory(final File file) {
if (!file.exists()) {
System.out.println("Error: file \"" + file.getAbsolutePath()
+ "\" does not exist.");
}
- public void rename() {
+ private void rename() {
processFileOrDirectory(options.targetDirectory);
}