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
;
31 // ------------------------------------------------------------------------
33 // ------------------------------------------------------------------------
35 public TmfExperimentContext(ITmfTrace
[] traces
, TmfContext
[] contexts
) {
39 fEvents
= new TmfEvent
[fTraces
.length
];
41 ITmfLocation
<?
>[] locations
= new ITmfLocation
[fTraces
.length
];
43 for (int i
= 0; i
< fTraces
.length
; i
++) {
44 if (contexts
[i
] != null) {
45 locations
[i
] = contexts
[i
].getLocation();
46 rank
+= contexts
[i
].getRank();
50 setLocation(new TmfExperimentLocation(locations
));
54 public TmfExperimentContext(ITmfTrace
[] traces
) {
55 this(traces
, new TmfContext
[traces
.length
]);
58 public TmfExperimentContext(TmfExperimentContext other
) {
59 this(other
.fTraces
, other
.cloneContexts());
60 fEvents
= other
.fEvents
;
61 setLocation(other
.getLocation());
62 setRank(other
.getRank());
65 private TmfContext
[] cloneContexts() {
66 TmfContext
[] contexts
= new TmfContext
[fContexts
.length
];
67 for (int i
= 0; i
< fContexts
.length
; i
++)
68 contexts
[i
] = fContexts
[i
].clone();
72 // ------------------------------------------------------------------------
74 // ------------------------------------------------------------------------
76 public ITmfTrace
[] getTraces() {
80 public TmfContext
[] getContexts() {
84 public TmfEvent
[] getEvents() {