reformat code (mostly switch spaces to tabs)

This commit is contained in:
Thomas Rubini 2022-12-15 20:16:34 +01:00
parent b2e82c8d7c
commit 277e836e71
No known key found for this signature in database
GPG Key ID: C7D287C8C1CAC373
16 changed files with 545 additions and 535 deletions

View File

@ -5,6 +5,7 @@ import com.beust.jcommander.JCommander;
/** /**
* Class to parse the command line arguments given by the user * Class to parse the command line arguments given by the user
*
* @author Capelier-Marla * @author Capelier-Marla
*/ */
public class ArgParse { public class ArgParse {
@ -15,8 +16,9 @@ public class ArgParse {
/** /**
* Get the command line argument given by the user, parse it with the parser and store it in the corresponding variable * Get the command line argument given by the user, parse it with the parser and store it in the corresponding variable
* @author Capelier-Marla *
* @param args the command line arguments given by the user * @param args the command line arguments given by the user
* @author Capelier-Marla
*/ */
static void parseArguments(String[] args) { static void parseArguments(String[] args) {
// create JCommander and CommandLineParams objects // create JCommander and CommandLineParams objects
@ -48,8 +50,9 @@ public class ArgParse {
/** /**
* Get the distribution name. If the user didn't give any or if we didn't parse it, return null * Get the distribution name. If the user didn't give any or if we didn't parse it, return null
* @author Capelier-Marla *
* @return String: the distribution name * @return String: the distribution name
* @author Capelier-Marla
*/ */
public static String getDistribution() { public static String getDistribution() {
return distribution; return distribution;
@ -57,8 +60,9 @@ public class ArgParse {
/** /**
* Get the packet name, this one isn't optional * Get the packet name, this one isn't optional
* @author Capelier-Marla *
* @return String: the packet name * @return String: the packet name
* @author Capelier-Marla
*/ */
public static String getPacket() { public static String getPacket() {
return packet; return packet;

View File

@ -4,6 +4,7 @@ import com.beust.jcommander.Parameter;
/** /**
* Class to store and get the command line arguments given by the user * Class to store and get the command line arguments given by the user
*
* @author Capelier-Marla * @author Capelier-Marla
*/ */
public class CommandLineParams { public class CommandLineParams {

View File

@ -9,6 +9,7 @@ import java.util.List;
/** /**
* Enum containing distribution information to get them by their name * Enum containing distribution information to get them by their name
*
* @author Capelier-Marla * @author Capelier-Marla
*/ */
public enum DistributionEnum { public enum DistributionEnum {
@ -21,6 +22,7 @@ public enum DistributionEnum {
/** /**
* Constructor for enums * Constructor for enums
*
* @param name the name of the distribution * @param name the name of the distribution
* @param distributionConstructor the instance of the distribution * @param distributionConstructor the instance of the distribution
* @author Capelier-Marla * @author Capelier-Marla
@ -32,6 +34,7 @@ public enum DistributionEnum {
/** /**
* Get the distribution instance for the distribution requested in String * Get the distribution instance for the distribution requested in String
*
* @param name name of the distribution requested * @param name name of the distribution requested
* @return the instance of the distribution requested * @return the instance of the distribution requested
* @author Capelier-Marla * @author Capelier-Marla
@ -49,6 +52,7 @@ public enum DistributionEnum {
/** /**
* Get all distribution instances available in this enum * Get all distribution instances available in this enum
*
* @return the list of distribution instances * @return the list of distribution instances
*/ */
public static List<Distribution> getAllDistributionsInstances() { public static List<Distribution> getAllDistributionsInstances() {

View File

@ -20,6 +20,7 @@ public class Searcher {
/** /**
* Get the list of all packages in the distribution set before * Get the list of all packages in the distribution set before
*
* @param packageName the name of the package wanted * @param packageName the name of the package wanted
* @return the list of all packages found * @return the list of all packages found
* @author Capelier-Marla * @author Capelier-Marla

View File

@ -7,5 +7,6 @@ import java.util.List;
public interface Frontend { public interface Frontend {
SearchedPackage askUserToChoosePackage(List<SearchedPackage> packets); SearchedPackage askUserToChoosePackage(List<SearchedPackage> packets);
void showPackageTree(Package packet, int depth); void showPackageTree(Package packet, int depth);
} }

View File

@ -3,14 +3,10 @@ package fr.packageviewer.frontend;
public class FrontendFactory { public class FrontendFactory {
public static Frontend get(String name) { public static Frontend get(String name) {
switch(name){ if (name.equals("terminal")) {
case "terminal":{
return new FrontendTerminal(); return new FrontendTerminal();
} }
default:{
throw new IllegalArgumentException("Invalid frontend"); throw new IllegalArgumentException("Invalid frontend");
} }
}
}
} }

View File

@ -10,6 +10,7 @@ public class FrontendTerminal implements Frontend{
/** /**
* Check if the String given is a number * Check if the String given is a number
*
* @param i the String given * @param i the String given
* @return true if the String is a number * @return true if the String is a number
* @author Capelier-Marla * @author Capelier-Marla

View File

@ -18,7 +18,6 @@ import java.util.logging.Logger;
* *
* @author R.Thomas * @author R.Thomas
* @version 1.0 * @version 1.0
*
*/ */
public abstract class AsyncRequestsParser { public abstract class AsyncRequestsParser {
/** /**

View File

@ -14,6 +14,7 @@ import java.util.concurrent.Future;
public abstract class DistroTest<T extends Distribution> { public abstract class DistroTest<T extends Distribution> {
protected abstract T createInstance(); protected abstract T createInstance();
protected List<SearchedPackage> helperSearchPackage(String packageName) { protected List<SearchedPackage> helperSearchPackage(String packageName) {
Distribution distribution = createInstance(); Distribution distribution = createInstance();
Future<List<SearchedPackage>> future = distribution.searchPackage(packageName); Future<List<SearchedPackage>> future = distribution.searchPackage(packageName);
@ -23,6 +24,7 @@ public abstract class DistroTest<T extends Distribution> {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
protected Package helperGetPackageTree(String packageName, int depth) { protected Package helperGetPackageTree(String packageName, int depth) {
Distribution distribution = createInstance(); Distribution distribution = createInstance();
Future<Package> future = distribution.getPackageTree(packageName, depth); Future<Package> future = distribution.getPackageTree(packageName, depth);
@ -83,6 +85,7 @@ public abstract class DistroTest<T extends Distribution> {
public void testThatBashSearchReturnsResults() { public void testThatBashSearchReturnsResults() {
Assertions.assertNotEquals(helperSearchPackage("bash").size(), 0); Assertions.assertNotEquals(helperSearchPackage("bash").size(), 0);
} }
@Test @Test
public void testThatBashSearchContainsBash() { public void testThatBashSearchContainsBash() {
for (SearchedPackage pack : helperSearchPackage("bash")) { for (SearchedPackage pack : helperSearchPackage("bash")) {