1 /*******************************************************************************
2 * Copyright (c) 2015 EfficiOS Inc., Alexandre Montplaisir and others.
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
10 * Alexandre Montplaisir - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.segmentstore
.core
.treemap
;
15 import java
.util
.Collection
;
16 import java
.util
.Iterator
;
17 import java
.util
.TreeMap
;
19 import org
.eclipse
.jdt
.annotation
.NonNull
;
20 import org
.eclipse
.jdt
.annotation
.Nullable
;
21 import org
.eclipse
.tracecompass
.segmentstore
.core
.ISegment
;
22 import org
.eclipse
.tracecompass
.segmentstore
.core
.ISegmentStore
;
23 import org
.eclipse
.tracecompass
.segmentstore
.core
.SegmentStoreFactory
;
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.
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}).
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.
39 * Removal operations are not supported.
42 * The type of segment held in this store
44 * @author Alexandre Montplaisir
45 * @deprecated Use the {@link SegmentStoreFactory} to create a new segment store
48 public class TreeMapStore
<@NonNull E
extends ISegment
> extends org
.eclipse
.tracecompass
.internal
.segmentstore
.core
.treemap
.TreeMapStore
<E
> {
53 public TreeMapStore() {
57 // ------------------------------------------------------------------------
58 // Methods from Collection
59 // ------------------------------------------------------------------------
62 public Iterator
<E
> iterator() {
63 return super.iterator();
67 public boolean add(@Nullable E val
) {
68 return super.add(val
);
73 return super.size(); // me
77 public boolean isEmpty() {
78 return super.isEmpty();
82 public boolean contains(@Nullable Object o
) {
83 return super.contains(o
);
87 public boolean containsAll(@Nullable Collection
<?
> c
) {
88 return super.containsAll(c
);
92 public Object
[] toArray() {
93 return super.toArray();
97 public <T
> T
[] toArray(T
[] a
) {
98 return super.toArray(a
);
102 public boolean remove(@Nullable Object o
) {
103 return super.remove(o
);
107 public boolean addAll(@Nullable Collection
<?
extends E
> c
) {
108 return super.addAll(c
);
112 public boolean removeAll(@Nullable Collection
<?
> c
) {
113 return super.removeAll(c
);
117 public boolean retainAll(@Nullable Collection
<?
> c
) {
118 return super.retainAll(c
);
122 public void clear() {
126 // ------------------------------------------------------------------------
127 // Methods added by ISegmentStore
128 // ------------------------------------------------------------------------
131 public Iterable
<E
> getIntersectingElements(long position
) {
132 return super.getIntersectingElements(position
);
136 public Iterable
<E
> getIntersectingElements(long start
, long end
) {
137 return super.getIntersectingElements(start
, end
);
141 public void dispose() {
This page took 0.038974 seconds and 6 git commands to generate.