MtasFunctionParserFunctionBasic.java.html
46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>MtasFunctionParserFunctionBasic.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">MTAS</a> > <a href="index.source.html" class="el_package">mtas.parser.function.util</a> > <span class="el_source">MtasFunctionParserFunctionBasic.java</span></div><h1>MtasFunctionParserFunctionBasic.java</h1><pre class="source lang-java linenums">package mtas.parser.function.util;
import java.io.IOException;
import java.util.ArrayList;
import mtas.codec.util.CodecUtil;
import mtas.parser.function.ParseException;
/**
* The Class MtasFunctionParserFunctionBasic.
*/
public class MtasFunctionParserFunctionBasic
extends MtasFunctionParserFunction {
/** The first type. */
private String firstType;
/** The first id. */
private int firstId;
/** The tmp parser longs. */
<span class="fc" id="L22"> private ArrayList<MtasFunctionParserFunction> tmpParserLongs = new ArrayList<>();</span>
/** The tmp parser doubles. */
<span class="fc" id="L25"> private ArrayList<MtasFunctionParserFunction> tmpParserDoubles = new ArrayList<>();</span>
/** The tmp constant longs. */
<span class="fc" id="L28"> private ArrayList<Long> tmpConstantLongs = new ArrayList<>();</span>
/** The tmp constant doubles. */
<span class="fc" id="L31"> private ArrayList<Double> tmpConstantDoubles = new ArrayList<>();</span>
/** The number. */
private int number;
/** The operator list. */
private String[] operatorList;
/** The type list. */
private String[] typeList;
/** The id list. */
private int[] idList;
/** The tmp operator list. */
<span class="fc" id="L46"> private ArrayList<String> tmpOperatorList = new ArrayList<>();</span>
/** The tmp type list. */
<span class="fc" id="L49"> private ArrayList<String> tmpTypeList = new ArrayList<>();</span>
/** The tmp id list. */
<span class="fc" id="L52"> private ArrayList<Integer> tmpIdList = new ArrayList<>();</span>
/** The Constant BASIC_OPERATOR_ADD. */
public static final String BASIC_OPERATOR_ADD = "add";
/** The Constant BASIC_OPERATOR_SUBTRACT. */
public static final String BASIC_OPERATOR_SUBTRACT = "subtract";
/** The Constant BASIC_OPERATOR_MULTIPLY. */
public static final String BASIC_OPERATOR_MULTIPLY = "multiply";
/** The Constant BASIC_OPERATOR_DIVIDE. */
public static final String BASIC_OPERATOR_DIVIDE = "divide";
/** The Constant BASIC_OPERATOR_POWER. */
public static final String BASIC_OPERATOR_POWER = "power";
/**
* Instantiates a new mtas function parser function basic.
*
* @param item the item
* @throws ParseException the parse exception
*/
public MtasFunctionParserFunctionBasic(MtasFunctionParserItem item)
<span class="fc" id="L76"> throws ParseException {</span>
<span class="fc" id="L77"> sumRule = true;</span>
<span class="fc" id="L78"> String type = item.getType();</span>
MtasFunctionParserFunction parser;
<span class="fc" id="L80"> firstType = type;</span>
<span class="fc" id="L81"> degree = item.getDegree();</span>
<span class="pc bpc" id="L82" title="14 of 26 branches missed."> switch (type) {</span>
case MtasFunctionParserItem.TYPE_N:
<span class="fc" id="L84"> firstId = 0;</span>
<span class="fc" id="L85"> dataType = CodecUtil.DATA_TYPE_LONG;</span>
<span class="fc" id="L86"> needPositions = true;</span>
<span class="fc" id="L87"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_LONG:
<span class="fc" id="L89"> firstId = tmpConstantLongs.size();</span>
<span class="fc" id="L90"> dataType = CodecUtil.DATA_TYPE_LONG;</span>
<span class="fc" id="L91"> tmpConstantLongs.add(item.getValueLong());</span>
<span class="fc" id="L92"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_DOUBLE:
<span class="nc" id="L94"> firstId = tmpConstantDoubles.size();</span>
<span class="nc" id="L95"> dataType = CodecUtil.DATA_TYPE_DOUBLE;</span>
<span class="nc" id="L96"> tmpConstantDoubles.add(item.getValueDouble());</span>
<span class="nc" id="L97"> break;</span>
case MtasFunctionParserItem.TYPE_ARGUMENT:
<span class="fc" id="L99"> firstType = type;</span>
<span class="fc" id="L100"> firstId = item.getId();</span>
<span class="fc" id="L101"> dataType = CodecUtil.DATA_TYPE_LONG;</span>
<span class="fc" id="L102"> needArgument.add(item.getId());</span>
<span class="fc" id="L103"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_LONG:
<span class="fc" id="L105"> parser = item.getParser();</span>
<span class="fc" id="L106"> parser.close();</span>
<span class="pc bpc" id="L107" title="1 of 2 branches missed."> if (parser.getType().equals(CodecUtil.DATA_TYPE_LONG)) {</span>
<span class="fc" id="L108"> firstId = tmpParserLongs.size();</span>
<span class="fc" id="L109"> tmpParserLongs.add(parser);</span>
<span class="fc" id="L110"> sumRule = parser.sumRule();</span>
<span class="fc" id="L111"> dataType = CodecUtil.DATA_TYPE_LONG;</span>
<span class="pc bpc" id="L112" title="1 of 2 branches missed."> needPositions = needPositions ? needPositions : parser.needPositions();</span>
<span class="fc" id="L113"> needArgument.addAll(parser.needArgument);</span>
} else {
<span class="nc" id="L115"> throw new ParseException("incorrect dataType");</span>
}
break;
case MtasFunctionParserItem.TYPE_PARSER_DOUBLE:
<span class="nc" id="L119"> parser = item.getParser();</span>
<span class="nc" id="L120"> parser.close();</span>
<span class="nc bnc" id="L121" title="All 2 branches missed."> if (parser.getType().equals(CodecUtil.DATA_TYPE_DOUBLE)) {</span>
<span class="nc" id="L122"> firstId = tmpParserDoubles.size();</span>
<span class="nc" id="L123"> tmpParserDoubles.add(parser);</span>
<span class="nc" id="L124"> sumRule = parser.sumRule();</span>
<span class="nc" id="L125"> dataType = CodecUtil.DATA_TYPE_DOUBLE;</span>
<span class="nc bnc" id="L126" title="All 2 branches missed."> needPositions = needPositions ? needPositions : parser.needPositions();</span>
<span class="nc" id="L127"> needArgument.addAll(parser.needArgument);</span>
} else {
<span class="nc" id="L129"> throw new ParseException("incorrect dataType");</span>
}
break;
default:
<span class="nc" id="L133"> throw new ParseException("unknown type");</span>
}
<span class="fc" id="L135"> }</span>
/*
* (non-Javadoc)
*
* @see mtas.parser.function.util.MtasFunctionParserFunction#close()
*/
@Override
public void close() throws ParseException {
<span class="pc bpc" id="L144" title="1 of 2 branches missed."> if (!defined()) {</span>
<span class="fc" id="L145"> super.close();</span>
<span class="fc bfc" id="L146" title="All 2 branches covered."> if (!tmpParserLongs.isEmpty()) {</span>
<span class="fc" id="L147"> parserLongs = new MtasFunctionParserFunction[tmpParserLongs.size()];</span>
<span class="fc" id="L148"> parserLongs = tmpParserLongs.toArray(parserLongs);</span>
}
<span class="fc bfc" id="L150" title="All 2 branches covered."> if (!tmpParserDoubles.isEmpty()) {</span>
<span class="fc" id="L151"> parserDoubles = new MtasFunctionParserFunction[tmpParserDoubles.size()];</span>
<span class="fc" id="L152"> parserDoubles = tmpParserDoubles.toArray(parserDoubles);</span>
}
<span class="fc bfc" id="L154" title="All 2 branches covered."> if (!tmpConstantLongs.isEmpty()) {</span>
<span class="fc" id="L155"> constantLongs = new long[tmpConstantLongs.size()];</span>
<span class="fc bfc" id="L156" title="All 2 branches covered."> for (int i = 0; i < tmpConstantLongs.size(); i++) {</span>
<span class="fc" id="L157"> constantLongs[i] = tmpConstantLongs.get(i);</span>
}
}
<span class="fc bfc" id="L160" title="All 2 branches covered."> if (!tmpConstantDoubles.isEmpty()) {</span>
<span class="fc" id="L161"> constantDoubles = new Double[tmpConstantDoubles.size()];</span>
<span class="fc bfc" id="L162" title="All 2 branches covered."> for (int i = 0; i < tmpConstantDoubles.size(); i++) {</span>
<span class="fc" id="L163"> constantDoubles[i] = tmpConstantDoubles.get(i);</span>
}
}
<span class="pc bpc" id="L166" title="1 of 2 branches missed."> if (firstType == null) {</span>
<span class="nc" id="L167"> throw new ParseException("incorrect definition: no firstType");</span>
}
<span class="fc bfc" id="L169" title="All 2 branches covered."> if (!tmpOperatorList.isEmpty()) {</span>
<span class="fc" id="L170"> number = tmpOperatorList.size();</span>
<span class="pc bpc" id="L171" title="2 of 4 branches missed."> if ((tmpTypeList.size() != number) || (tmpIdList.size() != number)) {</span>
<span class="nc" id="L172"> throw new ParseException("incorrect definition additional items");</span>
} else {
<span class="fc" id="L174"> operatorList = new String[number];</span>
<span class="fc" id="L175"> operatorList = tmpOperatorList.toArray(operatorList);</span>
<span class="fc" id="L176"> typeList = new String[number];</span>
<span class="fc" id="L177"> typeList = tmpTypeList.toArray(typeList);</span>
<span class="fc" id="L178"> idList = new int[number];</span>
<span class="fc bfc" id="L179" title="All 2 branches covered."> for (int i = 0; i < number; i++) {</span>
<span class="fc" id="L180"> idList[i] = tmpIdList.get(i).intValue();</span>
}
}
} else {
<span class="fc" id="L184"> number = 0;</span>
<span class="fc" id="L185"> operatorList = null;</span>
<span class="fc" id="L186"> typeList = null;</span>
<span class="fc" id="L187"> idList = null;</span>
}
}
<span class="fc" id="L190"> }</span>
/**
* Adds the.
*
* @param item the item
* @throws ParseException the parse exception
*/
public void add(MtasFunctionParserItem item) throws ParseException {
<span class="fc" id="L199"> basic(BASIC_OPERATOR_ADD, item);</span>
<span class="fc" id="L200"> }</span>
/**
* Subtract.
*
* @param item the item
* @throws ParseException the parse exception
*/
public void subtract(MtasFunctionParserItem item) throws ParseException {
<span class="fc" id="L209"> basic(BASIC_OPERATOR_SUBTRACT, item);</span>
<span class="fc" id="L210"> }</span>
/**
* Multiply.
*
* @param item the item
* @throws ParseException the parse exception
*/
public void multiply(MtasFunctionParserItem item) throws ParseException {
<span class="fc" id="L219"> basic(BASIC_OPERATOR_MULTIPLY, item);</span>
<span class="fc" id="L220"> }</span>
/**
* Divide.
*
* @param item the item
* @throws ParseException the parse exception
*/
public void divide(MtasFunctionParserItem item) throws ParseException {
<span class="fc" id="L229"> basic(BASIC_OPERATOR_DIVIDE, item);</span>
<span class="fc" id="L230"> }</span>
/**
* Power.
*
* @param item the item
* @throws ParseException the parse exception
*/
public void power(MtasFunctionParserItem item) throws ParseException {
<span class="fc" id="L239"> basic(BASIC_OPERATOR_POWER, item);</span>
<span class="fc" id="L240"> }</span>
/**
* Basic.
*
* @param operator the operator
* @param item the item
* @throws ParseException the parse exception
*/
private void basic(String operator, MtasFunctionParserItem item)
throws ParseException {
<span class="pc bpc" id="L251" title="1 of 2 branches missed."> if (!defined()) {</span>
<span class="fc" id="L252"> String type = item.getType();</span>
MtasFunctionParserFunction parser;
<span class="fc" id="L254"> tmpOperatorList.add(operator);</span>
<span class="fc bfc" id="L255" title="All 2 branches covered."> if (operator.equals(BASIC_OPERATOR_DIVIDE)) {</span>
<span class="fc" id="L256"> dataType = CodecUtil.DATA_TYPE_DOUBLE;</span>
}
<span class="pc bpc" id="L258" title="8 of 26 branches missed."> switch (type) {</span>
case MtasFunctionParserItem.TYPE_N:
<span class="fc" id="L260"> tmpTypeList.add(type);</span>
<span class="fc" id="L261"> tmpIdList.add(0);</span>
<span class="fc" id="L262"> needPositions = true;</span>
<span class="pc bpc" id="L263" title="1 of 4 branches missed."> if (sumRule && degree != null) {</span>
<span class="fc bfc" id="L264" title="All 2 branches covered."> if (operator.equals(BASIC_OPERATOR_ADD)</span>
<span class="fc bfc" id="L265" title="All 2 branches covered."> || operator.equals(BASIC_OPERATOR_SUBTRACT)) {</span>
<span class="pc bpc" id="L266" title="1 of 2 branches missed."> if (degree < 0) {</span>
<span class="nc" id="L267"> sumRule = false;</span>
<span class="nc" id="L268"> degree = null;</span>
<span class="pc bpc" id="L269" title="1 of 2 branches missed."> } else if (degree > 0) {</span>
<span class="fc" id="L270"> sumRule = false;</span>
}
<span class="pc bpc" id="L272" title="3 of 4 branches missed."> } else if (operator.equals(BASIC_OPERATOR_POWER) && (degree != 0)) {</span>
<span class="nc" id="L273"> sumRule = false;</span>
<span class="nc" id="L274"> degree = null;</span>
}
}
break;
case MtasFunctionParserItem.TYPE_ARGUMENT:
<span class="fc" id="L279"> tmpTypeList.add(type);</span>
<span class="fc" id="L280"> tmpIdList.add(item.getId());</span>
<span class="fc" id="L281"> needArgument.add(item.getId());</span>
<span class="pc bpc" id="L282" title="1 of 4 branches missed."> if (sumRule && degree != null) {</span>
<span class="fc bfc" id="L283" title="All 2 branches covered."> if (operator.equals(BASIC_OPERATOR_ADD)</span>
<span class="fc bfc" id="L284" title="All 2 branches covered."> || operator.equals(BASIC_OPERATOR_SUBTRACT)) {</span>
<span class="fc bfc" id="L285" title="All 2 branches covered."> if (degree != 1) {</span>
<span class="fc" id="L286"> sumRule = false;</span>
}
<span class="pc bpc" id="L288" title="1 of 2 branches missed."> if (degree >= 0) {</span>
<span class="fc" id="L289"> degree = Math.max(degree, 1);</span>
} else {
<span class="nc" id="L291"> degree = null;</span>
}
<span class="fc bfc" id="L293" title="All 2 branches covered."> } else if (operator.equals(BASIC_OPERATOR_MULTIPLY)) {</span>
<span class="fc bfc" id="L294" title="All 2 branches covered."> if (degree != 0) {</span>
<span class="fc" id="L295"> sumRule = false;</span>
}
<span class="fc" id="L297"> degree += 1;</span>
<span class="fc bfc" id="L298" title="All 2 branches covered."> } else if (operator.equals(BASIC_OPERATOR_DIVIDE)) {</span>
<span class="fc" id="L299"> sumRule = false;</span>
<span class="fc" id="L300"> degree -= 1;</span>
<span class="pc bpc" id="L301" title="1 of 2 branches missed."> } else if (operator.equals(BASIC_OPERATOR_POWER)) {</span>
<span class="fc" id="L302"> sumRule = false;</span>
<span class="fc" id="L303"> degree = null;</span>
}
}
break;
case MtasFunctionParserItem.TYPE_CONSTANT_LONG:
<span class="fc" id="L308"> tmpTypeList.add(type);</span>
<span class="fc" id="L309"> tmpIdList.add(tmpConstantLongs.size());</span>
<span class="fc" id="L310"> tmpConstantLongs.add(item.getValueLong());</span>
<span class="pc bpc" id="L311" title="1 of 4 branches missed."> if (sumRule && degree != null) {</span>
<span class="pc bpc" id="L312" title="1 of 2 branches missed."> if (operator.equals(BASIC_OPERATOR_ADD)</span>
<span class="nc bnc" id="L313" title="All 2 branches missed."> || operator.equals(BASIC_OPERATOR_SUBTRACT)) {</span>
<span class="pc bpc" id="L314" title="1 of 2 branches missed."> if (degree < 0) {</span>
<span class="nc" id="L315"> sumRule = false;</span>
<span class="nc" id="L316"> degree = null;</span>
<span class="fc bfc" id="L317" title="All 2 branches covered."> } else if (degree > 0) {</span>
<span class="fc" id="L318"> sumRule = false;</span>
}
<span class="nc bnc" id="L320" title="All 4 branches missed."> } else if (operator.equals(BASIC_OPERATOR_POWER) && (degree != 0)) {</span>
<span class="nc" id="L321"> sumRule = false;</span>
<span class="nc" id="L322"> degree = null;</span>
}
}
break;
case MtasFunctionParserItem.TYPE_CONSTANT_DOUBLE:
<span class="fc" id="L327"> tmpTypeList.add(type);</span>
<span class="fc" id="L328"> tmpIdList.add(tmpConstantDoubles.size());</span>
<span class="fc" id="L329"> dataType = CodecUtil.DATA_TYPE_DOUBLE;</span>
<span class="fc" id="L330"> tmpConstantDoubles.add(item.getValueDouble());</span>
<span class="pc bpc" id="L331" title="2 of 4 branches missed."> if (sumRule && degree != null) {</span>
<span class="pc bpc" id="L332" title="1 of 2 branches missed."> if (operator.equals(BASIC_OPERATOR_ADD)</span>
<span class="nc bnc" id="L333" title="All 2 branches missed."> || operator.equals(BASIC_OPERATOR_SUBTRACT)) {</span>
<span class="pc bpc" id="L334" title="1 of 2 branches missed."> if (degree < 0) {</span>
<span class="nc" id="L335"> sumRule = false;</span>
<span class="nc" id="L336"> degree = null;</span>
<span class="pc bpc" id="L337" title="1 of 2 branches missed."> } else if (degree > 0) {</span>
<span class="nc" id="L338"> sumRule = false;</span>
}
<span class="nc bnc" id="L340" title="All 4 branches missed."> } else if (operator.equals(BASIC_OPERATOR_POWER) && (degree != 0)) {</span>
<span class="nc" id="L341"> sumRule = false;</span>
<span class="nc" id="L342"> degree = null;</span>
}
}
break;
case MtasFunctionParserItem.TYPE_PARSER_LONG:
<span class="fc" id="L347"> tmpTypeList.add(type);</span>
<span class="fc" id="L348"> tmpIdList.add(tmpParserLongs.size());</span>
<span class="fc" id="L349"> parser = item.getParser();</span>
<span class="fc" id="L350"> parser.close();</span>
<span class="fc" id="L351"> tmpParserLongs.add(parser);</span>
<span class="pc bpc" id="L352" title="1 of 2 branches missed."> sumRule = sumRule ? parser.sumRule() : false;</span>
<span class="fc bfc" id="L353" title="All 2 branches covered."> needPositions = needPositions ? needPositions : parser.needPositions();</span>
<span class="fc" id="L354"> needArgument.addAll(parser.needArgument);</span>
<span class="pc bpc" id="L355" title="1 of 4 branches missed."> if (sumRule && degree != null) {</span>
<span class="pc bpc" id="L356" title="1 of 2 branches missed."> if (operator.equals(BASIC_OPERATOR_ADD)</span>
<span class="pc bpc" id="L357" title="1 of 2 branches missed."> || operator.equals(BASIC_OPERATOR_SUBTRACT)) {</span>
<span class="nc bnc" id="L358" title="All 2 branches missed."> if (!parser.degree.equals(degree)) {</span>
<span class="nc" id="L359"> sumRule = false;</span>
<span class="nc bnc" id="L360" title="All 2 branches missed."> if (degree < 0) {</span>
<span class="nc" id="L361"> degree = null;</span>
} else {
<span class="nc" id="L363"> degree = Math.max(degree, parser.degree);</span>
}
}
<span class="fc bfc" id="L366" title="All 2 branches covered."> } else if (operator.equals(BASIC_OPERATOR_MULTIPLY)) {</span>
<span class="pc bpc" id="L367" title="2 of 4 branches missed."> if (degree != 0 || parser.degree != 0) {</span>
<span class="fc" id="L368"> sumRule = false;</span>
}
<span class="fc" id="L370"> degree += parser.degree;</span>
<span class="pc bpc" id="L371" title="3 of 4 branches missed."> } else if (operator.equals(BASIC_OPERATOR_POWER) && (degree != 0)) {</span>
<span class="nc" id="L372"> sumRule = false;</span>
<span class="nc" id="L373"> degree = null;</span>
}
}
break;
case MtasFunctionParserItem.TYPE_PARSER_DOUBLE:
<span class="fc" id="L378"> tmpTypeList.add(type);</span>
<span class="fc" id="L379"> tmpIdList.add(tmpParserDoubles.size());</span>
<span class="fc" id="L380"> dataType = CodecUtil.DATA_TYPE_DOUBLE;</span>
<span class="fc" id="L381"> parser = item.getParser();</span>
<span class="fc" id="L382"> parser.close();</span>
<span class="fc" id="L383"> tmpParserDoubles.add(parser);</span>
<span class="pc bpc" id="L384" title="1 of 2 branches missed."> sumRule = sumRule ? parser.sumRule() : false;</span>
<span class="pc bpc" id="L385" title="1 of 2 branches missed."> needPositions = needPositions ? needPositions : parser.needPositions();</span>
<span class="fc" id="L386"> needArgument.addAll(parser.needArgument);</span>
<span class="pc bpc" id="L387" title="2 of 4 branches missed."> if (sumRule && degree != null) {</span>
<span class="pc bpc" id="L388" title="1 of 2 branches missed."> if (operator.equals(BASIC_OPERATOR_ADD)</span>
<span class="nc bnc" id="L389" title="All 2 branches missed."> || operator.equals(BASIC_OPERATOR_SUBTRACT)) {</span>
<span class="pc bpc" id="L390" title="1 of 2 branches missed."> if (!parser.degree.equals(degree)) {</span>
<span class="fc" id="L391"> sumRule = false;</span>
<span class="pc bpc" id="L392" title="1 of 2 branches missed."> if (degree < 0) {</span>
<span class="nc" id="L393"> degree = null;</span>
} else {
<span class="fc" id="L395"> degree = Math.max(degree, parser.degree);</span>
}
}
<span class="nc bnc" id="L398" title="All 2 branches missed."> } else if (operator.equals(BASIC_OPERATOR_MULTIPLY)) {</span>
<span class="nc bnc" id="L399" title="All 4 branches missed."> if (degree != 0 || parser.degree != 0) {</span>
<span class="nc" id="L400"> sumRule = false;</span>
}
<span class="nc" id="L402"> degree += parser.degree;</span>
<span class="nc bnc" id="L403" title="All 4 branches missed."> } else if (operator.equals(BASIC_OPERATOR_POWER) && (degree != 0)) {</span>
<span class="nc" id="L404"> sumRule = false;</span>
<span class="nc" id="L405"> degree = null;</span>
}
}
break;
default:
<span class="nc" id="L410"> throw new ParseException("incorrect type");</span>
}
<span class="fc" id="L412"> } else {</span>
<span class="nc" id="L413"> throw new ParseException("already defined");</span>
}
<span class="fc" id="L415"> }</span>
/*
* (non-Javadoc)
*
* @see
* mtas.parser.function.util.MtasFunctionParserFunction#getValueDouble(long[],
* long)
*/
@Override
public double getValueDouble(long[] args, long n) throws IOException {
double sum;
<span class="pc bpc" id="L427" title="17 of 26 branches missed."> switch (firstType) {</span>
case MtasFunctionParserItem.TYPE_ARGUMENT:
<span class="nc" id="L429"> sum = args[firstId];</span>
<span class="nc" id="L430"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_DOUBLE:
<span class="nc" id="L432"> sum = parserDoubles[firstId].getValueDouble(args, n);</span>
<span class="nc" id="L433"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_LONG:
<span class="fc" id="L435"> sum = parserLongs[firstId].getValueLong(args, n);</span>
<span class="fc" id="L436"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_DOUBLE:
<span class="nc" id="L438"> sum = constantDoubles[firstId];</span>
<span class="nc" id="L439"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_LONG:
<span class="fc" id="L441"> sum = constantLongs[firstId];</span>
<span class="fc" id="L442"> break;</span>
case MtasFunctionParserItem.TYPE_N:
<span class="fc" id="L444"> sum = n;</span>
<span class="fc" id="L445"> break;</span>
default:
<span class="nc" id="L447"> throw new IOException("no first value");</span>
}
<span class="fc bfc" id="L449" title="All 2 branches covered."> for (int i = 0; i < number; i++) {</span>
<span class="pc bpc" id="L450" title="10 of 22 branches missed."> switch (operatorList[i]) {</span>
case BASIC_OPERATOR_ADD:
<span class="pc bpc" id="L452" title="11 of 26 branches missed."> switch (typeList[i]) {</span>
case MtasFunctionParserItem.TYPE_ARGUMENT:
<span class="fc" id="L454"> sum += args[idList[i]];</span>
<span class="fc" id="L455"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_DOUBLE:
<span class="fc" id="L457"> sum += parserDoubles[idList[i]].getValueDouble(args, n);</span>
<span class="fc" id="L458"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_LONG:
<span class="nc" id="L460"> sum += parserLongs[idList[i]].getValueLong(args, n);</span>
<span class="nc" id="L461"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_DOUBLE:
<span class="fc" id="L463"> sum += constantDoubles[idList[i]];</span>
<span class="fc" id="L464"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_LONG:
<span class="fc" id="L466"> sum += constantLongs[idList[i]];</span>
<span class="fc" id="L467"> break;</span>
case MtasFunctionParserItem.TYPE_N:
<span class="fc" id="L469"> sum += n;</span>
<span class="fc" id="L470"> break;</span>
default:
<span class="nc" id="L472"> throw new IOException("unknown type");</span>
}
<span class="fc" id="L474"> break;</span>
case BASIC_OPERATOR_SUBTRACT:
<span class="pc bpc" id="L476" title="20 of 26 branches missed."> switch (typeList[i]) {</span>
case MtasFunctionParserItem.TYPE_ARGUMENT:
<span class="fc" id="L478"> sum -= args[idList[i]];</span>
<span class="fc" id="L479"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_DOUBLE:
<span class="nc" id="L481"> sum -= parserDoubles[idList[i]].getValueDouble(args, n);</span>
<span class="nc" id="L482"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_LONG:
<span class="nc" id="L484"> sum -= parserLongs[idList[i]].getValueLong(args, n);</span>
<span class="nc" id="L485"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_DOUBLE:
<span class="nc" id="L487"> sum -= constantDoubles[idList[i]];</span>
<span class="nc" id="L488"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_LONG:
<span class="nc" id="L490"> sum -= constantLongs[idList[i]];</span>
<span class="nc" id="L491"> break;</span>
case MtasFunctionParserItem.TYPE_N:
<span class="fc" id="L493"> sum -= n;</span>
<span class="fc" id="L494"> break;</span>
default:
<span class="nc" id="L496"> throw new IOException("unknown type");</span>
}
<span class="fc" id="L498"> break;</span>
case BASIC_OPERATOR_MULTIPLY:
<span class="pc bpc" id="L500" title="17 of 26 branches missed."> switch (typeList[i]) {</span>
case MtasFunctionParserItem.TYPE_ARGUMENT:
<span class="fc" id="L502"> sum *= args[idList[i]];</span>
<span class="fc" id="L503"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_DOUBLE:
<span class="nc" id="L505"> sum *= parserDoubles[idList[i]].getValueDouble(args, n);</span>
<span class="nc" id="L506"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_LONG:
<span class="fc" id="L508"> sum *= parserLongs[idList[i]].getValueLong(args, n);</span>
<span class="fc" id="L509"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_DOUBLE:
<span class="nc" id="L511"> sum *= constantDoubles[idList[i]];</span>
<span class="nc" id="L512"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_LONG:
<span class="nc" id="L514"> sum *= constantLongs[idList[i]];</span>
<span class="nc" id="L515"> break;</span>
case MtasFunctionParserItem.TYPE_N:
<span class="fc" id="L517"> sum *= n;</span>
<span class="fc" id="L518"> break;</span>
default:
<span class="nc" id="L520"> throw new IOException("unknown type");</span>
}
<span class="fc" id="L522"> break;</span>
case BASIC_OPERATOR_DIVIDE:
double v;
<span class="pc bpc" id="L525" title="17 of 26 branches missed."> switch (typeList[i]) {</span>
case MtasFunctionParserItem.TYPE_ARGUMENT:
<span class="fc" id="L527"> v = args[idList[i]];</span>
<span class="fc" id="L528"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_DOUBLE:
<span class="nc" id="L530"> v = parserDoubles[idList[i]].getValueDouble(args, n);</span>
<span class="nc" id="L531"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_LONG:
<span class="fc" id="L533"> v = parserLongs[idList[i]].getValueLong(args, n);</span>
<span class="fc" id="L534"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_DOUBLE:
<span class="nc" id="L536"> v = constantDoubles[idList[i]];</span>
<span class="nc" id="L537"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_LONG:
<span class="nc" id="L539"> v = constantLongs[idList[i]];</span>
<span class="nc" id="L540"> break;</span>
case MtasFunctionParserItem.TYPE_N:
<span class="fc" id="L542"> v = n;</span>
<span class="fc" id="L543"> break;</span>
default:
<span class="nc" id="L545"> throw new IOException("unknown type");</span>
}
<span class="fc bfc" id="L547" title="All 2 branches covered."> if (v != 0) {</span>
<span class="fc" id="L548"> sum /= v;</span>
} else {
<span class="fc" id="L550"> throw new IOException("division by zero");</span>
}
break;
case BASIC_OPERATOR_POWER:
<span class="nc bnc" id="L554" title="All 26 branches missed."> switch (typeList[i]) {</span>
case MtasFunctionParserItem.TYPE_ARGUMENT:
<span class="nc" id="L556"> sum = Math.pow(sum, args[idList[i]]);</span>
<span class="nc" id="L557"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_DOUBLE:
<span class="nc" id="L559"> sum = Math.pow(sum, parserDoubles[idList[i]].getValueDouble(args, n));</span>
<span class="nc" id="L560"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_LONG:
<span class="nc" id="L562"> sum = Math.pow(sum, parserLongs[idList[i]].getValueLong(args, n));</span>
<span class="nc" id="L563"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_DOUBLE:
<span class="nc" id="L565"> sum = Math.pow(sum, constantDoubles[idList[i]]);</span>
<span class="nc" id="L566"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_LONG:
<span class="nc" id="L568"> sum = Math.pow(sum, constantLongs[idList[i]]);</span>
<span class="nc" id="L569"> break;</span>
case MtasFunctionParserItem.TYPE_N:
<span class="nc" id="L571"> sum = Math.pow(sum, n);</span>
<span class="nc" id="L572"> break;</span>
default:
<span class="nc" id="L574"> throw new IOException("unknown type");</span>
}
<span class="nc" id="L576"> break;</span>
default:
<span class="nc" id="L578"> throw new IOException("unknown operator");</span>
}
}
<span class="fc" id="L581"> return sum;</span>
}
/*
* (non-Javadoc)
*
* @see
* mtas.parser.function.util.MtasFunctionParserFunction#getValueLong(long[],
* long)
*/
@Override
public long getValueLong(long[] args, long n) throws IOException {
try {
long sum;
<span class="pc bpc" id="L595" title="17 of 26 branches missed."> switch (firstType) {</span>
case MtasFunctionParserItem.TYPE_ARGUMENT:
<span class="fc" id="L597"> sum = args[firstId];</span>
<span class="fc" id="L598"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_DOUBLE:
<span class="nc" id="L600"> sum = (long) parserDoubles[firstId].getValueDouble(args, n);</span>
<span class="nc" id="L601"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_LONG:
<span class="nc" id="L603"> sum = parserLongs[firstId].getValueLong(args, n);</span>
<span class="nc" id="L604"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_DOUBLE:
<span class="nc" id="L606"> sum = constantDoubles[firstId].longValue();</span>
<span class="nc" id="L607"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_LONG:
<span class="fc" id="L609"> sum = constantLongs[firstId];</span>
<span class="fc" id="L610"> break;</span>
case MtasFunctionParserItem.TYPE_N:
<span class="fc" id="L612"> sum = n;</span>
<span class="fc" id="L613"> break;</span>
default:
<span class="nc" id="L615"> throw new IOException("no first value");</span>
}
<span class="fc bfc" id="L617" title="All 2 branches covered."> for (int i = 0; i < number; i++) {</span>
<span class="pc bpc" id="L618" title="10 of 22 branches missed."> switch (operatorList[i]) {</span>
case BASIC_OPERATOR_ADD:
<span class="pc bpc" id="L620" title="20 of 26 branches missed."> switch (typeList[i]) {</span>
case MtasFunctionParserItem.TYPE_ARGUMENT:
<span class="fc" id="L622"> sum += args[idList[i]];</span>
<span class="fc" id="L623"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_DOUBLE:
<span class="nc" id="L625"> sum += (long) parserDoubles[idList[i]].getValueDouble(args, n);</span>
<span class="nc" id="L626"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_LONG:
<span class="nc" id="L628"> sum += parserLongs[idList[i]].getValueLong(args, n);</span>
<span class="nc" id="L629"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_DOUBLE:
<span class="nc" id="L631"> sum += constantDoubles[idList[i]].longValue();</span>
<span class="nc" id="L632"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_LONG:
<span class="nc" id="L634"> sum += constantLongs[idList[i]];</span>
<span class="nc" id="L635"> break;</span>
case MtasFunctionParserItem.TYPE_N:
<span class="fc" id="L637"> sum += n;</span>
<span class="fc" id="L638"> break;</span>
default:
<span class="nc" id="L640"> throw new IOException("unknown type");</span>
}
<span class="fc" id="L642"> break;</span>
case BASIC_OPERATOR_SUBTRACT:
<span class="pc bpc" id="L644" title="20 of 26 branches missed."> switch (typeList[i]) {</span>
case MtasFunctionParserItem.TYPE_ARGUMENT:
<span class="fc" id="L646"> sum -= args[idList[i]];</span>
<span class="fc" id="L647"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_DOUBLE:
<span class="nc" id="L649"> sum -= (long) parserDoubles[idList[i]].getValueDouble(args, n);</span>
<span class="nc" id="L650"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_LONG:
<span class="nc" id="L652"> sum -= parserLongs[idList[i]].getValueLong(args, n);</span>
<span class="nc" id="L653"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_DOUBLE:
<span class="nc" id="L655"> sum -= constantDoubles[idList[i]].longValue();</span>
<span class="nc" id="L656"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_LONG:
<span class="nc" id="L658"> sum -= constantLongs[idList[i]];</span>
<span class="nc" id="L659"> break;</span>
case MtasFunctionParserItem.TYPE_N:
<span class="fc" id="L661"> sum -= n;</span>
<span class="fc" id="L662"> break;</span>
default:
<span class="nc" id="L664"> throw new IOException("unknown type");</span>
}
<span class="fc" id="L666"> break;</span>
case BASIC_OPERATOR_MULTIPLY:
<span class="pc bpc" id="L668" title="20 of 26 branches missed."> switch (typeList[i]) {</span>
case MtasFunctionParserItem.TYPE_ARGUMENT:
<span class="fc" id="L670"> sum *= args[idList[i]];</span>
<span class="fc" id="L671"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_DOUBLE:
<span class="nc" id="L673"> sum *= (long) parserDoubles[idList[i]].getValueDouble(args, n);</span>
<span class="nc" id="L674"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_LONG:
<span class="nc" id="L676"> sum *= parserLongs[idList[i]].getValueLong(args, n);</span>
<span class="nc" id="L677"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_DOUBLE:
<span class="nc" id="L679"> sum *= constantDoubles[idList[i]].longValue();</span>
<span class="nc" id="L680"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_LONG:
<span class="nc" id="L682"> sum *= constantLongs[idList[i]];</span>
<span class="nc" id="L683"> break;</span>
case MtasFunctionParserItem.TYPE_N:
<span class="fc" id="L685"> sum *= n;</span>
<span class="fc" id="L686"> break;</span>
default:
<span class="nc" id="L688"> throw new IOException("unknown type");</span>
}
<span class="fc" id="L690"> break;</span>
case BASIC_OPERATOR_DIVIDE:
long v;
<span class="nc bnc" id="L693" title="All 26 branches missed."> switch (typeList[i]) {</span>
case MtasFunctionParserItem.TYPE_ARGUMENT:
<span class="nc" id="L695"> v = args[idList[i]];</span>
<span class="nc" id="L696"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_DOUBLE:
<span class="nc" id="L698"> v = (long) parserDoubles[idList[i]].getValueDouble(args, n);</span>
<span class="nc" id="L699"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_LONG:
<span class="nc" id="L701"> v = parserLongs[idList[i]].getValueLong(args, n);</span>
<span class="nc" id="L702"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_DOUBLE:
<span class="nc" id="L704"> v = constantDoubles[idList[i]].longValue();</span>
<span class="nc" id="L705"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_LONG:
<span class="nc" id="L707"> v = constantLongs[idList[i]];</span>
<span class="nc" id="L708"> break;</span>
case MtasFunctionParserItem.TYPE_N:
<span class="nc" id="L710"> v = n;</span>
<span class="nc" id="L711"> break;</span>
default:
<span class="nc" id="L713"> throw new IOException("unknown type");</span>
}
<span class="nc bnc" id="L715" title="All 2 branches missed."> if (v != 0) {</span>
<span class="nc" id="L716"> sum /= v;</span>
} else {
<span class="nc" id="L718"> throw new IOException("division by zero");</span>
}
break;
case BASIC_OPERATOR_POWER:
<span class="pc bpc" id="L722" title="23 of 26 branches missed."> switch (typeList[i]) {</span>
case MtasFunctionParserItem.TYPE_ARGUMENT:
<span class="fc" id="L724"> sum = sum ^ args[idList[i]];</span>
<span class="fc" id="L725"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_DOUBLE:
<span class="nc" id="L727"> sum = sum ^ (long) parserDoubles[idList[i]].getValueDouble(args, n);</span>
<span class="nc" id="L728"> break;</span>
case MtasFunctionParserItem.TYPE_PARSER_LONG:
<span class="nc" id="L730"> sum = sum ^ parserLongs[idList[i]].getValueLong(args, n);</span>
<span class="nc" id="L731"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_DOUBLE:
<span class="nc" id="L733"> sum = sum ^ constantDoubles[idList[i]].longValue();</span>
<span class="nc" id="L734"> break;</span>
case MtasFunctionParserItem.TYPE_CONSTANT_LONG:
<span class="nc" id="L736"> sum = sum ^ constantLongs[idList[i]];</span>
<span class="nc" id="L737"> break;</span>
case MtasFunctionParserItem.TYPE_N:
<span class="nc" id="L739"> sum = sum ^ n;</span>
<span class="nc" id="L740"> break;</span>
default:
<span class="nc" id="L742"> throw new IOException("unknown type");</span>
}
<span class="fc" id="L744"> break;</span>
default:
<span class="nc" id="L746"> throw new IOException("unknown operator");</span>
}
}
<span class="fc" id="L749"> return sum;</span>
<span class="nc" id="L750"> } catch (java.lang.ArithmeticException e) {</span>
<span class="nc" id="L751"> throw new IOException(e);</span>
}
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
<span class="pc bpc" id="L762" title="1 of 2 branches missed."> if (firstType != null) {</span>
<span class="fc" id="L763"> StringBuilder text = new StringBuilder(toString(firstType, firstId));</span>
<span class="fc bfc" id="L764" title="All 2 branches covered."> for (int i = 0; i < tmpOperatorList.size(); i++) {</span>
<span class="fc" id="L765"> String operator = tmpOperatorList.get(i);</span>
<span class="fc bfc" id="L766" title="All 2 branches covered."> if (operator.equals(BASIC_OPERATOR_ADD)) {</span>
<span class="fc" id="L767"> text.append(" + ");</span>
<span class="fc bfc" id="L768" title="All 2 branches covered."> } else if (operator.equals(BASIC_OPERATOR_SUBTRACT)) {</span>
<span class="fc" id="L769"> text.append(" - ");</span>
<span class="fc bfc" id="L770" title="All 2 branches covered."> } else if (operator.equals(BASIC_OPERATOR_MULTIPLY)) {</span>
<span class="fc" id="L771"> text.append(" * ");</span>
<span class="fc bfc" id="L772" title="All 2 branches covered."> } else if (operator.equals(BASIC_OPERATOR_DIVIDE)) {</span>
<span class="fc" id="L773"> text.append(" / ");</span>
<span class="pc bpc" id="L774" title="1 of 2 branches missed."> } else if (operator.equals(BASIC_OPERATOR_POWER)) {</span>
<span class="fc" id="L775"> text.append(" ^ ");</span>
} else {
<span class="nc" id="L777"> text.append(" ? ");</span>
}
<span class="fc" id="L779"> text.append(toString(tmpTypeList.get(i), tmpIdList.get(i)));</span>
}
<span class="fc" id="L781"> return text.toString();</span>
} else {
<span class="nc" id="L783"> return "?";</span>
}
}
/**
* To string.
*
* @param type the type
* @param id the id
* @return the string
*/
private String toString(String type, int id) {
<span class="fc bfc" id="L795" title="All 2 branches covered."> if (type.equals(MtasFunctionParserItem.TYPE_CONSTANT_LONG)) {</span>
<span class="fc" id="L796"> return tmpConstantLongs.get(id).toString();</span>
<span class="fc bfc" id="L797" title="All 2 branches covered."> } else if (type.equals(MtasFunctionParserItem.TYPE_CONSTANT_DOUBLE)) {</span>
<span class="fc" id="L798"> return tmpConstantDoubles.get(id).toString();</span>
<span class="fc bfc" id="L799" title="All 2 branches covered."> } else if (type.equals(MtasFunctionParserItem.TYPE_PARSER_LONG)) {</span>
<span class="fc" id="L800"> return "(" + tmpParserLongs.get(id).toString() + ")";</span>
<span class="fc bfc" id="L801" title="All 2 branches covered."> } else if (type.equals(MtasFunctionParserItem.TYPE_PARSER_DOUBLE)) {</span>
<span class="fc" id="L802"> return "(" + tmpParserDoubles.get(id).toString() + ")";</span>
<span class="fc bfc" id="L803" title="All 2 branches covered."> } else if (type.equals(MtasFunctionParserItem.TYPE_ARGUMENT)) {</span>
<span class="fc" id="L804"> return "$q" + id;</span>
<span class="pc bpc" id="L805" title="1 of 2 branches missed."> } else if (type.equals(MtasFunctionParserItem.TYPE_N)) {</span>
<span class="fc" id="L806"> return "$n";</span>
} else {
<span class="nc" id="L808"> return "..";</span>
}
}
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.7.9.201702052155</span></div></body></html>