This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.ArrayList; | |
| import java.util.List; | |
| import java.util.concurrent.ArrayBlockingQueue; | |
| import java.util.concurrent.BlockingQueue; | |
| public class ThreadPool implements IThreadPool { | |
| private List<PoolThread> threads; | |
| private BlockingQueue<ITask> tasks; | |
| private volatile boolean isStopped = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.concurrent.BlockingQueue; | |
| public class PoolThread extends Thread { | |
| private BlockingQueue<ITask> tasks; | |
| private boolean isStopped = false; | |
| public PoolThread(BlockingQueue<ITask> tasks) { | |
| this.tasks = tasks; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Summator implements ITask { | |
| private byte endRange; | |
| private long result; | |
| public Summator(byte endRange) { | |
| this.endRange = endRange; | |
| this.result = 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // main.cpp | |
| // hellocpp | |
| // | |
| // Created by Valeri Hristov on 6.02.20. | |
| // Copyright © 2020 Valeri Hristov. All rights reserved. | |
| // | |
| #include <iostream> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // main.cpp | |
| // hellocpp | |
| // | |
| // Outputs to standart output the sign of the multiplication of 3 numbers without actually doing the calculation (*). | |
| // | |
| // Created by Valeri Hristov on 6.02.20. | |
| // Copyright © 2020 Valeri Hristov. All rights reserved. | |
| // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // main.cpp | |
| // hellocpp | |
| // | |
| // Calculates the roots of a quadratic equation. | |
| // | |
| // Created by Valeri Hristov on 6.02.20. | |
| // Copyright © 2020 Valeri Hristov. All rights reserved. | |
| // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // main.cpp | |
| // hellocpp | |
| // | |
| // Finds min and max of the numbers incoming from standart in. | |
| // | |
| // Created by Valeri Hristov on 6.02.20. | |
| // Copyright © 2020 Valeri Hristov. All rights reserved. | |
| // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // main.cpp | |
| // hellocpp | |
| // | |
| // Finds GCD, intuitive algorithm | |
| // | |
| // Created by Valeri Hristov on 6.02.20. | |
| // Copyright © 2020 Valeri Hristov. All rights reserved. | |
| // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // main.cpp | |
| // hellocpp | |
| // | |
| // Finds number of trailing zeroes in factorial problem. | |
| // | |
| // Created by Valeri Hristov on 6.02.20. | |
| // Copyright © 2020 Valeri Hristov. All rights reserved. | |
| // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // main.cpp | |
| // hellocpp | |
| // | |
| // Compare arrays. | |
| // | |
| // Created by Valeri Hristov on 6.02.20. | |
| // Copyright © 2020 Valeri Hristov. All rights reserved. | |
| // |