TMF: Change visibility of TmfEventMatching methods
[deliverable/tracecompass.git] / org.eclipse.tracecompass.statesystem.core / src / org / eclipse / tracecompass / statesystem / core / backend / NullBackend.java
CommitLineData
f9a76cac 1/*******************************************************************************
ed902a2b 2 * Copyright (c) 2013, 2014 Ericsson
f9a76cac
AM
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 * Alexandre Montplaisir - Initial API and implementation
11 *******************************************************************************/
12
e894a508 13package org.eclipse.tracecompass.statesystem.core.backend;
f9a76cac
AM
14
15import java.io.File;
16import java.io.FileInputStream;
17import java.io.PrintWriter;
18import java.util.List;
19
b2f62cb5 20import org.eclipse.jdt.annotation.NonNull;
e894a508
AM
21import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
22import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
f9a76cac
AM
23
24/**
25 * An implement of a state history back-end to simply discards *all* the
26 * intervals it receives. Obviously, no queries can be done on it. It is useful
cb42195c
AM
27 * for using with a StateSystem on which you will only want to do "ongoing"
28 * requests.
f9a76cac
AM
29 *
30 * @author Alexandre Montplaisir
31 */
32public class NullBackend implements IStateHistoryBackend {
33
b2f62cb5
AM
34 private final @NonNull String ssid;
35
f9a76cac
AM
36 /**
37 * Constructor
b2f62cb5
AM
38 *
39 * @param ssid
40 * The state system's id
dbc7991d 41 * @since 1.0
f9a76cac 42 */
b2f62cb5
AM
43 public NullBackend(@NonNull String ssid) {
44 this.ssid = ssid;
45 }
46
dbc7991d
AM
47 /**
48 * @since 1.0
49 */
b2f62cb5
AM
50 @Override
51 public String getSSID() {
52 return ssid;
53 }
f9a76cac
AM
54
55 @Override
56 public long getStartTime() {
57 return 0;
58 }
59
60 @Override
61 public long getEndTime() {
62 return 0;
63 }
64
65 /**
66 * The interval will be discarded when using a null backend.
67 */
68 @Override
69 public void insertPastState(long stateStartTime, long stateEndTime,
70 int quark, ITmfStateValue value) {
71 /* The interval is always discarded. */
72 }
73
74 @Override
75 public void finishedBuilding(long endTime) {
76 /* Nothing to do */
77 }
78
79 @Override
80 public FileInputStream supplyAttributeTreeReader() {
81 return null;
82 }
83
84 @Override
85 public File supplyAttributeTreeWriterFile() {
86 return null;
87 }
88
89 @Override
90 public long supplyAttributeTreeWriterFilePosition() {
91 return -1;
92 }
93
94 @Override
95 public void removeFiles() {
96 /* Nothing to do */
97 }
98
99 @Override
100 public void dispose() {
101 /* Nothing to do */
102 }
103
104 /**
105 * Null back-ends cannot run queries. Nothing will be put in
106 * currentStateInfo.
107 */
108 @Override
109 public void doQuery(List<ITmfStateInterval> currentStateInfo, long t) {
110 /* Cannot do past queries */
111 }
112
113 /**
114 * Null back-ends cannot run queries. 'null' will be returned.
115 *
116 * @return Always returns null.
117 */
118 @Override
119 public ITmfStateInterval doSingularQuery(long t, int attributeQuark) {
120 /* Cannot do past queries */
121 return null;
122 }
123
f9a76cac
AM
124 @Override
125 public void debugPrint(PrintWriter writer) {
126 writer.println("Null history backend"); //$NON-NLS-1$
127 }
128}
This page took 0.057676 seconds and 5 git commands to generate.