Skip to content

Commit

Permalink
[BAEL-9551] - Clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
amit2103 committed Nov 3, 2018
1 parent ea52c02 commit d8bdac5
Show file tree
Hide file tree
Showing 26 changed files with 36 additions and 158 deletions.
1 change: 0 additions & 1 deletion algorithms-genetic/roundUpToHundred/.gitignore

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,29 @@
import com.baeldung.algorithms.ga.annealing.SimulatedAnnealing;
import com.baeldung.algorithms.ga.ant_colony.AntColonyOptimization;
import com.baeldung.algorithms.ga.binary.SimpleGeneticAlgorithm;
import com.baeldung.algorithms.slope_one.SlopeOne;

public class RunAlgorithm {

public static void main(String[] args) throws InstantiationException, IllegalAccessException {
Scanner in = new Scanner(System.in);
System.out.println("Run algorithm:");
System.out.println("1 - Simulated Annealing");
System.out.println("2 - Slope One");
System.out.println("3 - Simple Genetic Algorithm");
System.out.println("4 - Ant Colony");
System.out.println("5 - Dijkstra");
System.out.println("6 - All pairs in an array that add up to a given sum");
System.out.println("2 - Simple Genetic Algorithm");
System.out.println("3 - Ant Colony");
int decision = in.nextInt();
switch (decision) {
case 1:
System.out.println(
"Optimized distance for travel: " + SimulatedAnnealing.simulateAnnealing(10, 10000, 0.9995));
break;
case 2:
SlopeOne.slopeOne(3);
break;
case 3:
SimpleGeneticAlgorithm ga = new SimpleGeneticAlgorithm();
ga.runAlgorithm(50, "1011000100000100010000100000100111001000000100000100000000001111");
break;
case 4:
case 3:
AntColonyOptimization antColony = new AntColonyOptimization(21);
antColony.startAntOptimization();
break;
case 5:
System.out.println("Please run the DijkstraAlgorithmTest.");
break;
default:
System.out.println("Unknown option");
break;
Expand Down
3 changes: 2 additions & 1 deletion algorithms-miscellaneous-1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
- [How to Find the Kth Largest Element in Java](http://www.baeldung.com/java-kth-largest-element)
- [Multi-Swarm Optimization Algorithm in Java](http://www.baeldung.com/java-multi-swarm-algorithm)
- [String Search Algorithms for Large Texts](http://www.baeldung.com/java-full-text-search-algorithms)
- [Check If a String Contains All The Letters of The Alphabet](https://www.baeldung.com/java-string-contains-all-letters)
- [Check If a String Contains All The Letters of The Alphabet](https://www.baeldung.com/java-string-contains-all-letters)
- [Find the Middle Element of a Linked List](http://www.baeldung.com/java-linked-list-middle-element)
1 change: 0 additions & 1 deletion algorithms-miscellaneous-1/roundUpToHundred/.gitignore

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions algorithms-miscellaneous-1/src/main/resources/maze/maze1.txt

This file was deleted.

22 changes: 0 additions & 22 deletions algorithms-miscellaneous-1/src/main/resources/maze/maze2.txt

This file was deleted.

1 change: 0 additions & 1 deletion algorithms-miscellaneous-2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
- [A Collaborative Filtering Recommendation System in Java](http://www.baeldung.com/java-collaborative-filtering-recommendations)
- [Converting Between Roman and Arabic Numerals in Java](http://www.baeldung.com/java-convert-roman-arabic)
- [Practical Java Examples of the Big O Notation](http://www.baeldung.com/java-algorithm-complexity)
- [Find the Middle Element of a Linked List](http://www.baeldung.com/java-linked-list-middle-element)
- [An Introduction to the Theory of Big-O Notation](http://www.baeldung.com/big-o-notation)
- [Check If Two Rectangles Overlap In Java](https://www.baeldung.com/java-check-if-two-rectangles-overlap)
- [Calculate the Distance Between Two Points in Java](https://www.baeldung.com/java-distance-between-two-points)
Expand Down
1 change: 0 additions & 1 deletion algorithms-miscellaneous-2/roundUpToHundred/.gitignore

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.baeldung.algorithms;

import java.util.Scanner;

import com.baeldung.algorithms.slope_one.SlopeOne;

public class RunAlgorithm {

public static void main(String[] args) throws InstantiationException, IllegalAccessException {
Scanner in = new Scanner(System.in);
System.out.println("1 - Slope One");
System.out.println("2 - Dijkstra");
int decision = in.nextInt();
switch (decision) {
case 1:
SlopeOne.slopeOne(3);
break;
case 2:
System.out.println("Please run the DijkstraAlgorithmLongRunningUnitTest.");
break;
default:
System.out.println("Unknown option");
break;
}
in.close();
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.java.src;
package com.baeldung.algorithms.roundedup;

import java.util.Scanner;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.java.src;
package com.baeldung.algorithms.roundedup;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class RoundUpToHundredTest {
public class RoundUpToHundredUnitTest {
@Test
public void givenInput_whenRound_thenRoundUpToTheNearestHundred() {
assertEquals("Rounded up to hundred", 100, RoundUpToHundred.round(99));
Expand Down
1 change: 0 additions & 1 deletion algorithms-sorting/roundUpToHundred/.gitignore

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit d8bdac5

Please sign in to comment.