aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiederick de Vries <diederick@diederickdevries.net>2020-03-27 17:52:03 +0100
committerDiederick de Vries <diederick@diederickdevries.net>2020-03-27 17:52:03 +0100
commita7a23e9a88f4ad40b8cc0398e14420b54be00d2e (patch)
treecc3f69a92b94d9613c2fe57520bb73c363981865
parent1860439252c30963998ec2cfccc4fe14dacd4410 (diff)
downloadcalcusaurus-a7a23e9a88f4ad40b8cc0398e14420b54be00d2e.tar.gz
calcusaurus-a7a23e9a88f4ad40b8cc0398e14420b54be00d2e.tar.bz2
calcusaurus-a7a23e9a88f4ad40b8cc0398e14420b54be00d2e.zip
feature(model): add input verifier regex to assignments
-rw-r--r--src/main/java/net/diederickdevries/calcusaurus/model/Assignment.java1
-rw-r--r--src/main/java/net/diederickdevries/calcusaurus/model/SimpleAdditionAssignment.java6
-rw-r--r--src/main/java/net/diederickdevries/calcusaurus/model/SimpleDivisionAssignment.java6
-rw-r--r--src/main/java/net/diederickdevries/calcusaurus/model/SimpleMultiplicationAssignment.java8
-rw-r--r--src/main/java/net/diederickdevries/calcusaurus/model/SimpleSubstractionAssignment.java6
5 files changed, 27 insertions, 0 deletions
diff --git a/src/main/java/net/diederickdevries/calcusaurus/model/Assignment.java b/src/main/java/net/diederickdevries/calcusaurus/model/Assignment.java
index db5091d..9f0af28 100644
--- a/src/main/java/net/diederickdevries/calcusaurus/model/Assignment.java
+++ b/src/main/java/net/diederickdevries/calcusaurus/model/Assignment.java
@@ -26,6 +26,7 @@ public interface Assignment
26 String getType(); 26 String getType();
27 String getSymbol(); 27 String getSymbol();
28 String getAssignment(); 28 String getAssignment();
29 String getInputVerification();
29 int getFirstNumber(); 30 int getFirstNumber();
30 int getSecondNumber(); 31 int getSecondNumber();
31 int getSolution(); 32 int getSolution();
diff --git a/src/main/java/net/diederickdevries/calcusaurus/model/SimpleAdditionAssignment.java b/src/main/java/net/diederickdevries/calcusaurus/model/SimpleAdditionAssignment.java
index aa475c6..7d9b528 100644
--- a/src/main/java/net/diederickdevries/calcusaurus/model/SimpleAdditionAssignment.java
+++ b/src/main/java/net/diederickdevries/calcusaurus/model/SimpleAdditionAssignment.java
@@ -26,6 +26,7 @@ public class SimpleAdditionAssignment extends SimpleAssignment
26 26
27 public static String TYPE = "ADDITION"; 27 public static String TYPE = "ADDITION";
28 public static String SYMBOL = "+"; 28 public static String SYMBOL = "+";
29 public static String inputVerification = "^-?\\d+$";
29 30
30 @Override 31 @Override
31 public String getType() 32 public String getType()
@@ -38,4 +39,9 @@ public class SimpleAdditionAssignment extends SimpleAssignment
38 { 39 {
39 return SYMBOL; 40 return SYMBOL;
40 } 41 }
42
43 @Override
44 public String getInputVerification() {
45 return inputVerification;
46 }
41} 47}
diff --git a/src/main/java/net/diederickdevries/calcusaurus/model/SimpleDivisionAssignment.java b/src/main/java/net/diederickdevries/calcusaurus/model/SimpleDivisionAssignment.java
index e8ec821..25e0a07 100644
--- a/src/main/java/net/diederickdevries/calcusaurus/model/SimpleDivisionAssignment.java
+++ b/src/main/java/net/diederickdevries/calcusaurus/model/SimpleDivisionAssignment.java
@@ -25,6 +25,7 @@ public class SimpleDivisionAssignment extends SimpleAssignment
25{ 25{
26 public static String TYPE = "DIVISION"; 26 public static String TYPE = "DIVISION";
27 public static String SYMBOL = "÷"; 27 public static String SYMBOL = "÷";
28 public static String inputVerification = "^-?\\d+$";
28 29
29 @Override 30 @Override
30 public String getType() 31 public String getType()
@@ -37,4 +38,9 @@ public class SimpleDivisionAssignment extends SimpleAssignment
37 { 38 {
38 return SYMBOL; 39 return SYMBOL;
39 } 40 }
41
42 @Override
43 public String getInputVerification() {
44 return inputVerification;
45 }
40} 46}
diff --git a/src/main/java/net/diederickdevries/calcusaurus/model/SimpleMultiplicationAssignment.java b/src/main/java/net/diederickdevries/calcusaurus/model/SimpleMultiplicationAssignment.java
index 35d0fec..99ea01a 100644
--- a/src/main/java/net/diederickdevries/calcusaurus/model/SimpleMultiplicationAssignment.java
+++ b/src/main/java/net/diederickdevries/calcusaurus/model/SimpleMultiplicationAssignment.java
@@ -17,6 +17,8 @@
17 */ 17 */
18package net.diederickdevries.calcusaurus.model; 18package net.diederickdevries.calcusaurus.model;
19 19
20import javax.swing.InputVerifier;
21
20/** 22/**
21 * 23 *
22 * @author Diederick de Vries <diederick@diederickdevries.net> 24 * @author Diederick de Vries <diederick@diederickdevries.net>
@@ -25,6 +27,7 @@ public class SimpleMultiplicationAssignment extends SimpleAssignment
25{ 27{
26 public static String TYPE = "MULTIPLICATION"; 28 public static String TYPE = "MULTIPLICATION";
27 public static String SYMBOL = "×"; 29 public static String SYMBOL = "×";
30 public static String inputVerification = "^-?\\d+$";
28 31
29 @Override 32 @Override
30 public String getType() 33 public String getType()
@@ -37,4 +40,9 @@ public class SimpleMultiplicationAssignment extends SimpleAssignment
37 { 40 {
38 return SYMBOL; 41 return SYMBOL;
39 } 42 }
43
44 @Override
45 public String getInputVerification() {
46 return inputVerification;
47 }
40} 48}
diff --git a/src/main/java/net/diederickdevries/calcusaurus/model/SimpleSubstractionAssignment.java b/src/main/java/net/diederickdevries/calcusaurus/model/SimpleSubstractionAssignment.java
index 3817b46..5864d7f 100644
--- a/src/main/java/net/diederickdevries/calcusaurus/model/SimpleSubstractionAssignment.java
+++ b/src/main/java/net/diederickdevries/calcusaurus/model/SimpleSubstractionAssignment.java
@@ -25,6 +25,7 @@ public class SimpleSubstractionAssignment extends SimpleAssignment
25{ 25{
26 public static String TYPE = "SUBSTRACTION"; 26 public static String TYPE = "SUBSTRACTION";
27 public static String SYMBOL = "-"; 27 public static String SYMBOL = "-";
28 public static String inputVerification = "^-?\\d+$";
28 29
29 @Override 30 @Override
30 public String getType() 31 public String getType()
@@ -37,4 +38,9 @@ public class SimpleSubstractionAssignment extends SimpleAssignment
37 { 38 {
38 return SYMBOL; 39 return SYMBOL;
39 } 40 }
41
42 @Override
43 public String getInputVerification() {
44 return inputVerification;
45 }
40} 46}