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

Revision 203, 1.9 KB checked in by jdalbey, 6 years ago (diff)

XMLWriter.java name changed to XMLBuilder. Add pretty printing methods (ticket #237).

Line 
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;
12import scriptbuilder.structures.XMLBuilder;
13
14/**
15 * Data model for an activity log evaluation event. This is an evaluation event.
16 *
17 * @author Bryan McGuffin
18 */
19public class ActivityLogEvaluationEvent extends ScriptEvent implements I_EvaluationEvent, I_XML_Writable
20{
21
22    /**
23     * Constructor.
24     */
25    public ActivityLogEvaluationEvent()
26    {
27        super(ScriptEventType.ACTIVITY_LOG_EVAL_EVENT);
28    }
29
30    /**
31     * A list of the expected actions held by this evaluation event.
32     */
33    public ArrayList<String> expectedAction = new ArrayList<String>();
34
35    @Override
36    public ArrayList<String> getExpectedActions()
37    {
38        return expectedAction;
39    }
40
41    @Override
42    public void addAction(String act)
43    {
44        expectedAction.add(act);
45    }
46
47    @Override
48    public void updateAction(int index, String act)
49    {
50        expectedAction.set(index, act);
51    }
52
53    @Override
54    public void removeAction(int index)
55    {
56        expectedAction.remove(index);
57    }
58
59    @Override
60    public String toXML()
61    {
62        String output = XMLBuilder.openTag(ELEMENT.ACTIVITY_LOG_EVALUATION.tag);
63        if (expectedAction != null)
64        {
65            for (String str : expectedAction)
66            {
67                if (str == null)
68                {
69                    str = "";
70                }
71                output += XMLBuilder.simpleTag(str, ELEMENT.EXPECTED_ACTION);
72            }
73        }
74        output += XMLBuilder.closeTag(ELEMENT.ACTIVITY_LOG_EVALUATION.tag);
75
76        return output;
77    }
78}
Note: See TracBrowser for help on using the repository browser.