1 /*******************************************************************************
2 * Copyright (c) 2009 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 * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
11 *******************************************************************************/
12 package org
.eclipse
.linuxtools
.lttng
.core
.state
.model
;
14 import java
.util
.Stack
;
16 import org
.eclipse
.linuxtools
.lttng
.core
.state
.StateStrings
;
17 import org
.eclipse
.linuxtools
.lttng
.core
.state
.StateStrings
.IRQMode
;
20 * <b><u>LttvIRQState</u></b>
24 public class LttngIRQState
implements Cloneable
{
25 // ========================================================================
27 // =======================================================================
28 private Stack
<StateStrings
.IRQMode
> mode_stack
= new Stack
<StateStrings
.IRQMode
>();
30 // ========================================================================
32 // =======================================================================
33 public LttngIRQState() {
34 mode_stack
.push(IRQMode
.LTTV_IRQ_UNKNOWN
);
38 @SuppressWarnings("unchecked")
39 public LttngIRQState
clone() {
40 LttngIRQState newState
= null;
43 newState
= (LttngIRQState
)super.clone();
45 // Clone should work correctly for all stack object that contain basic java object (String, Long, etc...)
46 newState
.mode_stack
= (Stack
<StateStrings
.IRQMode
>)this.mode_stack
.clone();
48 catch ( CloneNotSupportedException e
) {
49 System
.out
.println("Cloning failed with : " + e
.getMessage() ); //$NON-NLS-1$
55 // ========================================================================
57 // =======================================================================
58 public void clearIrqStack() {
62 public void clearAndSetBaseToIrqStack(StateStrings
.IRQMode newState
) {
64 // Ensure that there is always at least 1 item in the stack
65 mode_stack
.push(newState
);
68 public void pushToIrqStack(StateStrings
.IRQMode newState
) {
69 mode_stack
.push(newState
);
72 public StateStrings
.IRQMode
popFromIrqStack() {
74 StateStrings
.IRQMode returnedMode
= mode_stack
.pop();
75 if (mode_stack
.size() < 1) {
76 mode_stack
.push(IRQMode
.LTTV_IRQ_UNKNOWN
);
82 public StateStrings
.IRQMode
peekFromIrqStack() {
83 return mode_stack
.peek();