1 /*******************************************************************************
2 * Copyright (c) 2015, 2016 EfficiOS Inc., Alexandre Montplaisir
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 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.internal
.provisional
.analysis
.lami
.core
.types
;
12 import java
.util
.StringJoiner
;
14 import org
.eclipse
.jdt
.annotation
.NonNull
;
15 import org
.eclipse
.jdt
.annotation
.Nullable
;
18 * Class defining a LAMI 'process' type.
20 * This is the representation of an operating system process.
22 * @author Alexandre Montplaisir
24 public class LamiProcess
extends LamiData
{
26 private final @Nullable String fName
;
27 private final @Nullable Long fPid
;
28 private final @Nullable Long fTid
;
30 private final String fString
;
35 * All parameters are optional, but realistically at least one should be
45 public LamiProcess(@Nullable String name
, @Nullable Long pid
, @Nullable Long tid
) {
50 fString
= generateString();
54 * Get this process's name, null if unavailable.
56 * @return The process name
58 public @Nullable String
getName() {
63 * Get this process's PID, null if unavailable.
65 * @return The process PID
67 public @Nullable Long
getPID() {
72 * Get this process's TID, null if unavailable.
74 * @return The process TID
76 public @Nullable Long
getTID() {
80 private String
generateString() {
84 StringBuilder sb
= new StringBuilder();
89 if (pid
!= null || tid
!= null) {
91 StringJoiner sj
= new StringJoiner(", ", "(", ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
93 sj
.add("pid=" + pid
.toString()); //$NON-NLS-1$
96 sj
.add("tid=" + tid
.toString()); //$NON-NLS-1$
98 sb
.append(sj
.toString());
101 return sb
.toString();
105 public @NonNull String
toString() {
This page took 0.066151 seconds and 5 git commands to generate.