fix typos and grammar errors
This commit is contained in:
parent
3baf71554b
commit
00ad329577
@ -5,14 +5,14 @@
|
||||
|
||||
PackageViewer permer de rechercher et de visualiser un paquet et les dependances du paquet pour une distribtion donnée.
|
||||
|
||||
## Distribution supportées
|
||||
## Distributions supportées
|
||||
|
||||
- Arch Linux (depots officiels)
|
||||
- Fedora
|
||||
|
||||
## Utilisation
|
||||
|
||||
Pour utiliser notre projet vous pouvez cloner et build notre projet ou bien recuperer la [derniere build](https://nightly.link/ThomasRubini/PackageViewer/workflows/ci/main/PackageViewer%20jar.zip).
|
||||
Pour utiliser notre projet, vous pouvez cloner et build notre projet ou bien recuperer la [derniere build](https://nightly.link/ThomasRubini/PackageViewer/workflows/ci/main/PackageViewer%20jar.zip).
|
||||
|
||||
### parametres
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class ArgParse {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the distribution name. If the user didn't give any or we didn't parsed, 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
|
||||
*/
|
||||
|
@ -8,7 +8,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Enum containing contructors for each distribution to get them by their name
|
||||
* Enum containing distribution information to get them by their name
|
||||
* @author Capelier-Marla
|
||||
*/
|
||||
public enum DistributionEnum {
|
||||
@ -20,7 +20,7 @@ public enum DistributionEnum {
|
||||
private final Distribution distributionConstructor;
|
||||
|
||||
/**
|
||||
* Contructor for enums
|
||||
* Constructor for enums
|
||||
* @param name the name of the distribution
|
||||
* @param distributionConstructor the instance of the distribution
|
||||
* @author Capelier-Marla
|
||||
@ -36,8 +36,8 @@ public enum DistributionEnum {
|
||||
* @return the instance of the distribution requested
|
||||
* @author Capelier-Marla
|
||||
*/
|
||||
public static Distribution getDistributionContructorByName(String name) {
|
||||
// loop for all ditributions stored in enum
|
||||
public static Distribution getDistributionConstructorByName(String name) {
|
||||
// loop for all distributions stored in enum
|
||||
for(var distrib : values()) {
|
||||
// return the instance if it's the same as enum name
|
||||
if(distrib.name.equals(name)) {
|
||||
@ -55,8 +55,8 @@ public enum DistributionEnum {
|
||||
// create the set that will be returned
|
||||
List<Distribution> result = new ArrayList<>();
|
||||
// add all the distribution instances in the set
|
||||
for(var ditrib : values()) {
|
||||
result.add(ditrib.distributionConstructor);
|
||||
for(var distrib : values()) {
|
||||
result.add(distrib.distributionConstructor);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class LoggerManager {
|
||||
Logger logger = Logger.getLogger(name);
|
||||
logger.setLevel(level);
|
||||
|
||||
// create an hanlder for standard error and add it to the logger
|
||||
// create a handler for standard error and add it to the logger
|
||||
Handler handler = new StreamHandler(System.err, new SimpleFormatter());
|
||||
logger.addHandler(handler);
|
||||
|
||||
|
@ -27,10 +27,10 @@ public class Main {
|
||||
// ask the user to select the package to see in details and store its name
|
||||
SearchedPackage searchedPacketName = frontend.askUserToChoosePackage(packets);
|
||||
|
||||
// get all informations about the package by searching it in details
|
||||
// get all information about the package by searching it in details
|
||||
Package packet = searcher.getPackage(searchedPacketName);
|
||||
|
||||
// show all informations about a packet
|
||||
// show all information about a packet
|
||||
frontend.showPackageTree(packet, 0);
|
||||
}
|
||||
}
|
||||
|
@ -65,9 +65,9 @@ public class Pair<K, V> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string reprensentation of the pair
|
||||
* Returns a string representation of the pair
|
||||
*
|
||||
* @return String, string reprensentation of the pair
|
||||
* @return String, string representation of the pair
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -19,7 +19,7 @@ public class Searcher {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of all packages in the distribution setted before
|
||||
* Get the list of all packages in the distribution set before
|
||||
* @param packageName the name of the package wanted
|
||||
* @return the list of all packages found
|
||||
* @author Capelier-Marla
|
||||
@ -31,7 +31,7 @@ public class Searcher {
|
||||
if(distributionName == null) {
|
||||
distributions = DistributionEnum.getAllDistributionsInstances();
|
||||
} else {
|
||||
distributions = Collections.singletonList(DistributionEnum.getDistributionContructorByName(distributionName));
|
||||
distributions = Collections.singletonList(DistributionEnum.getDistributionConstructorByName(distributionName));
|
||||
if(distributions.get(0) == null) {
|
||||
System.out.println("Distribution non trouvée");
|
||||
System.exit(0);
|
||||
@ -65,7 +65,7 @@ public class Searcher {
|
||||
distributionName = packetInput.getDistribution();
|
||||
}
|
||||
String packageName = packetInput.getName();
|
||||
Distribution distribution = DistributionEnum.getDistributionContructorByName(distributionName);
|
||||
Distribution distribution = DistributionEnum.getDistributionConstructorByName(distributionName);
|
||||
Future<Package> futurePacket = distribution.getPackageTree(packageName, 4);
|
||||
Package packet = null;
|
||||
try {
|
||||
|
@ -32,7 +32,7 @@ public class ArchDistribution extends AsyncRequestsParser implements Distributio
|
||||
|
||||
/**
|
||||
* This method remove all characters in the first string passed as
|
||||
* parametter after one of the character in the second string if found
|
||||
* parameter after one of the character in the second string if found
|
||||
* in the first string
|
||||
*
|
||||
* @param str String, the string to trim
|
||||
@ -51,14 +51,14 @@ public class ArchDistribution extends AsyncRequestsParser implements Distributio
|
||||
/**
|
||||
* This function return a package from arch package api in the form of a Pair
|
||||
* Composed of a Package object, and a set of string containing the names of
|
||||
* the dependecies of the package.
|
||||
* the dependencies of the package.
|
||||
*
|
||||
* @param packageName String, The package's exact name
|
||||
* @return Pair of Package and Set of String
|
||||
*/
|
||||
@Override
|
||||
public CompletableFuture<Pair<Package, Set<String>>> getPackageFromAPI(String packageName) {
|
||||
// create a new http client and he request for arch reseach api
|
||||
// create a new http client and make a request to the arch research api
|
||||
HttpClient client = HttpClient.newHttpClient();
|
||||
HttpRequest request = HttpRequest
|
||||
.newBuilder(URI.create("https://archlinux.org/packages/search/json/?name=" + packageName)).build();
|
||||
@ -78,7 +78,7 @@ public class ArchDistribution extends AsyncRequestsParser implements Distributio
|
||||
}
|
||||
JSONObject resultJson = resultsArrayJson.getJSONObject(0);
|
||||
Set<String> dependenciesNames = new HashSet<>();
|
||||
// parse depencies without version requirements (bash >= 3.0) -> (bash)
|
||||
// parse dependencies without version requirements (bash >= 3.0) -> (bash)
|
||||
for (Object dependency : resultJson.getJSONArray("depends")) {
|
||||
dependenciesNames.add(trimAfterCharacters((String) dependency, "<>="));
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import java.util.List;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
/**
|
||||
* This interface specifies the methods needed by a distribtion to be parsable.
|
||||
* This interface specifies the methods needed by a distribution to be parsable.
|
||||
*
|
||||
* @author R.Thomas
|
||||
* @version 1.0
|
||||
@ -24,10 +24,10 @@ public interface Distribution {
|
||||
|
||||
/**
|
||||
* This function returns a fully completed package containing all
|
||||
* information about the package identified by it's exact name passed as
|
||||
* parametter, the package contains in its dependency list fully formed
|
||||
* information about the package identified by its exact name passed as
|
||||
* parameter, the package contains in its dependency list fully formed
|
||||
* packages that also contains its dependencies, the dependency depth is
|
||||
* specified by the parametter with the same name.
|
||||
* specified by the parameter with the same name.
|
||||
*
|
||||
* @param packageName String, The package's exact name
|
||||
* @param depth int, the depth of the dependency tree
|
||||
|
@ -32,7 +32,7 @@ public class FedoraDistribution extends AsyncRequestsParser implements Distribut
|
||||
/**
|
||||
* This function return a package from Fedora metadata api in the form of a
|
||||
* Pair Composed of a Package object, and a set of string containing the
|
||||
* names of the dependecies of the package.
|
||||
* names of the dependencies of the package.
|
||||
*
|
||||
* @param packageName String, The package's exact name
|
||||
* @return Pair of Package and Set of String
|
||||
@ -100,7 +100,7 @@ public class FedoraDistribution extends AsyncRequestsParser implements Distribut
|
||||
*/
|
||||
@Override
|
||||
public CompletableFuture<List<SearchedPackage>> searchPackage(String packageName) {
|
||||
// create an http client and the request for fedora's reseach api
|
||||
// create a new http client and make a request to the fedora research api
|
||||
HttpClient client = HttpClient.newHttpClient();
|
||||
HttpRequest request = HttpRequest.newBuilder()
|
||||
.uri(URI.create(
|
||||
|
@ -11,21 +11,21 @@ import java.util.List;
|
||||
*/
|
||||
public class Package extends SearchedPackage {
|
||||
/**
|
||||
* List of package storing all of the dependencies of the package
|
||||
* List of package storing all the dependencies of the package
|
||||
*/
|
||||
private final List<Package> deps;
|
||||
|
||||
/**
|
||||
* Getter for the deps attribute
|
||||
*
|
||||
* @return List, List of package storing all of the dependencies of the package
|
||||
* @return List, List of package storing all the dependencies of the package
|
||||
*/
|
||||
public List<Package> getDeps() {
|
||||
return deps;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method adds to the dependency list the package passed as parametter.
|
||||
* This method adds to the dependency list the package passed as parameter.
|
||||
*
|
||||
* @param pack Package, the package to add as dependency
|
||||
*/
|
||||
@ -66,9 +66,9 @@ public class Package extends SearchedPackage {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string reprensentation of the package
|
||||
* Returns a string representation of the package
|
||||
*
|
||||
* @return String, string reprensentation of the package
|
||||
* @return String, string representation of the package
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -93,9 +93,9 @@ public class SearchedPackage {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string reprensentation of the package
|
||||
* Returns a string representation of the package
|
||||
*
|
||||
* @return String, string reprensentation of the package
|
||||
* @return String, string representation of the package
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -14,7 +14,7 @@ import java.util.logging.Logger;
|
||||
/**
|
||||
* This abstract class defines the method that a distribution will use
|
||||
* in order to get a package and fill its dependency list. It does all that
|
||||
* in an asyncron manner
|
||||
* in an asynchronous manner
|
||||
*
|
||||
* @author R.Thomas
|
||||
* @version 1.0
|
||||
@ -29,7 +29,7 @@ public abstract class AsyncRequestsParser {
|
||||
/**
|
||||
* This function returns a package from the distribution's api in the form
|
||||
* of a Pair Composed of a Package object and a set of string containing
|
||||
* the names of the dependecies of the package.
|
||||
* the names of the dependencies of the package.
|
||||
*
|
||||
* @param packageName String, The package's exact name
|
||||
* @return Pair of Package and Set of String
|
||||
@ -38,10 +38,10 @@ public abstract class AsyncRequestsParser {
|
||||
|
||||
/**
|
||||
* This function returns a fully completed package containing all
|
||||
* information about the package identified by it's exact name passed as
|
||||
* parametter, the package contains in its dependency list fully formed
|
||||
* information about the package identified by its exact name passed as
|
||||
* parameter, the package contains in its dependency list fully formed
|
||||
* packages that also contains its dependencies, the dependency depth is
|
||||
* specified by the parametter with the same name.
|
||||
* specified by the parameter with the same name.
|
||||
*
|
||||
* @param packageName String, The package's exact name
|
||||
* @param depth int, the depth of the dependency tree
|
||||
@ -87,7 +87,7 @@ public abstract class AsyncRequestsParser {
|
||||
futureDeps.add(getPackageTree(depPackageName, depth - 1));
|
||||
}
|
||||
// for each future in the list, get the actual package and store
|
||||
// into the deps list of the packaqge
|
||||
// into the deps list of the package
|
||||
for (CompletableFuture<Package> future : futureDeps) {
|
||||
Package dep;
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user