mirror of
https://bitbucket.org/Mattrixwv/projecteulerjava.git
synced 2025-12-06 17:13:58 -05:00
Started verification tests
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.mattrixwv.project_euler;
|
||||
package com.mattrixwv.project_euler.exceptions;
|
||||
|
||||
|
||||
public class Unsolved extends RuntimeException{
|
||||
@@ -24,14 +24,13 @@ package com.mattrixwv.project_euler.problems;
|
||||
|
||||
import com.mattrixwv.Stopwatch;
|
||||
import com.mattrixwv.exceptions.InvalidResult;
|
||||
|
||||
import com.mattrixwv.project_euler.Unsolved;
|
||||
import com.mattrixwv.project_euler.exceptions.Unsolved;
|
||||
|
||||
|
||||
public abstract class Problem{
|
||||
//Variables
|
||||
//Instance variables
|
||||
protected final Stopwatch timer = new Stopwatch(); //To time how long it takes to run the algorithm
|
||||
protected Stopwatch timer = new Stopwatch(); //To time how long it takes to run the algorithm
|
||||
private final String description; //Holds the description of the problem
|
||||
protected boolean solved; //Shows whether the problem has already been solved
|
||||
|
||||
@@ -62,11 +61,14 @@ public abstract class Problem{
|
||||
}
|
||||
return timer;
|
||||
}
|
||||
void solvedCheck(String str){
|
||||
protected void solvedCheck(String str){
|
||||
if(!solved){
|
||||
throw new Unsolved("You must solve the problem before you can see the " + str);
|
||||
}
|
||||
}
|
||||
public boolean getSolved(){
|
||||
return solved;
|
||||
}
|
||||
//Solve the problem
|
||||
public abstract void solve() throws InvalidResult;
|
||||
//Reset the problem so it can be run again
|
||||
|
||||
@@ -24,7 +24,7 @@ package com.mattrixwv.project_euler.problems;
|
||||
|
||||
|
||||
import com.mattrixwv.exceptions.InvalidResult;
|
||||
import com.mattrixwv.project_euler.Unsolved;
|
||||
import com.mattrixwv.project_euler.exceptions.Unsolved;
|
||||
|
||||
|
||||
public class Problem17 extends Problem{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
package com.mattrixwv.project_euler.problems;
|
||||
|
||||
|
||||
import com.mattrixwv.project_euler.Unsolved;
|
||||
import com.mattrixwv.project_euler.exceptions.Unsolved;
|
||||
|
||||
|
||||
public class Problem9 extends Problem{
|
||||
|
||||
Reference in New Issue
Block a user