Method: DbgpBreakpointConfig(boolean, int, int, boolean, String, int)

1: /*
2: * #%~
3: * org.overture.ide.debug
4: * %%
5: * Copyright (C) 2008 - 2014 Overture
6: * %%
7: * This program is free software: you can redistribute it and/or modify
8: * it under the terms of the GNU General Public License as
9: * published by the Free Software Foundation, either version 3 of the
10: * License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public
18: * License along with this program. If not, see
19: * <http://www.gnu.org/licenses/gpl-3.0.html>.
20: * #~%
21: */
22: package org.overture.ide.debug.core.dbgp.breakpoints;
23:
24: public class DbgpBreakpointConfig
25: {
26:         private static final String TEMPORARY_TRUE = "1"; //$NON-NLS-1$
27:         private static final String TEMPORARY_FALSE = "0"; //$NON-NLS-1$
28:
29:         private static final String STATE_ENABLED = "enabled"; //$NON-NLS-1$
30:         private static final String STATE_DISABLED = "disabled"; //$NON-NLS-1$
31:
32:         private static final String HIT_CONDITION_GREATER = ">="; //$NON-NLS-1$
33:         private static final String HIT_CONDITION_EQUAL = "=="; //$NON-NLS-1$
34:         private static final String HIT_CONDITION_MULTIPLE = "%"; //$NON-NLS-1$
35:
36:         private boolean enabled;
37:
38:         private boolean temporary;
39:
40:         private int hitValue;
41:
42:         private int hitCondition;
43:
44:         private String expression;
45:         private int lineno;
46:
47:         // Constructors
48:         public DbgpBreakpointConfig()
49:         {
50:                 this(true);
51:         }
52:
53:         public DbgpBreakpointConfig(boolean enabled)
54:         {
55:                 this(enabled, -1, -1, null);
56:         }
57:
58:         public DbgpBreakpointConfig(boolean enabled, int hitValue,
59:                         int hitCondition, String expression)
60:         {
61:                 this(enabled, hitValue, hitCondition, false, expression, -1);
62:         }
63:
64:         public DbgpBreakpointConfig(boolean enabled, int hitValue,
65:                         int hitCondition, boolean temporary, String expression, int lineno)
66:         {
67:                 this.enabled = enabled;
68:                 this.hitValue = hitValue;
69:                 this.hitCondition = hitCondition;
70:                 this.temporary = temporary;
71:                 this.expression = expression;
72:                 this.lineno = lineno;
73:         }
74:
75:         // Enabled
76:         public boolean isEnabled()
77:         {
78:                 return enabled;
79:         }
80:
81:         public void setEnabled(boolean value)
82:         {
83:                 this.enabled = value;
84:         }
85:
86:         // Temporary
87:         public boolean isTemporary()
88:         {
89:                 return temporary;
90:         }
91:
92:         public void setTemporary(boolean value)
93:         {
94:                 this.temporary = value;
95:         }
96:
97:         // Hit value
98:         public int getHitValue()
99:         {
100:                 return hitValue;
101:         }
102:
103:         public void setHitValue(int hitValue)
104:         {
105:                 this.hitValue = hitValue;
106:         }
107:
108:         // Hit condition
109:         public int getHitCondition()
110:         {
111:                 return hitCondition;
112:         }
113:
114:         public void setHitCondition(int hitCondition)
115:         {
116:                 this.hitCondition = hitCondition;
117:         }
118:
119:         // Expression
120:         public String getExpression()
121:         {
122:                 return expression;
123:         }
124:
125:         public void setExpression(String expression)
126:         {
127:                 this.expression = expression;
128:         }
129:
130:         // Strings
131:         public String getTemporaryString()
132:         {
133:                 return temporary ? TEMPORARY_TRUE : TEMPORARY_FALSE;
134:         }
135:
136:         public String getStateString()
137:         {
138:                 return enabled ? STATE_ENABLED : STATE_DISABLED;
139:         }
140:
141:         public String getHitConditionString()
142:         {
143:                 if (hitCondition == IDbgpBreakpoint.HIT_CONDITION_EQUAL)
144:                 {
145:                         return HIT_CONDITION_EQUAL;
146:                 } else if (hitCondition == IDbgpBreakpoint.HIT_CONDITION_GREATER_OR_EQUAL)
147:                 {
148:                         return HIT_CONDITION_GREATER;
149:                 } else if (hitCondition == IDbgpBreakpoint.HIT_CONDITION_MULTIPLE)
150:                 {
151:                         return HIT_CONDITION_MULTIPLE;
152:                 }
153:
154:                 return null;
155:         }
156:
157:         public int getLineNo()
158:         {
159:                 return lineno;
160:         }
161:
162:         public void setLineNo(int value)
163:         {
164:                 lineno = value;
165:         }
166: }