Skip to content

Commit 20f2fdd

Browse files
Minor modifications to the sample
1 parent 923be43 commit 20f2fdd

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

src/main/java/de/rub/nds/modifiablevariable/biginteger/BigIntegerInteractiveModification.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,17 @@
1717
* @author Janis Fliegenschmidt - janis.fliegenschmidt@rub.de
1818
*/
1919
@XmlRootElement
20-
@XmlType(propOrder = {"interactive", "modificationFilter", "postModification"})
20+
@XmlType(propOrder = { "interactive", "modificationFilter", "postModification" })
2121
public class BigIntegerInteractiveModification extends VariableModification<BigInteger> {
2222

2323
private InteractiveBigIntegerModification modification;
2424

25-
public BigIntegerInteractiveModification() {
25+
protected BigIntegerInteractiveModification() {
2626
this(new InteractiveBigIntegerModification() {
2727
@Override
2828
public BigInteger modify(BigInteger oldVal) {
2929
// Fail fast
30-
throw new UnsupportedOperationException("No interactive modifi"
31-
+ "cation specified.");
30+
throw new UnsupportedOperationException("No interactive modifi" + "cation specified.");
3231
}
3332
});
3433
}

src/main/java/de/rub/nds/modifiablevariable/biginteger/BigIntegerModificationFactory.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,24 +88,32 @@ public static VariableModification<BigInteger> explicitValueFromFile(int value)
8888
return modifications.get(pos);
8989
}
9090

91-
public static VariableModification<BigInteger> interactive() {
92-
return new BigIntegerInteractiveModification(
93-
new BigIntegerInteractiveModification.InteractiveBigIntegerModification() {
91+
public static VariableModification<BigInteger> interactive(final String variableName) {
92+
return interactive(new BigIntegerInteractiveModification.InteractiveBigIntegerModification() {
9493
@Override
9594
public BigInteger modify(BigInteger oldVal) {
9695
BigInteger result = null;
97-
98-
System.out.println("Enter new value for BigInt (Old value is "
99-
+ oldVal.toString() + "): ");
96+
97+
System.out.println("Enter new value for " + variableName + " (Old value is " + oldVal.toString()
98+
+ "): ");
10099
String input = System.console().readLine().trim();
101-
100+
102101
result = new BigInteger(input);
103-
102+
104103
return result;
105104
}
106105
});
107106
}
108107

108+
public static VariableModification<BigInteger> interactive() {
109+
return interactive("BigInt");
110+
}
111+
112+
public static VariableModification<BigInteger> interactive(
113+
BigIntegerInteractiveModification.InteractiveBigIntegerModification modification) {
114+
return new BigIntegerInteractiveModification(modification);
115+
}
116+
109117
public static synchronized List<VariableModification<BigInteger>> modificationsFromFile() {
110118
try {
111119
if (modificationsFromFile == null) {

0 commit comments

Comments
 (0)