Removed whitespaces and changed comments
This commit is contained in:
parent
b1b662fbb5
commit
be100242e3
3 changed files with 9 additions and 21 deletions
9
.idea/workspace.xml
generated
9
.idea/workspace.xml
generated
|
@ -276,7 +276,14 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1679688274094</updated>
|
<updated>1679688274094</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="27" />
|
<task id="LOCAL-00027" summary="replaced Algorythm and made it way faster">
|
||||||
|
<created>1679696235787</created>
|
||||||
|
<option name="number" value="00027" />
|
||||||
|
<option name="presentableId" value="LOCAL-00027" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1679696235787</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="28" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="Vcs.Log.Tabs.Properties">
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
|
|
|
@ -74,7 +74,6 @@ public class Main {
|
||||||
System.out.println("Commanded Threads " + saidThreads);
|
System.out.println("Commanded Threads " + saidThreads);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List<Path> pathList = new ArrayList<>();
|
List<Path> pathList = new ArrayList<>();
|
||||||
List<Path> allFiles = new ArrayList<>();
|
List<Path> allFiles = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -87,8 +86,6 @@ public class Main {
|
||||||
allFiles.addAll(pathList);
|
allFiles.addAll(pathList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// calculations for multithreading
|
// calculations for multithreading
|
||||||
//The number of Cores or better said Threads that can be used
|
//The number of Cores or better said Threads that can be used
|
||||||
int availableThreads = Runtime.getRuntime().availableProcessors();
|
int availableThreads = Runtime.getRuntime().availableProcessors();
|
||||||
|
@ -119,8 +116,7 @@ public class Main {
|
||||||
}
|
}
|
||||||
//Start Multithreading
|
//Start Multithreading
|
||||||
|
|
||||||
//sectionedList gives the thread their Assigned Part of Files and allFiles are all the Files
|
//sectionedList gives the thread their Assigned Part of Files
|
||||||
|
|
||||||
|
|
||||||
ThreadedCompare threadedCompare = new ThreadedCompare(sectionedList);
|
ThreadedCompare threadedCompare = new ThreadedCompare(sectionedList);
|
||||||
threadedCompare.start();
|
threadedCompare.start();
|
||||||
|
@ -135,7 +131,6 @@ public class Main {
|
||||||
} else if (showProgress) {
|
} else if (showProgress) {
|
||||||
System.out.print("Progress: " + progress + " / " + filesToBeDone + " | " + (progress * 100 / filesToBeDone) + "%" + "\r");
|
System.out.print("Progress: " + progress + " / " + filesToBeDone + " | " + (progress * 100 / filesToBeDone) + "%" + "\r");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
ArrayList toRemove = new ArrayList<String>();
|
ArrayList toRemove = new ArrayList<String>();
|
||||||
for (String md5: fileMap.keySet()) {
|
for (String md5: fileMap.keySet()) {
|
||||||
|
@ -158,7 +153,6 @@ public class Main {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// new algo
|
|
||||||
|
|
||||||
List<Path> allTheFilesWillBeDeleted = new ArrayList<>();
|
List<Path> allTheFilesWillBeDeleted = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -176,17 +170,12 @@ public class Main {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (deleteDups) {
|
if (deleteDups) {
|
||||||
delete(allTheFilesWillBeDeleted);
|
delete(allTheFilesWillBeDeleted);
|
||||||
} else {
|
} else {
|
||||||
ask(doTheColorThingy, bytes, allTheFilesWillBeDeleted);
|
ask(doTheColorThingy, bytes, allTheFilesWillBeDeleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//print files and ask user
|
//print files and ask user
|
||||||
public static void ask(boolean color, long bytes, List<Path> deleteThem) {
|
public static void ask(boolean color, long bytes, List<Path> deleteThem) {
|
||||||
|
@ -214,7 +203,6 @@ public class Main {
|
||||||
for (Path file : deleteThem) {
|
for (Path file : deleteThem) {
|
||||||
if (file != null) {file.toFile().delete();}
|
if (file != null) {file.toFile().delete();}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ public class ThreadedCompare extends Thread {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Main.fileMap.containsKey(MD5)) {
|
if (Main.fileMap.containsKey(MD5)) {
|
||||||
fileArray.addAll(Main.fileMap.get(MD5));
|
fileArray.addAll(Main.fileMap.get(MD5));
|
||||||
Main.fileMap.put(MD5, fileArray);
|
Main.fileMap.put(MD5, fileArray);
|
||||||
|
@ -37,17 +36,11 @@ public class ThreadedCompare extends Thread {
|
||||||
Main.fileMap.put(MD5, fileArray);
|
Main.fileMap.put(MD5, fileArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Main.progress++;
|
Main.progress++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Main.completedThreads++;
|
Main.completedThreads++;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//this is used to get the MD5 String of one of the files (one of them is just fine since they both have the same value)
|
//this is used to get the MD5 String of one of the files (one of them is just fine since they both have the same value)
|
||||||
|
|
Reference in a new issue