Commit | Line | Data |
---|---|---|
be222f56 | 1 | /******************************************************************************* |
11252342 | 2 | * Copyright (c) 2009, 2013 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 | ||
cad06250 | 21 | @SuppressWarnings("javadoc") |
be222f56 | 22 | public class TraceImpl implements ITimeGraphEntry { |
cad06250 | 23 | |
be222f56 PT |
24 | // ======================================================================== |
25 | // Data | |
26 | // ======================================================================== | |
cad06250 | 27 | |
be222f56 PT |
28 | private String name = "traceDefaultName"; |
29 | private long startTime = 0; | |
30 | private long stopTime = 1; | |
31 | private String className = "defaultClassName"; | |
32 | private Vector<ITimeEvent> traceEvents = new Vector<ITimeEvent>(); | |
33 | ||
34 | // ======================================================================== | |
35 | // Constructor | |
36 | // ======================================================================== | |
37 | ||
38 | public TraceImpl(String name, long sTime, long stopTime, String className) { | |
39 | this.name = name; | |
40 | this.startTime = sTime; | |
41 | this.stopTime = stopTime; | |
42 | this.className = className; | |
43 | } | |
44 | ||
45 | // ======================================================================== | |
46 | // Methods | |
47 | // ======================================================================== | |
48 | ||
49 | public String getClassName() { | |
50 | return className; | |
51 | } | |
52 | ||
53 | public void setClassName(String className) { | |
54 | this.className = className; | |
55 | } | |
56 | ||
57 | public void setName(String name) { | |
58 | this.name = name; | |
59 | } | |
60 | ||
61 | public void setStartTime(long startTime) { | |
62 | this.startTime = startTime; | |
63 | } | |
64 | ||
65 | public void setStopTime(long stopTime) { | |
66 | this.stopTime = stopTime; | |
67 | } | |
68 | ||
69 | @Override | |
70 | public String getName() { | |
71 | return name; | |
72 | } | |
73 | ||
74 | @Override | |
75 | public long getStartTime() { | |
76 | return startTime; | |
77 | } | |
78 | ||
79 | @Override | |
80 | public long getEndTime() { | |
81 | return stopTime; | |
82 | } | |
83 | ||
84 | @Override | |
85 | public boolean hasTimeEvents() { | |
86 | return traceEvents != null; | |
87 | } | |
88 | ||
89 | @Override | |
90 | public Iterator<ITimeEvent> getTimeEventsIterator() { | |
91 | return traceEvents.iterator(); | |
92 | } | |
93 | ||
94 | @Override | |
95 | public Iterator<ITimeEvent> getTimeEventsIterator(long aStartTime, long aStopTime, long maxDuration) { | |
96 | return traceEvents.iterator(); | |
97 | } | |
98 | ||
99 | public void addTraceEvent(ITimeEvent event) { | |
100 | traceEvents.add(event); | |
101 | } | |
102 | ||
103 | @Override | |
30652cc3 | 104 | public List<ITimeGraphEntry> getChildren() { |
be222f56 PT |
105 | return null; |
106 | } | |
107 | ||
108 | @Override | |
109 | public ITimeGraphEntry getParent() { | |
110 | return null; | |
111 | } | |
112 | ||
113 | @Override | |
114 | public boolean hasChildren() { | |
115 | return false; | |
116 | } | |
117 | ||
118 | } |