source: tmcsimulator-scriptbuilder/trunk/src/scriptbuilder/structures/events/ATMSEvaluationEvent.java @ 38

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

Removed the newLine at the end of each openTag method.

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;
12
13/**
14 * Data model for an ATMS evaluation event. This is an evaluation event.
15 *
16 * @author Bryan McGuffin
17 */
18public class ATMSEvaluationEvent extends ScriptEvent implements I_EvaluationEvent, I_XML_Writable
19{
20
21    public ATMSEvaluationEvent()
22    {
23        super(ScriptEventType.ATMS_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.ATMS_EVALUATION.tag);
56        for (String str : expectedAction)
57        {
58            output += openTag(ELEMENT.EXPECTED_ACTION.tag);
59            output += str;
60            output += closeTag(ELEMENT.EXPECTED_ACTION.tag);
61        }
62        output += closeTag(ELEMENT.ATMS_EVALUATION.tag);
63
64        return output;
65    }
66
67    @Override
68    public String openTag(String s)
69    {
70        return "<" + s + ">";
71    }
72
73    @Override
74    public String closeTag(String s)
75    {
76        return "</" + s + ">\n";
77    }
78
79    @Override
80    public String emptyTag(String s)
81    {
82        return "<" + s + "/>\n";
83    }
84}
Note: See TracBrowser for help on using the repository browser.