segstore: add default unhandled methods to ISegmentStore
[deliverable/tracecompass.git] / statesystem / org.eclipse.tracecompass.segmentstore.core / src / org / eclipse / tracecompass / internal / segmentstore / core / arraylist / ArrayListStore.java
index 6af292cc97c5363b13aa641e0a830b8df332b704..ee130338b07f3b459dc831964eb0e5ce444ccb2d 100644 (file)
@@ -126,7 +126,12 @@ public class ArrayListStore<@NonNull E extends ISegment> implements ISegmentStor
 
     @Override
     public int size() {
-        return fStore.size();
+        fLock.readLock().lock();
+        try {
+            return fStore.size();
+        } finally {
+            fLock.readLock().unlock();
+        }
     }
 
     @Override
@@ -179,11 +184,6 @@ public class ArrayListStore<@NonNull E extends ISegment> implements ISegmentStor
         }
     }
 
-    @Override
-    public boolean remove(@Nullable Object o) {
-        throw new UnsupportedOperationException();
-    }
-
     @Override
     public boolean addAll(@Nullable Collection<? extends E> c) {
         if (c == null) {
@@ -204,16 +204,6 @@ public class ArrayListStore<@NonNull E extends ISegment> implements ISegmentStor
         }
     }
 
-    @Override
-    public boolean removeAll(@Nullable Collection<?> c) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public boolean retainAll(@Nullable Collection<?> c) {
-        throw new UnsupportedOperationException();
-    }
-
     @Override
     public void clear() {
         fLock.writeLock().lock();
@@ -228,26 +218,6 @@ public class ArrayListStore<@NonNull E extends ISegment> implements ISegmentStor
     // Methods added by ISegmentStore
     // ------------------------------------------------------------------------
 
-    @Override
-    public Iterable<E> getIntersectingElements(long position) {
-        /*
-         * The intervals intersecting 't' are those whose 1) start time is
-         * *lower* than 't' AND 2) end time is *higher* than 't'.
-         */
-        fLock.readLock().lock();
-        try {
-            /*
-             * as fStore is sorted by start then end times, restrict sub array
-             * to elements whose start times <= t as stream.filter won't do it.
-             */
-            int index = Collections.binarySearch(fStore, new BasicSegment(position, Long.MAX_VALUE));
-            index = (index >= 0) ? index : -index - 1;
-            return fStore.subList(0, index).stream().filter(element -> position >= element.getStart() && position <= element.getEnd()).collect(Collectors.toList());
-        } finally {
-            fLock.readLock().unlock();
-        }
-    }
-
     @Override
     public Iterable<E> getIntersectingElements(long start, long end) {
         fLock.readLock().lock();
This page took 0.02674 seconds and 5 git commands to generate.