1 package org
.eclipse
.linuxtools
.tmf
.core
.ctfadaptor
;
3 import org
.eclipse
.linuxtools
.ctf
.core
.trace
.CTFTraceReader
;
4 import org
.eclipse
.linuxtools
.ctf
.core
.trace
.StreamInputReader
;
5 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfContext
;
6 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfLocation
;
8 public class CtfIterator
extends CTFTraceReader
implements ITmfContext
,
9 Comparable
<CtfIterator
> {
11 private final CtfTmfTrace ctfTmfTrace
;
13 private CtfLocation curLocation
;
17 * Create a new CTF trace iterator, which initially points at the first
22 public CtfIterator(CtfTmfTrace trace
) {
23 super(trace
.getCTFTrace());
24 this.ctfTmfTrace
= trace
;
26 // FIXME put the real stuff here...
27 this.curLocation
= new CtfLocation(trace
.getStartTime());
31 public CtfIterator(CtfTmfTrace trace
, long timestampValue
, long rank
) {
32 super(trace
.getCTFTrace());
33 this.ctfTmfTrace
= trace
;
34 this.curLocation
= (new CtfLocation(
35 this.getCurrentEvent().getTimestampValue()));
36 if (this.getCurrentEvent().getTimestampValue() != timestampValue
) {
37 this.seek(timestampValue
);
43 public CtfTmfTrace
getCtfTmfTrace() {
47 public CtfTmfEvent
getCurrentEvent() {
48 StreamInputReader top
= super.prio
.peek();
50 return new CtfTmfEvent(top
.getCurrentEvent(), top
, ctfTmfTrace
);
56 public boolean seek(long timestamp
) {
58 ret
= super.seek(timestamp
);
61 curLocation
.setLocation(getCurrentEvent().getTimestampValue());
67 public long getRank() {
68 final CtfTmfEvent current
= getCurrentEvent();
69 if (current
!= null) {
70 return getCurrentEvent().getRank();
76 public void setRank(long rank
) {
83 * @see org.eclipse.linuxtools.tmf.core.trace.TmfContext#clone()
86 public CtfIterator
clone() {
87 CtfIterator clone
= null;
88 clone
= new CtfIterator(ctfTmfTrace
,
89 this.getCurrentEvent().getTimestampValue(), curRank
);
94 public void dispose() {
95 // FIXME add dispose() stuff to CTFTrace and call it here...
100 public void setLocation(ITmfLocation
<?
> location
) {
101 // FIXME alex: isn't there a cleaner way than a cast here?
102 this.curLocation
= (CtfLocation
) location
;
106 public CtfLocation
getLocation() {
111 public void updateRank(int rank
) {
116 public boolean isValidRank() {
121 public boolean advance() {
122 return super.advance();
126 public int compareTo(CtfIterator o
) {
127 if (this.getRank() < o
.getRank()) {
129 } else if (this.getRank() > o
.getRank()) {
This page took 0.034586 seconds and 5 git commands to generate.