BAEL-2797 new domain "math"created, sections moved

This commit is contained in:
anilkivilcim.eray
2019-04-03 00:37:24 +03:00
parent 0a8d9fe187
commit 94bf17615c
184 changed files with 717 additions and 218 deletions

View File

@@ -1,40 +0,0 @@
package com.baeldung.algorithms.linesintersection;
import java.awt.Point;
import java.util.Optional;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertEquals;
public class LinesIntersectionServiceUnitTest {
private LinesIntersectionService service = new LinesIntersectionService();
@Test
public void givenNotParallelLines_whenCalculatePoint_thenPresent() {
double m1 = 0;
double b1 = 0;
double m2 = 1;
double b2 = -1;
Optional<Point> point = service.calculateIntersectionPoint(m1, b1, m2, b2);
assertTrue(point.isPresent());
assertEquals(point.get().getX(), 1, 0.001);
assertEquals(point.get().getY(), 0, 0.001);
}
@Test
public void givenParallelLines_whenCalculatePoint_thenEmpty() {
double m1 = 1;
double b1 = 0;
double m2 = 1;
double b2 = -1;
Optional<Point> point = service.calculateIntersectionPoint(m1, b1, m2, b2);
assertFalse(point.isPresent());
}
}

View File

@@ -1,7 +1,7 @@
package com.baeldung.algorithms;
package com.baeldung.math;
import com.baeldung.algorithms.hillclimbing.HillClimbing;
import com.baeldung.algorithms.hillclimbing.State;
import com.baeldung.math.hillclimbing.HillClimbing;
import com.baeldung.math.hillclimbing.State;
import org.junit.Before;
import org.junit.Test;

View File

@@ -1,7 +1,7 @@
package com.baeldung.algorithms;
package com.baeldung.math;
import com.baeldung.algorithms.middleelementlookup.MiddleElementLookup;
import com.baeldung.algorithms.middleelementlookup.Node;
import com.baeldung.math.middleelementlookup.MiddleElementLookup;
import com.baeldung.math.middleelementlookup.Node;
import org.junit.Test;
import java.util.LinkedList;

View File

@@ -1,6 +1,6 @@
package com.baeldung.algorithms;
package com.baeldung.math;
import com.baeldung.algorithms.automata.*;
import com.baeldung.math.automata.*;
import org.junit.Test;
import static org.junit.Assert.assertTrue;

View File

@@ -1,10 +1,10 @@
package com.baeldung.algorithms;
package com.baeldung.math;
import org.junit.Assert;
import org.junit.Test;
import com.baeldung.algorithms.string.search.StringSearchAlgorithms;
import com.baeldung.math.string.search.StringSearchAlgorithms;
public class StringSearchAlgorithmsUnitTest {

View File

@@ -1,11 +1,10 @@
package com.baeldung.algorithms.binarysearch;
package com.baeldung.math.binarysearch;
import java.util.Arrays;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import com.baeldung.algorithms.binarysearch.BinarySearch;
public class BinarySearchUnitTest {

View File

@@ -1,4 +1,4 @@
package com.baeldung.algorithms.combination;
package com.baeldung.math.combination;
import static org.junit.jupiter.api.Assertions.assertEquals;

View File

@@ -1,4 +1,4 @@
package com.baeldung.algorithms.enumstatemachine;
package com.baeldung.math.enumstatemachine;
import static org.junit.Assert.assertEquals;

View File

@@ -1,4 +1,4 @@
package com.baeldung.algorithms.factorial;
package com.baeldung.math.factorial;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,4 +1,4 @@
package com.baeldung.algorithms.kthlargest;
package com.baeldung.math.kthlargest;
import static org.assertj.core.api.Assertions.*;

View File

@@ -1,4 +1,4 @@
package com.baeldung.algorithms.mcts;
package com.baeldung.math.mcts;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -8,12 +8,12 @@ import java.util.List;
import org.junit.Before;
import org.junit.Test;
import com.baeldung.algorithms.mcts.montecarlo.MonteCarloTreeSearch;
import com.baeldung.algorithms.mcts.montecarlo.State;
import com.baeldung.algorithms.mcts.montecarlo.UCT;
import com.baeldung.algorithms.mcts.tictactoe.Board;
import com.baeldung.algorithms.mcts.tictactoe.Position;
import com.baeldung.algorithms.mcts.tree.Tree;
import com.baeldung.math.mcts.montecarlo.MonteCarloTreeSearch;
import com.baeldung.math.mcts.montecarlo.State;
import com.baeldung.math.mcts.montecarlo.UCT;
import com.baeldung.math.mcts.tictactoe.Board;
import com.baeldung.math.mcts.tictactoe.Position;
import com.baeldung.math.mcts.tree.Tree;
public class MCTSUnitTest {
private Tree gameTree;

View File

@@ -1,11 +1,9 @@
package com.baeldung.algorithms.minimax;
package com.baeldung.math.minimax;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import com.baeldung.algorithms.minimax.MiniMax;
import com.baeldung.algorithms.minimax.Tree;
public class MinimaxUnitTest {
private Tree gameTree;

View File

@@ -1,4 +1,4 @@
package com.baeldung.algorithms.multiswarm;
package com.baeldung.math.multiswarm;
/**
* Specific fitness function implementation to solve the League of Legends

View File

@@ -1,10 +1,10 @@
package com.baeldung.algorithms.multiswarm;
package com.baeldung.math.multiswarm;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import com.baeldung.algorithms.support.MayFailRule;
import com.baeldung.math.support.MayFailRule;
/**
* Test for {@link Multiswarm}.

View File

@@ -1,4 +1,4 @@
package com.baeldung.algorithms.string;
package com.baeldung.math.string;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

View File

@@ -1,10 +1,10 @@
package com.baeldung.algorithms.string;
package com.baeldung.math.string;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static com.baeldung.algorithms.string.LongestSubstringNonRepeatingCharacters.getUniqueCharacterSubstring;
import static com.baeldung.algorithms.string.LongestSubstringNonRepeatingCharacters.getUniqueCharacterSubstringBruteForce;
import static com.baeldung.math.string.LongestSubstringNonRepeatingCharacters.getUniqueCharacterSubstring;
import static com.baeldung.math.string.LongestSubstringNonRepeatingCharacters.getUniqueCharacterSubstringBruteForce;
public class LongestSubstringNonRepeatingCharactersUnitTest {

View File

@@ -1,4 +1,4 @@
package com.baeldung.algorithms.string;
package com.baeldung.math.string;
import static org.junit.Assert.assertEquals;
import java.util.HashSet;

View File

@@ -1,4 +1,4 @@
package com.baeldung.algorithms.support;
package com.baeldung.math.support;
import org.junit.Rule;
import org.junit.rules.TestRule;

View File

@@ -1,4 +1,4 @@
package com.baeldung.algorithms.twopointertechnique;
package com.baeldung.math.twopointertechnique;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,4 +1,4 @@
package com.baeldung.algorithms.twopointertechnique;
package com.baeldung.math.twopointertechnique;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,4 +1,4 @@
package com.baeldung.algorithms.twopointertechnique;
package com.baeldung.math.twopointertechnique;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;