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