com.bluemarsh.jswat.breakpoint
Class ValueCondition

java.lang.Object
  |
  +--com.bluemarsh.jswat.breakpoint.ValueCondition
All Implemented Interfaces:
Condition, java.io.Serializable

public class ValueCondition
extends java.lang.Object
implements Condition

Class ValueCondition implements a breakpoint conditional that is satisfied when a field or local variable is equal to a particular value.

Author:
Nathan Fiedler
See Also:
Serialized Form

Field Summary
protected  java.lang.String valueString
          Original value to compare against, as a String.
protected  java.lang.String variableName
          Name of the variable to examine.
 
Constructor Summary
ValueCondition(java.lang.String expr)
          Constructs a ValueCondition that is satisfied when the given expression is satisfied.
ValueCondition(java.lang.String expr, java.lang.String value)
          Constructs a ValueCondition that is satisfied when the named variable equals the given value.
 
Method Summary
 ConditionUI getUIAdapter()
          Returns the user interface widget for customizing this condition.
 java.lang.String getValueString()
          Retrieves the value this condition tests for.
 java.lang.String getVariableName()
          Retrieves the variable name of this condition.
 boolean isSatisfied(com.sun.jdi.event.Event event)
          Returns true if this condition is satisfied.
 void setValueString(java.lang.String value)
          Sets the value this condition tests for.
 void setVariableName(java.lang.String name)
          Sets the variable name of this condition.
 java.lang.String toString()
          Returns a string representation of this.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

variableName

protected java.lang.String variableName
Name of the variable to examine.

valueString

protected java.lang.String valueString
Original value to compare against, as a String.
Constructor Detail

ValueCondition

public ValueCondition(java.lang.String expr,
                      java.lang.String value)
Constructs a ValueCondition that is satisfied when the named variable equals the given value.
Parameters:
expr - variable name expression (e.g. "this.counter").
value - value to compare against.

ValueCondition

public ValueCondition(java.lang.String expr)
Constructs a ValueCondition that is satisfied when the given expression is satisfied. The expression is of the form: variable = value where 'variable' is the name of a variable and 'value' is string, character, boolean, or number.
Parameters:
expr - variable name, equals sign, and value. The expression may contain escaped equals signs, which will be ignored.
Throws:
IllegalArugmentException - if expression lacks the equals sign (=).
Method Detail

getValueString

public java.lang.String getValueString()
Retrieves the value this condition tests for.
Returns:
value this condition tests for.

getVariableName

public java.lang.String getVariableName()
Retrieves the variable name of this condition.
Returns:
name of variable this condition tests.

getUIAdapter

public ConditionUI getUIAdapter()
Returns the user interface widget for customizing this condition.
Specified by:
getUIAdapter in interface Condition
Returns:
Condition user interface adapter.

isSatisfied

public boolean isSatisfied(com.sun.jdi.event.Event event)
Returns true if this condition is satisfied.
Specified by:
isSatisfied in interface Condition
Parameters:
event - JDI Event that brought us here.
Returns:
True if satisfied, false otherwise.

setValueString

public void setValueString(java.lang.String value)
Sets the value this condition tests for.
Parameters:
value - new value to test for.

setVariableName

public void setVariableName(java.lang.String name)
Sets the variable name of this condition.
Parameters:
name - new name of variable to test.

toString

public java.lang.String toString()
Returns a string representation of this.
Overrides:
toString in class java.lang.Object
Returns:
String representing this.