Commit | Line | Data |
---|---|---|
be222f56 | 1 | /******************************************************************************* |
c8422608 | 2 | * Copyright (c) 2009, 2012 Ericsson |
be222f56 PT |
3 | * |
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 | |
8 | * | |
9 | * Contributors: | |
10 | * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | package org.eclipse.linuxtools.tmf.ui.widgets.timegraph.test.stub.model; | |
13 | ||
14 | import java.util.Iterator; | |
30652cc3 | 15 | import java.util.List; |
be222f56 PT |
16 | import java.util.Vector; |
17 | ||
18 | import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent; | |
19 | import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry; | |
20 | ||
21 | @SuppressWarnings({"javadoc", "nls"}) | |
22 | public class TraceImpl implements ITimeGraphEntry { | |
23 | // ======================================================================== | |
24 | // Data | |
25 | // ======================================================================== | |
26 | private String name = "traceDefaultName"; | |
27 | private long startTime = 0; | |
28 | private long stopTime = 1; | |
29 | private String className = "defaultClassName"; | |
30 | private Vector<ITimeEvent> traceEvents = new Vector<ITimeEvent>(); | |
31 | ||
32 | // ======================================================================== | |
33 | // Constructor | |
34 | // ======================================================================== | |
35 | ||
36 | public TraceImpl(String name, long sTime, long stopTime, String className) { | |
37 | this.name = name; | |
38 | this.startTime = sTime; | |
39 | this.stopTime = stopTime; | |
40 | this.className = className; | |
41 | } | |
42 | ||
43 | // ======================================================================== | |
44 | // Methods | |
45 | // ======================================================================== | |
46 | ||
47 | public String getClassName() { | |
48 | return className; | |
49 | } | |
50 | ||
51 | public void setClassName(String className) { | |
52 | this.className = className; | |
53 | } | |
54 | ||
55 | public void setName(String name) { | |
56 | this.name = name; | |
57 | } | |
58 | ||
59 | public void setStartTime(long startTime) { | |
60 | this.startTime = startTime; | |
61 | } | |
62 | ||
63 | public void setStopTime(long stopTime) { | |
64 | this.stopTime = stopTime; | |
65 | } | |
66 | ||
67 | @Override | |
68 | public String getName() { | |
69 | return name; | |
70 | } | |
71 | ||
72 | @Override | |
73 | public long getStartTime() { | |
74 | return startTime; | |
75 | } | |
76 | ||
77 | @Override | |
78 | public long getEndTime() { | |
79 | return stopTime; | |
80 | } | |
81 | ||
82 | @Override | |
83 | public boolean hasTimeEvents() { | |
84 | return traceEvents != null; | |
85 | } | |
86 | ||
87 | @Override | |
88 | public Iterator<ITimeEvent> getTimeEventsIterator() { | |
89 | return traceEvents.iterator(); | |
90 | } | |
91 | ||
92 | @Override | |
93 | public Iterator<ITimeEvent> getTimeEventsIterator(long aStartTime, long aStopTime, long maxDuration) { | |
94 | return traceEvents.iterator(); | |
95 | } | |
96 | ||
97 | public void addTraceEvent(ITimeEvent event) { | |
98 | traceEvents.add(event); | |
99 | } | |
100 | ||
101 | @Override | |
30652cc3 | 102 | public List<ITimeGraphEntry> getChildren() { |
be222f56 PT |
103 | return null; |
104 | } | |
105 | ||
106 | @Override | |
107 | public ITimeGraphEntry getParent() { | |
108 | return null; | |
109 | } | |
110 | ||
111 | @Override | |
112 | public boolean hasChildren() { | |
113 | return false; | |
114 | } | |
115 | ||
116 | } |