lttng: Add a diagram showing the dependencies between plugins
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.core / src / org / eclipse / linuxtools / internal / lttng2 / core / control / model / impl / SnapshotInfo.java
1 /**********************************************************************
2 * Copyright (c) 2013 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 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
12 package org.eclipse.linuxtools.internal.lttng2.core.control.model.impl;
13
14 import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISnapshotInfo;
15
16 /**
17 * <p>
18 * Implementation of the snapshot interface (ISnapshotInfo) to store snapshot
19 * related data.
20 * </p>
21 *
22 * @author Bernd Hufmann
23 */
24 public class SnapshotInfo extends TraceInfo implements ISnapshotInfo {
25
26 // ------------------------------------------------------------------------
27 // Attributes
28 // ------------------------------------------------------------------------
29 /** The snapshot path for storing traces. */
30 private String fPath = ""; //$NON-NLS-1$
31 /** The snapshot ID */
32 private int fId = -1;
33 /** Flag whether snapshot is stored over the network or locally */
34 private boolean fIsStreamed = false;
35
36 // ------------------------------------------------------------------------
37 // Constructors
38 // ------------------------------------------------------------------------
39 /**
40 * Constructor
41 * @param name - name of base event
42 */
43 public SnapshotInfo(String name) {
44 super(name);
45 }
46
47 /**
48 * Copy constructor
49 * @param other - the instance to copy
50 */
51 public SnapshotInfo(SnapshotInfo other) {
52 super(other);
53 fPath = other.fPath;
54 fId = other.fId;
55 fIsStreamed = other.fIsStreamed;
56 }
57
58 // ------------------------------------------------------------------------
59 // Accessors
60 // ------------------------------------------------------------------------
61
62 @Override
63 public String getSnapshotPath() {
64 return fPath;
65 }
66
67 @Override
68 public void setSnapshotPath(String path) {
69 fPath = path;
70 }
71
72 @Override
73 public int getId() {
74 return fId;
75 }
76
77 @Override
78 public void setId(int id) {
79 fId = id;
80 }
81
82 @Override
83 public void setStreamedSnapshot(boolean isStreamed) {
84 fIsStreamed = isStreamed;
85 }
86
87 @Override
88 public boolean isStreamedSnapshot() {
89 return fIsStreamed;
90 }
91
92 // ------------------------------------------------------------------------
93 // Operations
94 // ------------------------------------------------------------------------
95
96 @Override
97 public int hashCode() {
98 final int prime = 31;
99 int result = super.hashCode();
100 result = prime * result + fId;
101 result = prime * result + (fIsStreamed ? 1231 : 1237);
102 result = prime * result + ((fPath == null) ? 0 : fPath.hashCode());
103 return result;
104 }
105
106 @Override
107 public boolean equals(Object obj) {
108 if (this == obj) {
109 return true;
110 }
111 if (!super.equals(obj)) {
112 return false;
113 }
114 if (getClass() != obj.getClass()) {
115 return false;
116 }
117 SnapshotInfo other = (SnapshotInfo) obj;
118 if (fId != other.fId) {
119 return false;
120 }
121 if (fIsStreamed != other.fIsStreamed) {
122 return false;
123 }
124 if (fPath == null) {
125 if (other.fPath != null) {
126 return false;
127 }
128 } else if (!fPath.equals(other.fPath)) {
129 return false;
130 }
131 return true;
132 }
133
134 @SuppressWarnings("nls")
135 @Override
136 public String toString() {
137 StringBuffer output = new StringBuffer();
138 output.append("[SnapshotInfo(");
139 output.append(super.toString());
140 output.append(",snapshotPath=");
141 output.append(fPath);
142 output.append(",ID=");
143 output.append(fId);
144 output.append(",isStreamedSnapshot=");
145 output.append(fIsStreamed);
146 output.append(")]");
147 return output.toString();
148 }
149
150 }
This page took 0.053775 seconds and 5 git commands to generate.