1717
1818import java .time .Duration ;
1919import java .time .Instant ;
20+ import java .util .ArrayList ;
2021import java .util .LinkedList ;
2122import java .util .List ;
2223import java .util .Optional ;
23- import java .util .SortedMap ;
24- import java .util .TreeMap ;
2524import java .util .concurrent .ConcurrentSkipListMap ;
2625import java .util .concurrent .atomic .AtomicBoolean ;
27- import java .util .concurrent .atomic .AtomicReference ;
2826
2927public class WaterfallPlotController {
3028
@@ -310,7 +308,7 @@ public synchronized void redraw(WaterfallPlotRuntime.PVData pvData) {
310308 previousT2 [0 ] = Optional .of (t2 );
311309
312310 LinkedList <Double > timeValuesLinkedList = new LinkedList <>();
313- LinkedList <LinkedList <Double >> zValuesLinkedList = new LinkedList <>();
311+ LinkedList <ArrayList <Double >> zValuesLinkedList = new LinkedList <>();
314312 int waveformLength = 1 ;
315313
316314 double minFromPV = Double .NaN ;
@@ -321,7 +319,7 @@ public synchronized void redraw(WaterfallPlotRuntime.PVData pvData) {
321319 minFromPV = waveformPVData .minFromPV ().get ();
322320 maxFromPV = waveformPVData .maxFromPV ().get ();
323321
324- ConcurrentSkipListMap <Instant , LinkedList <Double >> instantToWaveform = waveformPVData .instantToValue ();
322+ ConcurrentSkipListMap <Instant , ArrayList <Double >> instantToWaveform = waveformPVData .instantToValue ();
325323 Instant startKey = instantToWaveform .ceilingKey (Instant .MIN );
326324 for (Instant t = t1 .plus (stepsize ); t .compareTo (t2 ) <= 0 ; t = t .plus (stepsize )) {
327325 timeValuesLinkedList .add (((double ) t .toEpochMilli ()) / 1000.0 );
@@ -332,7 +330,7 @@ public synchronized void redraw(WaterfallPlotRuntime.PVData pvData) {
332330 else {
333331 var instant = instantToWaveform .floorKey (t );
334332
335- LinkedList <Double > waveform = instantToWaveform .get (instant );
333+ ArrayList <Double > waveform = instantToWaveform .get (instant );
336334 waveformLength = Math .max (waveformLength , waveform .size ());
337335 zValuesLinkedList .add (waveform );
338336 }
@@ -348,7 +346,7 @@ public synchronized void redraw(WaterfallPlotRuntime.PVData pvData) {
348346
349347 for (Instant t = t1 .plus (stepsize ); t .compareTo (t2 ) <= 0 ; t = t .plus (stepsize )) {
350348 timeValuesLinkedList .add (((double ) t .toEpochMilli ()) / 1000.0 );
351- LinkedList <Double > zValues = new LinkedList <>();
349+ ArrayList <Double > zValues = new ArrayList <>();
352350
353351 for (var pvNameAndInstantToValue : pvNameToInstantToValue ) {
354352 String pvName = pvNameAndInstantToValue .getKey ();
@@ -367,7 +365,7 @@ public synchronized void redraw(WaterfallPlotRuntime.PVData pvData) {
367365
368366 // Append the last value one more time in order to
369367 // fix the plotting when there is only 1 scalar PV:
370- var lastValue = zValues .getLast ( );
368+ var lastValue = zValues .get ( zValues . size ()- 1 );
371369 zValues .add (lastValue );
372370
373371 zValuesLinkedList .add (zValues );
@@ -396,7 +394,7 @@ public synchronized void redraw(WaterfallPlotRuntime.PVData pvData) {
396394 }
397395
398396 for (int n = 0 ; n < zValuesLinkedList .size (); n ++) {
399- LinkedList <Double > waveformValues = zValuesLinkedList .get (n );
397+ ArrayList <Double > waveformValues = zValuesLinkedList .get (n );
400398
401399 for (int m = 0 ; m < waveformLength ; m ++) {
402400 double value ;
@@ -435,7 +433,7 @@ public synchronized void redraw(WaterfallPlotRuntime.PVData pvData) {
435433 }
436434
437435 for (int n = 0 ; n < zValuesLinkedList .size (); n ++) {
438- LinkedList <Double > waveformValues = zValuesLinkedList .get (n );
436+ ArrayList <Double > waveformValues = zValuesLinkedList .get (n );
439437
440438 for (int m = 0 ; m < waveformLength ; m ++) {
441439 double value ;
0 commit comments