Merge branch 'master' into lttng-luna
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / ctfadaptor / CtfIteratorManager.java
index 209e9d6e7cd28c0a6e7788fa61be095d575e03a4..65fac21e59080277a60dded2c8dec51d633085ac 100644 (file)
@@ -1,12 +1,14 @@
 /*******************************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2013 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  *
- * Contributors: Matthew Khouzam - Initial API and implementation
+ * Contributors:
+ *   Matthew Khouzam - Initial API and implementation
+ *   Simon Delisle - Added a method to remove the iterator
  *******************************************************************************/
 package org.eclipse.linuxtools.tmf.core.ctfadaptor;
 
@@ -71,6 +73,22 @@ public abstract class CtfIteratorManager {
             final CtfTmfContext ctx) {
         return map.get(trace).getIterator(ctx);
     }
+
+    /**
+     * Remove an iterator for a given trace and context
+     *
+     * @param trace
+     *            the trace
+     * @param ctx
+     *            the context
+     * @since 2.1
+     */
+    public static synchronized void removeIterator(final CtfTmfTrace trace, final CtfTmfContext ctx) {
+        CtfTraceManager traceManager = map.get(trace);
+        if (traceManager != null) {
+            traceManager.removeIterator(ctx);
+        }
+    }
 }
 
 /**
@@ -154,6 +172,11 @@ class CtfTraceManager {
         return retVal;
     }
 
+    public void removeIterator(CtfTmfContext context) {
+        fMap.remove(context);
+        fRandomAccess.remove(context);
+    }
+
     /**
      * Add a pair of context and element to the hashmap and the arraylist.
      *
This page took 0.024517 seconds and 5 git commands to generate.