Commit | Line | Data |
---|---|---|
26a6a7eb | 1 | /******************************************************************************* |
e5083481 | 2 | * Copyright (c) 2015 EfficiOS Inc., Alexandre Montplaisir and others. |
26a6a7eb AM |
3 | * |
4 | * All rights reserved. This program and the accompanying materials | |
5 | * are made available under the terms of the Eclipse Public License v1.0 | |
6 | * which accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Alexandre Montplaisir - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.tracecompass.segmentstore.core.treemap; | |
14 | ||
1a9cb076 | 15 | import java.util.Collection; |
26a6a7eb | 16 | import java.util.Iterator; |
26a6a7eb AM |
17 | import java.util.TreeMap; |
18 | ||
c66ca500 | 19 | import org.eclipse.jdt.annotation.NonNull; |
4dafe201 | 20 | import org.eclipse.jdt.annotation.Nullable; |
26a6a7eb AM |
21 | import org.eclipse.tracecompass.segmentstore.core.ISegment; |
22 | import org.eclipse.tracecompass.segmentstore.core.ISegmentStore; | |
664a3a81 | 23 | import org.eclipse.tracecompass.segmentstore.core.SegmentStoreFactory; |
26a6a7eb | 24 | |
26a6a7eb AM |
25 | /** |
26 | * Implementation of a {@link ISegmentStore} using in-memory {@link TreeMap}'s. | |
27 | * This relatively simple implementation holds everything in memory, and as such | |
28 | * cannot contain too much data. | |
29 | * | |
e5083481 PT |
30 | * The TreeMapStore itself is Iterable, and its iteration order will be by |
31 | * ascending order of start times. For segments with identical start times, the | |
32 | * secondary comparator will be the end time. If even those are equal, it will | |
33 | * defer to the segments' natural ordering ({@link ISegment#compareTo}). | |
34 | * | |
35 | * The store's tree maps will not accept duplicate key-value pairs, which means | |
36 | * that if you want several segments with the same start and end times, make | |
37 | * sure their compareTo() differentiates them. | |
38 | * | |
1a9cb076 AM |
39 | * Removal operations are not supported. |
40 | * | |
41 | * @param <E> | |
e5083481 | 42 | * The type of segment held in this store |
26a6a7eb AM |
43 | * |
44 | * @author Alexandre Montplaisir | |
664a3a81 | 45 | * @deprecated Use the {@link SegmentStoreFactory} to create a new segment store |
26a6a7eb | 46 | */ |
664a3a81 | 47 | @Deprecated |
50b08ea8 | 48 | public class TreeMapStore<@NonNull E extends ISegment> extends org.eclipse.tracecompass.internal.segmentstore.core.treemap.TreeMapStore<E> { |
4dafe201 | 49 | |
26a6a7eb | 50 | /** |
e5083481 | 51 | * Constructor |
26a6a7eb AM |
52 | */ |
53 | public TreeMapStore() { | |
50b08ea8 | 54 | super(); |
26a6a7eb AM |
55 | } |
56 | ||
1a9cb076 AM |
57 | // ------------------------------------------------------------------------ |
58 | // Methods from Collection | |
59 | // ------------------------------------------------------------------------ | |
60 | ||
26a6a7eb | 61 | @Override |
1a9cb076 | 62 | public Iterator<E> iterator() { |
50b08ea8 | 63 | return super.iterator(); |
26a6a7eb AM |
64 | } |
65 | ||
66 | @Override | |
1a9cb076 | 67 | public boolean add(@Nullable E val) { |
50b08ea8 | 68 | return super.add(val); |
1a9cb076 AM |
69 | } |
70 | ||
71 | @Override | |
72 | public int size() { | |
50b08ea8 | 73 | return super.size(); // me |
1a9cb076 AM |
74 | } |
75 | ||
76 | @Override | |
77 | public boolean isEmpty() { | |
50b08ea8 | 78 | return super.isEmpty(); |
26a6a7eb AM |
79 | } |
80 | ||
81 | @Override | |
1a9cb076 | 82 | public boolean contains(@Nullable Object o) { |
50b08ea8 | 83 | return super.contains(o); |
26a6a7eb AM |
84 | } |
85 | ||
1a9cb076 AM |
86 | @Override |
87 | public boolean containsAll(@Nullable Collection<?> c) { | |
50b08ea8 | 88 | return super.containsAll(c); |
1a9cb076 AM |
89 | } |
90 | ||
91 | @Override | |
92 | public Object[] toArray() { | |
50b08ea8 | 93 | return super.toArray(); |
1a9cb076 AM |
94 | } |
95 | ||
96 | @Override | |
95bcb6c4 | 97 | public <T> T[] toArray(T[] a) { |
50b08ea8 | 98 | return super.toArray(a); |
1a9cb076 AM |
99 | } |
100 | ||
101 | @Override | |
102 | public boolean remove(@Nullable Object o) { | |
50b08ea8 | 103 | return super.remove(o); |
1a9cb076 AM |
104 | } |
105 | ||
106 | @Override | |
107 | public boolean addAll(@Nullable Collection<? extends E> c) { | |
50b08ea8 | 108 | return super.addAll(c); |
1a9cb076 AM |
109 | } |
110 | ||
111 | @Override | |
112 | public boolean removeAll(@Nullable Collection<?> c) { | |
50b08ea8 | 113 | return super.removeAll(c); |
1a9cb076 AM |
114 | } |
115 | ||
116 | @Override | |
117 | public boolean retainAll(@Nullable Collection<?> c) { | |
50b08ea8 | 118 | return super.retainAll(c); |
1a9cb076 AM |
119 | } |
120 | ||
121 | @Override | |
122 | public void clear() { | |
50b08ea8 | 123 | super.clear(); |
1a9cb076 AM |
124 | } |
125 | ||
126 | // ------------------------------------------------------------------------ | |
127 | // Methods added by ISegmentStore | |
128 | // ------------------------------------------------------------------------ | |
129 | ||
26a6a7eb | 130 | @Override |
1a9cb076 | 131 | public Iterable<E> getIntersectingElements(long position) { |
50b08ea8 | 132 | return super.getIntersectingElements(position); |
26a6a7eb AM |
133 | } |
134 | ||
135 | @Override | |
1a9cb076 | 136 | public Iterable<E> getIntersectingElements(long start, long end) { |
50b08ea8 | 137 | return super.getIntersectingElements(start, end); |
26a6a7eb AM |
138 | } |
139 | ||
140 | @Override | |
71e78f69 | 141 | public void dispose() { |
50b08ea8 | 142 | super.dispose(); |
26a6a7eb | 143 | } |
26a6a7eb | 144 | } |