- spring,
- maven,
- FindBugs,
- CheckStyle,
- PDM,
- Jacoco.
$ git clone https://github.com/ArSiu/javaLabs.git
$ cd javaLabs
$ git checkout lab2
$ mvn compile
$ mvn install
$ java -jar target/Lab9v1-1.0-SNAPSHOT.jar
$ git clone https://github.com/ArSiu/javaLabs.git
$ cd javaLabs
$ git checkout lab2
$ mvn compile
$ mvn site
$ cd target/site
$ run checkstyle.html
[3.1]addTechnique
public void addTechnique(final Technique technique) {
tech.add(technique);
}
[3.2]sortByName
public List<Technique> sortByName(final boolean reverse) {
if (reverse) {
tech.sort((Technique t1, Technique t2) ->
t2.getName().compareTo(t1.getName()));
} else {
tech.sort((Technique t1, Technique t2) ->
t1.getName().compareTo(t2.getName()));
}
return tech;
}
[3.3]sortByPrice
public List<Technique> sortByPrice(final boolean reverse) {
if (reverse) {
tech.sort((Technique t1, Technique t2) ->
Float.compare(t2.getPrice(), t1.getPrice()));
} else {
tech.sort((Technique t1, Technique t2) ->
Float.compare(t1.getPrice(), t2.getPrice()));
}
return tech;
}
[3.4]searchBar
public Optional<Technique> searchBar(final String search) {
return tech.stream().filter(t ->
t.getName().equals(search)).findAny();
}
[3.5]show
public void show(final boolean reverse, final List<Technique> techniques) {
techniques.forEach(System.out::println);
}