1 /*******************************************************************************
2 * Copyright (c) 2013, 2014 Ericsson
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
10 * Alexandre Montplaisir - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.internal
.statesystem
.core
.backend
;
16 import java
.io
.FileInputStream
;
17 import java
.util
.Collections
;
18 import java
.util
.List
;
20 import org
.eclipse
.jdt
.annotation
.NonNull
;
21 import org
.eclipse
.tracecompass
.internal
.provisional
.datastore
.core
.condition
.IntegerRangeCondition
;
22 import org
.eclipse
.tracecompass
.internal
.provisional
.datastore
.core
.condition
.TimeRangeCondition
;
23 import org
.eclipse
.tracecompass
.statesystem
.core
.backend
.IStateHistoryBackend
;
24 import org
.eclipse
.tracecompass
.statesystem
.core
.exceptions
.TimeRangeException
;
25 import org
.eclipse
.tracecompass
.statesystem
.core
.interval
.ITmfStateInterval
;
26 import org
.eclipse
.tracecompass
.statesystem
.core
.statevalue
.ITmfStateValue
;
29 * An implement of a state history back-end to simply discards *all* the
30 * intervals it receives. Obviously, no queries can be done on it. It is useful
31 * for using with a StateSystem on which you will only want to do "ongoing"
34 * @author Alexandre Montplaisir
36 public class NullBackend
implements IStateHistoryBackend
{
38 private final @NonNull String ssid
;
44 * The state system's id
46 public NullBackend(@NonNull String ssid
) {
51 public String
getSSID() {
56 public long getStartTime() {
61 public long getEndTime() {
66 * The interval will be discarded when using a null backend.
69 public void insertPastState(long stateStartTime
, long stateEndTime
,
70 int quark
, ITmfStateValue value
) {
71 /* The interval is always discarded. */
75 public void finishedBuilding(long endTime
) {
80 public FileInputStream
supplyAttributeTreeReader() {
85 public File
supplyAttributeTreeWriterFile() {
90 public long supplyAttributeTreeWriterFilePosition() {
95 public void removeFiles() {
100 public void dispose() {
105 * Null back-ends cannot run queries. Nothing will be put in
109 public void doQuery(List
<ITmfStateInterval
> currentStateInfo
, long t
) {
110 /* Cannot do past queries */
114 * Null back-ends cannot run queries. 'null' will be returned.
116 * @return Always returns null.
119 public ITmfStateInterval
doSingularQuery(long t
, int attributeQuark
) {
120 /* Cannot do past queries */
125 public Iterable
<@NonNull ITmfStateInterval
> query2D(IntegerRangeCondition quarks
,
126 TimeRangeCondition times
) throws TimeRangeException
{
127 return Collections
.EMPTY_LIST
;