1 | package util;
|
---|
2 |
|
---|
3 | import java.time.LocalDate;
|
---|
4 | import java.time.LocalTime;
|
---|
5 | import java.time.format.DateTimeFormatter;
|
---|
6 |
|
---|
7 | public class MacroniserLogFileData {
|
---|
8 |
|
---|
9 | //object variables
|
---|
10 | private LocalDate date;
|
---|
11 | private LocalTime time;
|
---|
12 | private String inputText;
|
---|
13 | private String outputText;
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * Constructor to set up object with stored values without the
|
---|
17 | * @param date - The date the log file was used
|
---|
18 | * @param inputText - The input text of the log file
|
---|
19 | * @param outputText - the fixed text of the log file with '<mark>' tags
|
---|
20 | */
|
---|
21 | public MacroniserLogFileData (LocalDate date, LocalTime time, String inputText, String outputText){
|
---|
22 | this.date = date;
|
---|
23 | this.time = time;
|
---|
24 | this.inputText = inputText;
|
---|
25 | this.outputText = outputText;
|
---|
26 | }
|
---|
27 |
|
---|
28 | @Override
|
---|
29 | public String toString() {
|
---|
30 | //Set up the string builder containing all fields
|
---|
31 | StringBuilder sb = new StringBuilder();
|
---|
32 | sb.append("INFO : [");
|
---|
33 | sb.append(date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
---|
34 | sb.append(" ");
|
---|
35 | sb.append(time.format(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
---|
36 | sb.append("] DirectInput.doPost() \n Input:");
|
---|
37 | if(inputText != null) sb.append(inputText);
|
---|
38 | sb.append("Output:");
|
---|
39 | if(outputText != null) sb.append(outputText);
|
---|
40 |
|
---|
41 | return sb.toString();
|
---|
42 | }
|
---|
43 |
|
---|
44 | /*Getters and Setters for the appropriate variables*/
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * Gets the date
|
---|
48 | * @return the date of this instance
|
---|
49 | */
|
---|
50 | public LocalDate getDate() { return date; }
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * Sets the date
|
---|
54 | * @param date - the date that we are setting for this instance
|
---|
55 | */
|
---|
56 | public void setDate(LocalDate date) { this.date = date; }
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * Gets the time stored in this instance
|
---|
60 | * @return returns the time as LocalTime
|
---|
61 | */
|
---|
62 | public LocalTime getTime() { return time; }
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * Method to be called if the user wants to set the time
|
---|
66 | * @param time
|
---|
67 | */
|
---|
68 | public void setTime(LocalTime time) { this.time = time; }
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * Returns the input text
|
---|
72 | * @return - the input text of this instance
|
---|
73 | */
|
---|
74 | public String getInputText() { return inputText; }
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * Sets the input text
|
---|
78 | * @param inputText - the input text
|
---|
79 | */
|
---|
80 | public void setInputText(String inputText) { this.inputText = inputText; }
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * Returns the fixed text
|
---|
84 | * @return - the fixed text of this instance
|
---|
85 | */
|
---|
86 | public String getOutputText() { return outputText; }
|
---|
87 |
|
---|
88 | /**
|
---|
89 | * Sets the fixed text to the given string
|
---|
90 | * @param outputText
|
---|
91 | */
|
---|
92 | public void setOutputText(String outputText) { this.outputText = outputText; }
|
---|
93 | }
|
---|