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

Revision 38, 1.9 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 */
6
7package scriptbuilder.structures.events;
8
9import java.util.ArrayList;
10import scriptbuilder.structures.ELEMENT;
11import scriptbuilder.structures.I_XML_Writable;
12import scriptbuilder.structures.ScriptEvent;
13
14/**
15 * Data model for a radio evaluation event. This is an evaluation event.
16 *
17 * @author Bryan McGuffin
18 */
19public class RadioEvaluationEvent extends ScriptEvent implements I_EvaluationEvent, I_XML_Writable
20{
21
22    public RadioEvaluationEvent()
23    {
24        super(ScriptEventType.RADIO_EVAL_EVENT);
25    }
26   
27    public ArrayList<String> expectedAction = new ArrayList<String>();
28   
29    @Override
30    public ArrayList<String> getExpectedActions()
31    {
32        return expectedAction;
33    }
34   
35    @Override
36    public void addAction(String act)
37    {
38        expectedAction.add(act);
39    }
40
41    @Override
42    public void updateAction(int index, String act)
43    {
44        expectedAction.set(index, act);
45    }
46   
47    @Override
48    public void removeAction(int index)
49    {
50        expectedAction.remove(index);
51    }
52
53    @Override
54    public String toXML()
55    {
56        String output = openTag(ELEMENT.RADIO_EVALUATION.tag);
57        for (String str : expectedAction)
58        {
59            output += openTag(ELEMENT.EXPECTED_ACTION.tag);
60            output += str;
61            output += closeTag(ELEMENT.EXPECTED_ACTION.tag);
62        }
63        output += closeTag(ELEMENT.RADIO_EVALUATION.tag);
64       
65        return output;
66    }
67
68    @Override
69    public String openTag(String s)
70    {
71        return "<" + s + ">";
72    }
73
74    @Override
75    public String closeTag(String s)
76    {
77        return "</" + s + ">\n";
78    }
79
80    @Override
81    public String emptyTag(String s)
82    {
83        return "<" + s + "/>\n";
84    }
85}
Note: See TracBrowser for help on using the repository browser.