randoop
Class ObjectCheck

Object
  extended by ObjectCheck
All Implemented Interfaces:
Serializable, Check

public class ObjectCheck
extends Object
implements Check

A check that checks for expected properties of one or more objects generated during the execution of a Sequence, for example:

An ObjectCheck has two parts:

See Also:
Serialized Form

Field Summary
Modifier and Type Field and Description
 ObjectContract contract
           
 int stmt_no
           
 Variable[] vars
           
 
Constructor Summary
Constructor and Description
ObjectCheck(ObjectContract cc, int stmt_no, Variable... vars)
           
 
Method Summary
Modifier and Type Method and Description
 boolean equals(Object o)
           
 boolean evaluate(Execution execution)
          Evaluates this check on the given unfolding execution of a sequence, returning true if the check succeeded, and false otherwise.
 String get_id()
          Returns a unique string identifier for the check.
 int get_stmt_no()
          Returns the offset in the sequence of this check
 String get_value()
          For checks involving a primitive-lie value (primitive, String or null) returns a string representation of the value.
 int hashCode()
           
 String toCodeStringPostStatement()
          Returns a string of Java source code to be emitted after a statement containing this check.
 String toCodeStringPreStatement()
          Returns a string of Java source code to be emitted before a statement containing this check.
 String toString()
           
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

contract

public final ObjectContract contract

vars

public final Variable[] vars

stmt_no

public final int stmt_no
Constructor Detail

ObjectCheck

public ObjectCheck(ObjectContract cc,
                   int stmt_no,
                   Variable... vars)
Method Detail

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

toCodeStringPreStatement

public String toCodeStringPreStatement()
Description copied from interface: Check
Returns a string of Java source code to be emitted before a statement containing this check.

Specified by:
toCodeStringPreStatement in interface Check

toCodeStringPostStatement

public String toCodeStringPostStatement()
Description copied from interface: Check
Returns a string of Java source code to be emitted after a statement containing this check.

Specified by:
toCodeStringPostStatement in interface Check

get_value

public String get_value()
For checks involving a primitive-lie value (primitive, String or null) returns a string representation of the value. Otherwise returns the name of the contract class.

Specified by:
get_value in interface Check

evaluate

public boolean evaluate(Execution execution)
Description copied from interface: Check
Evaluates this check on the given unfolding execution of a sequence, returning true if the check succeeded, and false otherwise.

Specified by:
evaluate in interface Check

get_stmt_no

public int get_stmt_no()
Description copied from interface: Check
Returns the offset in the sequence of this check

Specified by:
get_stmt_no in interface Check

get_id

public String get_id()
Description copied from interface: Check
Returns a unique string identifier for the check. Two checks are the same if these identifers match. The value is NOT included. with. Used to match up checks between the same sequence run at different times. Note that because of changes in the environment (eg, static variables), two executions of the same sequence may have different checks (because the existence of some checks depends on the value of variables)

Specified by:
get_id in interface Check