67e2713ecb009fe06da41ec7d4ee8a3a38d94064
[phpeclipse.git] / net.sourceforge.phpeclipse.xdebug.core / src / net / sourceforge / phpeclipse / xdebug / php / model / XDebugBooleanValue.java
1 package net.sourceforge.phpeclipse.xdebug.php.model;
2
3 import org.w3c.dom.Node;
4
5 public class XDebugBooleanValue extends XDebugAbstractValue {
6         public XDebugBooleanValue(XDebugStackFrame variable, Node value) {
7                 super(variable, value);
8         }
9         
10         public boolean supportsValueModification() {
11                 return true;
12         }
13
14         public void renderValueString(String data) {
15                 int value=-1;
16                 try {
17                         value=Integer.parseInt(data);
18                 } catch (NumberFormatException e) {
19                         data=data.toLowerCase();
20                         if (data.equals("true") || data.equals("false"))
21                                 fValueString=data;
22                         else
23                                 fValueString="not defined";
24                 }
25                 if (value==0) 
26                         fValueString="false";
27                 else if (value==1)
28                         fValueString="true";
29                 else
30                         fValueString="not defined";
31         }
32
33         public boolean verifyValue(String expression) {
34                 int value=-1;
35                 try {
36                         value=Integer.parseInt(expression);
37                 } catch (NumberFormatException e) {
38                         expression=expression.toLowerCase();
39                         if (expression.equals("true") || expression.equals("false"))
40                                 return true;
41                         else
42                                 return false;
43                 }
44                 if ((value>=0)&& (value <=1))
45                         return true;
46                 return false;
47         }
48 }