|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 package com.nokia.carbide.cpp.internal.pi.model; |
|
19 |
|
20 import java.awt.Color; |
|
21 |
|
22 |
|
23 public class ProfiledDspHook |
|
24 { |
|
25 private Long timeStamp; |
|
26 private Color color = null; |
|
27 private boolean enableValue = true; |
|
28 private String nameString; |
|
29 private int eventCount = 0; |
|
30 |
|
31 public ProfiledDspHook() |
|
32 { |
|
33 // super(); |
|
34 this.color = new Color( |
|
35 (int)(Math.random()*255), |
|
36 (int)(Math.random()*255), |
|
37 (int)(Math.random()*255)); |
|
38 } |
|
39 |
|
40 public ProfiledDspHook(String name, int ec) |
|
41 { |
|
42 // super(); |
|
43 this.color = new Color( |
|
44 (int)(Math.random()*255), |
|
45 (int)(Math.random()*255), |
|
46 (int)(Math.random()*255)); |
|
47 this.nameString = name; |
|
48 this.eventCount = ec; |
|
49 } |
|
50 |
|
51 public ProfiledDspHook(String name, long ts) |
|
52 { |
|
53 // super(); |
|
54 this.color = new Color( |
|
55 (int)(Math.random()*255), |
|
56 (int)(Math.random()*255), |
|
57 (int)(Math.random()*255)); |
|
58 this.nameString = name; |
|
59 this.timeStamp = new Long(ts); |
|
60 } |
|
61 |
|
62 public void setEventTimeString(Long ts) |
|
63 { |
|
64 this.timeStamp = ts; |
|
65 } |
|
66 |
|
67 public String getEventTimeString() |
|
68 { |
|
69 return this.timeStamp.toString(); |
|
70 } |
|
71 |
|
72 |
|
73 public void setColor(Color c) |
|
74 { |
|
75 this.color = c; |
|
76 } |
|
77 |
|
78 public void setEnabled(boolean enableValue) |
|
79 { |
|
80 this.enableValue = enableValue; |
|
81 } |
|
82 |
|
83 public void setEventCount(int c) |
|
84 { |
|
85 this.eventCount = c; |
|
86 } |
|
87 |
|
88 public boolean isEnabled() |
|
89 { |
|
90 return enableValue; |
|
91 } |
|
92 |
|
93 public Color getColor() |
|
94 { |
|
95 return this.color; |
|
96 } |
|
97 |
|
98 public String getNameString() |
|
99 { |
|
100 return this.nameString; |
|
101 } |
|
102 public int getEventCount() |
|
103 { |
|
104 return this.eventCount; |
|
105 } |
|
106 |
|
107 public String toString() |
|
108 { |
|
109 if (this.isEnabled()) |
|
110 { |
|
111 return "true " + nameString + this.getEventTimeString(); //$NON-NLS-1$ |
|
112 } |
|
113 else |
|
114 { |
|
115 return "false " + nameString + this.getEventTimeString(); //$NON-NLS-1$ |
|
116 } |
|
117 } |
|
118 } |