| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2009, 2014 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 | * Francois Chouinard - Initial API and implementation |
| 11 | *******************************************************************************/ |
| 12 | |
| 13 | package org.eclipse.tracecompass.tmf.core.signal; |
| 14 | |
| 15 | /** |
| 16 | * Base class for TMF signals |
| 17 | * |
| 18 | * @version 1.0 |
| 19 | * @author Francois Chouinard |
| 20 | */ |
| 21 | public abstract class TmfSignal { |
| 22 | |
| 23 | private final Object fSource; |
| 24 | private int fReference; |
| 25 | |
| 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 | } |
| 35 | |
| 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 | } |
| 48 | |
| 49 | /** |
| 50 | * @return The source object of this signal |
| 51 | */ |
| 52 | public Object getSource() { |
| 53 | return fSource; |
| 54 | } |
| 55 | |
| 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 | } |
| 65 | |
| 66 | /** |
| 67 | * @return This signal's reference index |
| 68 | */ |
| 69 | public int getReference() { |
| 70 | return fReference; |
| 71 | } |
| 72 | |
| 73 | } |