Commit | Line | Data |
---|---|---|
8c8bf09f | 1 | /******************************************************************************* |
ed902a2b | 2 | * Copyright (c) 2009, 2014 Ericsson |
4f8ca6a1 | 3 | * |
8c8bf09f ASL |
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 | |
4f8ca6a1 | 8 | * |
8c8bf09f ASL |
9 | * Contributors: |
10 | * Francois Chouinard - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
2bdf0193 | 13 | package org.eclipse.tracecompass.tmf.core.signal; |
8c8bf09f ASL |
14 | |
15 | /** | |
4b7b3670 | 16 | * Base class for TMF signals |
4f8ca6a1 | 17 | * |
4b7b3670 FC |
18 | * @version 1.0 |
19 | * @author Francois Chouinard | |
8c8bf09f ASL |
20 | */ |
21 | public abstract class TmfSignal { | |
22 | ||
4f8ca6a1 AM |
23 | private final Object fSource; |
24 | private int fReference; | |
8c8bf09f | 25 | |
4f8ca6a1 AM |
26 | /** |
27 | * Basic constructor, which uses a default of "0" for the reference index | |
28 | * | |
29 | * @param source | |
30 | * Object sending this signal | |
31 | */ | |
32 | public TmfSignal(Object source) { | |
33 | this(source, 0); | |
34 | } | |
fc6ccf6f | 35 | |
4f8ca6a1 AM |
36 | /** |
37 | * Standard constructor | |
38 | * | |
39 | * @param source | |
40 | * Object sending this signal | |
41 | * @param reference | |
42 | * Reference index to assign to this signal | |
43 | */ | |
44 | public TmfSignal(Object source, int reference) { | |
45 | fSource = source; | |
46 | fReference = reference; | |
47 | } | |
fc6ccf6f | 48 | |
4f8ca6a1 AM |
49 | /** |
50 | * @return The source object of this signal | |
51 | */ | |
52 | public Object getSource() { | |
53 | return fSource; | |
54 | } | |
8c8bf09f | 55 | |
4f8ca6a1 AM |
56 | /** |
57 | * Change this signal's reference index | |
58 | * | |
59 | * @param reference | |
60 | * The new reference to use | |
61 | */ | |
62 | public void setReference(int reference) { | |
63 | fReference = reference; | |
64 | } | |
fc6ccf6f | 65 | |
4f8ca6a1 AM |
66 | /** |
67 | * @return This signal's reference index | |
68 | */ | |
69 | public int getReference() { | |
70 | return fReference; | |
71 | } | |
fc6ccf6f | 72 | |
8c8bf09f | 73 | } |