1 /* Created on 23.11.2004
3 * TODO To change the template for this generated file go to
4 * Window - Preferences - Java - Code Style - Code Templates
6 package net.sourceforge.phpeclipse.xdebug.php.model;
8 import java.util.Arrays;
9 import java.util.Iterator;
10 import java.util.Vector;
11 import net.sourceforge.phpeclipse.xdebug.core.PHPDebugUtils;
13 import org.eclipse.debug.core.DebugException;
14 import org.eclipse.debug.core.model.IValue;
15 import org.eclipse.debug.core.model.IVariable;
16 import org.w3c.dom.Node;
21 * TODO To change the template for this generated type comment go to
22 * Window - Preferences - Java - Code Style - Code Templates
25 public /*abstract*/ class XDebugAbstractValue extends XDebugElement implements IValue {
26 private String fValueString;
27 private String fTypeName;
28 private boolean fhasChanged;
29 protected String rowValue;
30 private boolean fSorted;
31 private Vector fVariables; // The children of this variable (other variables) if any
33 public XDebugAbstractValue(XDebugStackFrame frame, Node value) throws DebugException {
34 super(frame == null ? null : (XDebugTarget)frame.getDebugTarget());
36 fTypeName = PHPDebugUtils.getAttributeValue(value, "type");
38 fVariables = new Vector(); // Create an empty vector
44 rowValue = value.getFirstChild().getNodeValue();
45 } catch (NullPointerException e) {
50 public boolean hasChanged() {
54 public void setChanged(boolean changed) {
55 fhasChanged = changed;
62 public Vector addVariable(Vector item) {
63 if (item != null) { // If there is something we want to add
64 fVariables.addAll(item);
68 return this.fVariables;
75 public void setParent(XDebugVariable parent) {
76 if (!fVariables.isEmpty()) { // If we have child variables
77 Iterator iter = fVariables.iterator(); // Create an iterator for the children
79 while (iter.hasNext()) { // As long as we have children
80 ((XDebugVariable) iter.next()).setParent(parent); // Set all child's parent
86 * @see org.eclipse.debug.core.model.IValue#getReferenceTypeName()
88 public String getReferenceTypeName() throws DebugException {
93 * @see org.eclipse.debug.core.model.IValue#getValueString()
95 public String getValueString() throws DebugException {
100 * @see org.eclipse.debug.core.model.IValue#isAllocated()
102 public boolean isAllocated() throws DebugException {
107 * @see org.eclipse.debug.core.model.IValue#getVariables()
109 public IVariable[] getVariables() throws DebugException {
110 return (XDebugVariable[]) getChildVariables().toArray(
111 new XDebugVariable[fVariables.size()]);
117 public Vector getChildVariables() {
122 * @see org.eclipse.debug.core.model.IValue#hasVariables()
124 public boolean hasVariables() throws DebugException {
125 return (fVariables.size() != 0);
128 public boolean setValue(String expression) throws DebugException {
132 protected boolean verifyValue(String expression) {
136 protected boolean supportsValueModification() {
140 protected void setValueString(String valueString) {
141 fValueString = valueString;
144 protected void setChildren(IVariable[] newChildren) {
145 fVariables = new Vector (Arrays.asList(newChildren));