Warning: Can't use blame annotator:
svn blame failed on trunk/src/scriptbuilder/structures/events/ActivityLogEvaluationEvent.java: ("Can't find a temporary directory: Internal error", 20014)

source: tmcsimulator-scriptbuilder/trunk/src/scriptbuilder/structures/events/ActivityLogEvaluationEvent.java @ 36

Revision 36, 1.8 KB checked in by bmcguffin, 9 years ago (diff)

Added toXML implementation for all remaining event classes.

RevLine 
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 */
6package scriptbuilder.structures.events;
7
8import java.util.ArrayList;
9import scriptbuilder.structures.ELEMENT;
10import scriptbuilder.structures.I_XML_Writable;
11import 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 */
18public 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}
Note: See TracBrowser for help on using the repository browser.