| 1 | /* |
|---|
| 2 | * To change this license header, choose License Headers in Project Properties. |
|---|
| 3 | * To change this template file, choose Tools | Templates |
|---|
| 4 | * and open the template in the editor. |
|---|
| 5 | */ |
|---|
| 6 | package scriptbuilder.structures.events; |
|---|
| 7 | |
|---|
| 8 | import java.util.ArrayList; |
|---|
| 9 | import scriptbuilder.structures.ELEMENT; |
|---|
| 10 | import scriptbuilder.structures.I_XML_Writable; |
|---|
| 11 | import scriptbuilder.structures.ScriptEvent; |
|---|
| 12 | |
|---|
| 13 | /** |
|---|
| 14 | * Data model for an activity log evaluation event. This is an evaluation event. |
|---|
| 15 | * |
|---|
| 16 | * @author Bryan McGuffin |
|---|
| 17 | */ |
|---|
| 18 | public class ActivityLogEvaluationEvent extends ScriptEvent implements I_EvaluationEvent, I_XML_Writable |
|---|
| 19 | { |
|---|
| 20 | |
|---|
| 21 | public ActivityLogEvaluationEvent() |
|---|
| 22 | { |
|---|
| 23 | super(ScriptEventType.ACTIVITY_LOG_EVAL_EVENT); |
|---|
| 24 | } |
|---|
| 25 | |
|---|
| 26 | public ArrayList<String> expectedAction = new ArrayList<String>(); |
|---|
| 27 | |
|---|
| 28 | @Override |
|---|
| 29 | public ArrayList<String> getExpectedActions() |
|---|
| 30 | { |
|---|
| 31 | return expectedAction; |
|---|
| 32 | } |
|---|
| 33 | |
|---|
| 34 | @Override |
|---|
| 35 | public void addAction(String act) |
|---|
| 36 | { |
|---|
| 37 | expectedAction.add(act); |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | @Override |
|---|
| 41 | public void updateAction(int index, String act) |
|---|
| 42 | { |
|---|
| 43 | expectedAction.set(index, act); |
|---|
| 44 | } |
|---|
| 45 | |
|---|
| 46 | @Override |
|---|
| 47 | public void removeAction(int index) |
|---|
| 48 | { |
|---|
| 49 | expectedAction.remove(index); |
|---|
| 50 | } |
|---|
| 51 | |
|---|
| 52 | @Override |
|---|
| 53 | public String toXML() |
|---|
| 54 | { |
|---|
| 55 | String output = openTag(ELEMENT.ACTIVITY_LOG_EVALUATION.tag); |
|---|
| 56 | output += openTag(ELEMENT.EXPECTED_ACTION.tag); |
|---|
| 57 | output += expectedAction; |
|---|
| 58 | output += closeTag(ELEMENT.EXPECTED_ACTION.tag); |
|---|
| 59 | output += closeTag(ELEMENT.ACTIVITY_LOG_EVALUATION.tag); |
|---|
| 60 | |
|---|
| 61 | return output; |
|---|
| 62 | } |
|---|
| 63 | |
|---|
| 64 | @Override |
|---|
| 65 | public String openTag(String s) |
|---|
| 66 | { |
|---|
| 67 | return "<" + s + ">\n"; |
|---|
| 68 | } |
|---|
| 69 | |
|---|
| 70 | @Override |
|---|
| 71 | public String closeTag(String s) |
|---|
| 72 | { |
|---|
| 73 | return "</" + s + ">\n"; |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | @Override |
|---|
| 77 | public String emptyTag(String s) |
|---|
| 78 | { |
|---|
| 79 | return "<" + s + "/>\n"; |
|---|
| 80 | } |
|---|
| 81 | } |
|---|