1960aa9d63190a4c8e6af1afdb2a7cb6d7de7736
[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.eclipse.debug.core.DebugException;
4 import org.w3c.dom.Node;
5
6 public class XDebugBooleanValue extends XDebugAbstractValue {
7         public XDebugBooleanValue(XDebugStackFrame variable, Node value) throws DebugException {
8                 super(variable, value);
9         }
10         
11         public boolean supportsValueModification() {
12                 return true;
13         }
14
15         public void renderValueString(String data) {
16                 int value=-1;
17                 try {
18                         value=Integer.parseInt(data);
19                 } catch (NumberFormatException e) {
20                         data=data.toLowerCase();
21                         if (data.equals("true") || data.equals("false"))
22                                 setValueString(data)/*fValueString=data*/;
23                         else
24                                 setValueString("not defined")/*fValueString="not defined"*/;
25                 }
26                 if (value==0) 
27                         setValueString("false")/*fValueString="false"*/;
28                 else if (value==1)
29                         setValueString("false")/*fValueString="true"*/;
30                 else
31                         setValueString("not defined")/*fValueString="not defined"*/;
32         }
33
34         public boolean verifyValue(String expression) {
35                 int value=-1;
36                 try {
37                         value=Integer.parseInt(expression);
38                 } catch (NumberFormatException e) {
39                         expression=expression.toLowerCase();
40                         if (expression.equals("true") || expression.equals("false"))
41                                 return true;
42                         else
43                                 return false;
44                 }
45                 if ((value>=0)&& (value <=1))
46                         return true;
47                 return false;
48         }
49 }