aboutsummaryrefslogtreecommitdiff
path: root/src/main/ui/TemplateSetScreen.java
diff options
context:
space:
mode:
authorYuuta Liang <yuutaw@students.cs.ubc.ca>2023-10-14 07:53:12 +0800
committerYuuta Liang <yuutaw@students.cs.ubc.ca>2023-10-14 07:53:12 +0800
commit55df54e5dbf26e6824123410784d00aa793c3781 (patch)
treef38fd2b1e23b1d7b00220137606d8570636f5475 /src/main/ui/TemplateSetScreen.java
parentdf3eb7af36b6797e0c8e09a179191c329889da57 (diff)
downloadjca-55df54e5dbf26e6824123410784d00aa793c3781.tar
jca-55df54e5dbf26e6824123410784d00aa793c3781.tar.gz
jca-55df54e5dbf26e6824123410784d00aa793c3781.tar.bz2
jca-55df54e5dbf26e6824123410784d00aa793c3781.zip
Fix comments in UI
Signed-off-by: Yuuta Liang <yuutaw@students.cs.ubc.ca>
Diffstat (limited to 'src/main/ui/TemplateSetScreen.java')
-rw-r--r--src/main/ui/TemplateSetScreen.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main/ui/TemplateSetScreen.java b/src/main/ui/TemplateSetScreen.java
index 9a31f50..42f393b 100644
--- a/src/main/ui/TemplateSetScreen.java
+++ b/src/main/ui/TemplateSetScreen.java
@@ -3,6 +3,9 @@ package ui;
import model.asn1.exceptions.ParseException;
import model.ca.Template;
+/**
+ * The screen that modifies the properties of a single template and add it to the store.
+ */
public class TemplateSetScreen implements UIHandler {
private final JCA session;
@@ -15,6 +18,9 @@ public class TemplateSetScreen implements UIHandler {
private Template template;
+ /**
+ * EFFECTS: Print help
+ */
@Override
public void help() {
System.out.println("show\tView the current template settings\n"
@@ -24,6 +30,10 @@ public class TemplateSetScreen implements UIHandler {
+ "help\tPrint this help message\n");
}
+ /**
+ * EFFECTS: Parse and set / unset the subject of the template
+ * MODIFIES: this#template
+ */
private void handleSetSubject(String val) {
try {
template.setSubject(val);
@@ -32,6 +42,10 @@ public class TemplateSetScreen implements UIHandler {
}
}
+ /**
+ * EFFECTS: Set the validity of the template to the given integer
+ * MODIFIES: this#template
+ */
private void handleSetValidity(String val) {
if (val == null) {
System.out.println("Cannot unset validity");
@@ -49,6 +63,10 @@ public class TemplateSetScreen implements UIHandler {
}
}
+ /**
+ * EFFECTS: Handle the `set` command.
+ * MODIFIES: this#template
+ */
private void handleSet(String... args) {
if (args.length != 2 && args.length != 3) {
System.out.println("Usage: set <key> <value>");
@@ -89,6 +107,9 @@ public class TemplateSetScreen implements UIHandler {
System.out.println("Validity:\t" + template.getValidity() + " days");
}
+ /**
+ * EFFECTS: Handle commands
+ */
@Override
public void command(String... args) {
switch (args[0]) {