Commit | Line | Data |
---|---|---|
5d10d135 ASL |
1 | /******************************************************************************* |
2 | * Copyright (c) 2009, 2010 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 | * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | package org.eclipse.linuxtools.lttng.state.resource; | |
13 | ||
14 | import org.eclipse.linuxtools.lttng.TraceDebug; | |
15 | import org.eclipse.linuxtools.lttng.model.LTTngTreeNodeGeneric; | |
16 | import org.eclipse.linuxtools.lttng.state.resource.ILTTngStateResource.GlobalStateMode; | |
17 | ||
18 | /** | |
19 | * @author alvaro | |
20 | * | |
21 | */ | |
22 | public class LTTngStateResource extends | |
23 | LTTngTreeNodeGeneric<LTTngStateResource> { | |
24 | ||
25 | // ======================================================================== | |
26 | // Data | |
27 | // ======================================================================= | |
28 | private GlobalStateMode fstateMode = GlobalStateMode.LTT_STATEMODE_UNKNOWN; | |
29 | private final ILttngStateContext fcontext; | |
30 | ||
31 | // ======================================================================+ | |
32 | // Constructors | |
33 | // ======================================================================= | |
34 | ||
35 | public LTTngStateResource(Long id, LTTngStateResource parent, String name, | |
36 | ILttngStateContext context, Object value) { | |
37 | super(id, parent, name, value); | |
38 | fcontext = context; | |
39 | } | |
40 | ||
41 | public LTTngStateResource(Long id, String name, ILttngStateContext context, | |
42 | Object value) { | |
43 | super(id, name, value); | |
44 | fcontext = context; | |
45 | } | |
46 | ||
47 | // ======================================================================== | |
48 | // Methods | |
49 | // ======================================================================= | |
50 | /* | |
51 | * (non-Javadoc) | |
52 | * | |
53 | * @see | |
54 | * org.eclipse.linuxtools.lttng.control.LTTngStateTreeNodeGeneric#getChildren | |
55 | * () | |
56 | */ | |
57 | public LTTngStateResource[] getChildren() { | |
58 | return childrenToArray(fchildren.values(), this.getClass()); | |
59 | } | |
60 | ||
61 | /* | |
62 | * (non-Javadoc) | |
63 | * | |
64 | * @see | |
65 | * org.eclipse.linuxtools.lttng.state.resource.ILTTngStateResource#getStateMode | |
66 | * () | |
67 | */ | |
68 | public GlobalStateMode getStateMode() { | |
69 | return fstateMode; | |
70 | } | |
71 | ||
72 | /** | |
73 | * @param stateMode | |
74 | */ | |
75 | public void setStateMode(GlobalStateMode stateMode) { | |
76 | if (stateMode != null) { | |
77 | fstateMode = stateMode; | |
78 | } else { | |
79 | TraceDebug.debug("Received input is null !"); | |
80 | } | |
81 | } | |
82 | ||
83 | /* | |
84 | * (non-Javadoc) | |
85 | * | |
86 | * @see | |
87 | * org.eclipse.linuxtools.lttng.state.resource.ILTTngStateResource#getContext | |
88 | * () | |
89 | */ | |
90 | public ILttngStateContext getContext() { | |
91 | return fcontext; | |
92 | } | |
93 | ||
94 | } |