@@ -23,7 +23,7 @@ class ConfigurationParser {
23
23
}
24
24
private fun load (): Device ? {
25
25
try {
26
- val context = JAXBContext .newInstance(Device ::class .java, Set ::class .java, Random ::class .java, Delay ::class .java, Linear ::class .java, Add ::class .java, Sub ::class .java, Csv ::class .java, IfEqual ::class .java, Parameters ::class .java, Parameter ::class .java, Trace ::class .java)
26
+ val context = JAXBContext .newInstance(Device ::class .java, Set ::class .java, Random ::class .java, Delay ::class .java, Linear ::class .java, Add ::class .java, Sub ::class .java, Csv ::class .java, IfEqual ::class .java, Parameters ::class .java, Parameter ::class .java, Trace ::class .java, Mult :: class .java, Div :: class .java, IfGreater :: class .java, IfLess :: class .java )
27
27
val unmarshaller = context.createUnmarshaller()
28
28
return if (fileName.isEmpty() ) {
29
29
val reader = StringReader (this ::class .java.classLoader.getResource(" configuration.xml" )!! .readText())
@@ -97,6 +97,40 @@ data class IfEqual(
97
97
constructor () : this (" " ," " ,mutableListOf ())
98
98
}
99
99
100
+ // <ifGreater symbol="TEMP" value="12.4">
101
+ // <sub symbol="MOTOR_SPEED1">12</sub>
102
+ // any other operation ...
103
+ // </ifGreater>
104
+ @XmlRootElement(name= " ifGreater" )
105
+ data class IfGreater (
106
+ @field:XmlAttribute(required = true)
107
+ val symbol : String ,
108
+ @field:XmlAttribute(required = true)
109
+ val value : String ,
110
+ @XmlAnyElement(lax = true )
111
+ var randomElements : List <Any >
112
+ ){
113
+ constructor () : this (" " ," " ,mutableListOf ())
114
+ }
115
+
116
+ // <ifLess symbol="TEMP" value="12.4">
117
+ // <sub symbol="MOTOR_SPEED1">12</sub>
118
+ // any other operation ...
119
+ // </ifLess>
120
+ @XmlRootElement(name= " ifLess" )
121
+ data class IfLess (
122
+ @field:XmlAttribute(required = true)
123
+ val symbol : String ,
124
+ @field:XmlAttribute(required = true)
125
+ val value : String ,
126
+ @XmlAnyElement(lax = true )
127
+ var randomElements : List <Any >
128
+ ){
129
+ constructor () : this (" " ," " ,mutableListOf ())
130
+ }
131
+
132
+
133
+
100
134
// <csv symbol="TEMPERATURE_MOTOR4" file="test.csv" column="0" step="2" startRow="2" endRow="100" replay="true"/>
101
135
@XmlRootElement(name= " csv" )
102
136
data class Csv (
@@ -173,6 +207,29 @@ data class Add(
173
207
constructor (): this (" " , " 0" )
174
208
}
175
209
210
+ // <mult symbol="MOTOR_SPEED1">RPM_MOTOR1</mult>
211
+ @XmlRootElement(name= " mult" )
212
+ data class Mult (
213
+ @field:XmlAttribute(required = true)
214
+ val symbol : String ,
215
+ @field:XmlValue
216
+ val value : String ,
217
+ ){
218
+ constructor (): this (" " , " 0" )
219
+ }
220
+
221
+ // <div symbol="MOTOR_SPEED1">RPM_MOTOR1</div>
222
+ @XmlRootElement(name= " div" )
223
+ data class Div (
224
+ @field:XmlAttribute(required = true)
225
+ val symbol : String ,
226
+ @field:XmlValue
227
+ val value : String ,
228
+ ){
229
+ constructor (): this (" " , " 0" )
230
+ }
231
+
232
+
176
233
// <delay>100</delay>
177
234
@XmlRootElement(name= " delay" )
178
235
data class Delay (
0 commit comments