1 /*******************************************************************************
2 * Copyright (c) 2009, 2010 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.experiment
;
15 import org
.eclipse
.linuxtools
.tmf
.event
.TmfEvent
;
16 import org
.eclipse
.linuxtools
.tmf
.trace
.ITmfLocation
;
17 import org
.eclipse
.linuxtools
.tmf
.trace
.ITmfTrace
;
18 import org
.eclipse
.linuxtools
.tmf
.trace
.TmfContext
;
21 * <b><u>TmfExperimentContext</u></b>
23 * Implement me. Please.
25 public class TmfExperimentContext
extends TmfContext
{
27 private ITmfTrace
[] fTraces
= new ITmfTrace
[0];
28 private TmfContext
[] fContexts
;
29 private TmfEvent
[] fEvents
;
30 private int lastIndex
;
32 // ------------------------------------------------------------------------
34 // ------------------------------------------------------------------------
36 public TmfExperimentContext(ITmfTrace
[] traces
, TmfContext
[] contexts
) {
40 fEvents
= new TmfEvent
[fTraces
.length
];
42 ITmfLocation
<?
>[] locations
= new ITmfLocation
[fTraces
.length
];
44 for (int i
= 0; i
< fTraces
.length
; i
++) {
45 if (contexts
[i
] != null) {
46 locations
[i
] = contexts
[i
].getLocation();
47 rank
+= contexts
[i
].getRank();
51 setLocation(new TmfExperimentLocation(locations
));
56 public TmfExperimentContext(ITmfTrace
[] traces
) {
57 this(traces
, new TmfContext
[traces
.length
]);
60 public TmfExperimentContext(TmfExperimentContext other
) {
61 this(other
.fTraces
, other
.cloneContexts());
62 fEvents
= other
.fEvents
;
63 setLocation(other
.getLocation());
64 setRank(other
.getRank());
67 private TmfContext
[] cloneContexts() {
68 TmfContext
[] contexts
= new TmfContext
[fContexts
.length
];
69 for (int i
= 0; i
< fContexts
.length
; i
++)
70 contexts
[i
] = fContexts
[i
].clone();
74 // ------------------------------------------------------------------------
76 // ------------------------------------------------------------------------
78 public ITmfTrace
[] getTraces() {
82 public TmfContext
[] getContexts() {
86 public TmfEvent
[] getEvents() {
90 public int getLastTrace() {
94 public void setLastTrace(int newIndex
) {