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().clone());
64 setRank(other
.getRank());
65 setLastTrace(other
.lastIndex
);
68 private TmfContext
[] cloneContexts() {
69 TmfContext
[] contexts
= new TmfContext
[fContexts
.length
];
70 for (int i
= 0; i
< fContexts
.length
; i
++)
71 contexts
[i
] = fContexts
[i
].clone();
75 // ------------------------------------------------------------------------
77 // ------------------------------------------------------------------------
79 public ITmfTrace
[] getTraces() {
83 public TmfContext
[] getContexts() {
87 public TmfEvent
[] getEvents() {
91 public int getLastTrace() {
95 public void setLastTrace(int newIndex
) {