DRAFT : Enable the possibility to copy an experiment. Useful to run request in the...
authorWilliam Bourque <william.bourque@polymtl.ca>
Mon, 19 Apr 2010 23:06:47 +0000 (23:06 +0000)
committerWilliam Bourque <william.bourque@polymtl.ca>
Mon, 19 Apr 2010 23:06:47 +0000 (23:06 +0000)
org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfComponent.java
org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfDataProvider.java
org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfEventProvider.java
org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/experiment/TmfExperiment.java
org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/trace/ITmfTrace.java

index 7f14a548e4832115a9ba0245cc4f466779c27ace..02279e0a397bebbb5a6854365cf02add986c71bd 100644 (file)
@@ -34,7 +34,14 @@ public abstract class TmfComponent implements ITmfComponent {
                fName = name;
                TmfSignalManager.register(this);
        }
+       
+       public TmfComponent(TmfComponent oldComponent) {
+        this.fName = oldComponent.fName;
 
+        // Should we register? Probably not but I'm not quite sure what this does
+        //register();
+       }
+       
        // ------------------------------------------------------------------------
        // ITmfComponent
        // ------------------------------------------------------------------------
index f5c6f6dc0fb244df912b7902f1c96b7c754b9014..8dabfb3c04403ddceb50cf22e6fca03183a8cb4d 100644 (file)
@@ -71,7 +71,19 @@ public abstract class TmfDataProvider<T extends TmfData> extends TmfComponent im
 
                TmfProviderManager.register(fType, this);
        }
+       
+       public TmfDataProvider(TmfDataProvider<T> oldDataProvider) {
+        super(oldDataProvider);
+
+        this.fType = oldDataProvider.fType;
+        this.fQueueSize = oldDataProvider.fQueueSize;
+
+        this.fExecutor = new TmfRequestExecutor();
+        this.fDataQueue = (oldDataProvider.fQueueSize > 1) ? new LinkedBlockingQueue<T>(oldDataProvider.fQueueSize) : new SynchronousQueue<T>();
 
+        this.fSynchDepth = oldDataProvider.fSynchDepth;
+       }
+       
        @Override
        public void dispose() {
                TmfProviderManager.deregister(fType, this);
index 3b843bfe92620c184c969f120f65978fa69cf6a6..26c75d83f936810fc826a567a0fac5a013af6ab1 100644 (file)
@@ -32,7 +32,11 @@ public abstract class TmfEventProvider<T extends TmfEvent> extends TmfDataProvid
        public TmfEventProvider(Class<T> type, int queueSize) {
                super("TmfEventProvider", type, queueSize);
        }
-
+       
+       public TmfEventProvider(TmfEventProvider<T> oldProvider) {
+               super(oldProvider);
+       }
+       
        @Override
        public boolean isCompleted(ITmfDataRequest<T> request, T data, int nbRead) {
                boolean dataRequestCompleted = super.isCompleted(request, data, nbRead);
index 5e1b2cf9f3d4aa551817e07c6e07b594382881cd..e58dc8d667ec2c75d4d8e6289d3a74050bac2d1e 100644 (file)
@@ -109,7 +109,34 @@ public class TmfExperiment<T extends TmfEvent> extends TmfEventProvider<T> imple
     public TmfExperiment(Class<T> type, String id, ITmfTrace[] traces, int indexPageSize) {
         this(type, id, traces, TmfTimestamp.Zero, indexPageSize);
     }
-
+    
+    
+    public TmfExperiment(TmfExperiment<T> oldExperiment) {
+       super(oldExperiment.fType);
+       
+       this.fExperimentId = oldExperiment.fExperimentId;
+       this.fEpoch = oldExperiment.fEpoch;
+       
+       this.fIndexPageSize = oldExperiment.fIndexPageSize;
+       
+       this.fTraces = new ITmfTrace[oldExperiment.fTraces.length];
+       
+       for ( int x=0; x<oldExperiment.fTraces.length; x++) {
+               this.fTraces[x] = oldExperiment.fTraces[x].createTraceCopy();
+       }
+       
+       // replace updateNbEvents()
+       this.fNbEvents = oldExperiment.fNbEvents;
+       
+       // replace updateTimeRange()
+       this.fTimeRange = oldExperiment.fTimeRange;
+    }
+    
+       public TmfExperiment<T> createTraceCopy() {
+               return new TmfExperiment<T>(this);
+       }
+    
+    
     /**
      * 
      */
index f8038207307e6fdc82ea8a7c866a3439071f4d47..b587b561790372878e8c961b489bc38d582a03e5 100644 (file)
@@ -21,7 +21,10 @@ import org.eclipse.linuxtools.tmf.event.TmfTimestamp;
  * <p>
  */
 public interface ITmfTrace {
-
+       
+       public ITmfTrace createTraceCopy();
+       
+       
        /**
         * @return the trace path 
         */
This page took 0.027788 seconds and 5 git commands to generate.