temporary re-factoring project
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng / src / org / eclipse / linuxtools / lttng / state / model / LttngTrapState.java
1 /*******************************************************************************
2 * Copyright (c) 2009 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.model;
13
14
15
16 /**
17 * <b><u>LttvTrapState</u></b>
18 * <p>
19 *
20 */
21 public class LttngTrapState implements Cloneable {
22 // ========================================================================
23 // Data
24 // =======================================================================
25 private Long running;
26
27
28 // ========================================================================
29 // Constructor
30 // =======================================================================
31 public LttngTrapState(Long running) {
32 this.running = running;
33 }
34
35 @Override
36 public LttngTrapState clone() {
37 LttngTrapState newState = null;
38
39 try {
40 newState = (LttngTrapState)super.clone();
41
42 // *** IMPORTANT ***
43 // Basic type in java are immutable!
44 // Thus, using assignation ("=") on basic type is CORRECT,
45 // but we should ALWAYS use "new" or "clone()" on "non basic" type
46 newState.running = this.running;
47 }
48 catch ( CloneNotSupportedException e ) {
49 System.out.println("Cloning failed with : " + e.getMessage() );
50 }
51
52 return newState;
53 }
54
55 // ========================================================================
56 // Methods
57 // =======================================================================
58 public Long getRunning() {
59 return running;
60 }
61
62 public void setRunning(Long running) {
63 this.running = running;
64 }
65
66 public void incrementRunning() {
67 running++;
68 }
69
70 public void decrementRunning() {
71 if (running > 0) {
72 running--;
73 }
74 }
75 }
This page took 0.031646 seconds and 5 git commands to generate.