Skip to content

Commit 5d8ea7e

Browse files
committed
2 parents de91e83 + d0aac87 commit 5d8ea7e

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Eclipse: Project => Properties => Java Build Path => Libraries => Add JAR ...
1313
IntelliJ: https://www.jetbrains.com/help/idea/library.html
1414

1515
## Usage of the library
16-
If you've programmed your algorithm, you just need to create a 'AlgorithmVisualizer' value in your main class like this:
16+
If you've programmed your algorithm, you just need to create a 'AlgorithmVisualizer' instance in your main class like this:
1717
```
1818
AlgorithmVisualizer algorithmVisualizer = new AlgorithmVisualizer();
1919
```
@@ -23,6 +23,21 @@ Now you need to call your method and pass the array as parameter, like this for
2323
bubblesort(algorithmVisualizer.getArray());
2424
```
2525

26+
#### Other constructors
27+
```
28+
AlgorithmVisualizer algorithmVisualizer = new AlgorithmVisualizer(BarColor barColor);
29+
```
30+
```
31+
AlgorithmVisualizer algorithmVisualizer = new AlgorithmVisualizer(int size);
32+
```
33+
```
34+
AlgorithmVisualizer algorithmVisualizer = new AlgorithmVisualizer(int size, BarColor barColor);
35+
```
36+
37+
## BarColor
38+
You can change the bar colors by passing the 'BarColor' to the constructor, like explained above. These are the available colors:
39+
##### BarColor.RED, BarColor.GREEN, BarColor.BLUE
40+
2641
## Animation
2742
Now you actually 'connected' your algorithm with the library, but you actually should add a 'delay' after every operation in your algorithm, because otherwise your algorithm would be sorted instantly.
2843

@@ -32,6 +47,21 @@ Thread.sleep(30);
3247
```
3348
whenever your values are changing. I would recommend a value between 10-25.
3449

50+
## Integrated algorithms
51+
### Bubblesort:
52+
```
53+
algorithmVisualizer.bubblesort(animationSpeed);
54+
```
55+
### Insertionsort:
56+
```
57+
algorithmVisualizer.insertionSort(animationSpeed);
58+
```
59+
### Selectionsort:
60+
```
61+
algorithmVisualizer.bubblesort(animationSpeed);
62+
```
63+
64+
3565
## Have fun!
3666
Now, this is it. Enjoy your little animaition and maybe some updates in the future!
3767
![gif](https://media1.giphy.com/media/11AoJkCM1rwqilQIKB/giphy.gif)

0 commit comments

Comments
 (0)