|
|||||||||
| Home >> All >> edu >> ucsb >> ccs >> jaqual >> [ standard overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
edu.ucsb.ccs.jaqual.standard
Class Equal

java.lang.Objectedu.ucsb.ccs.jaqual.standard.Equal
- All Implemented Interfaces:
- edu.ucsb.ccs.jaqual.Assertion
- public class Equal
- extends java.lang.Object
- implements edu.ucsb.ccs.jaqual.Assertion
- extends java.lang.Object
An assertion to test for equality. Supports comparison by reference and value, and comparison of floating point numbers.
Example use:
Exists.in(elements).suchThat(new Equal(5));
- Version:
- $Id: Equal.java,v 1.3 2002/07/13 09:06:30 parkera Exp $
| Field Summary | |
static int |
CONTENT
Constant for comparison by value. |
protected int |
mode
The comparison mode, either CONTENT or REFERENCE. |
static int |
REFERENCE
Constant for comparison by reference. |
protected double |
tolerance
The tolerance to use when comparing floating point numbers. |
protected java.lang.Object |
value
The value to compare things with. |
| Constructor Summary | |
Equal(byte value)
Create an assertion to compare bytes. |
|
Equal(char value)
Create an assertion to compare characters. |
|
Equal(double value)
Create an assertion to compare double precision numbers, using Double.MIN_VALUE as the tolerance. |
|
Equal(double value,
double tolerance)
Create an assertion to compare double precision numbers. |
|
Equal(float value)
Create an assertion to compare floating point numbers, using Float.MIN_VALUE as the tolerance. |
|
Equal(float value,
double tolerance)
Create an assertion to compare floating point numbers. |
|
Equal(int value)
Create an assertion to compare integers. |
|
Equal(long value)
Create an assertion to compare longs. |
|
Equal(java.lang.Object value)
Create an assertion to compare Objects by content. |
|
Equal(java.lang.Object value,
int mode)
Create an assertion to compare Objects. |
|
Equal(short value)
Create an assertion to compare shorts. |
|
| Method Summary | |
protected boolean |
_Invariant()
|
protected int |
compare(double val1,
double val2)
Compare two floating point numbers. |
boolean |
eval(java.lang.Object o)
Test an object to see if it is equal to the target value. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
CONTENT
public static final int CONTENT
- Constant for comparison by value. In this mode, objects are
compared by their value (a.equals(b)), rather than by reference
(a == b).
- See Also:
- Constant Field Values
REFERENCE
public static final int REFERENCE
- Constant for comparison by reference. In this mode, objects are
compared by location in memory (a == b), rather than by value
(a.equals(b)).
- See Also:
- Constant Field Values
value
protected java.lang.Object value
- The value to compare things with.
mode
protected int mode
- The comparison mode, either CONTENT or REFERENCE.
tolerance
protected double tolerance
- The tolerance to use when comparing floating point numbers.
| Constructor Detail |
Equal
public Equal(java.lang.Object value)
- Create an assertion to compare Objects by content.
Equal
public Equal(java.lang.Object value, int mode)
- Create an assertion to compare Objects.
Equal
public Equal(int value)
- Create an assertion to compare integers.
Equal
public Equal(long value)
- Create an assertion to compare longs.
Equal
public Equal(short value)
- Create an assertion to compare shorts.
Equal
public Equal(byte value)
- Create an assertion to compare bytes.
Equal
public Equal(char value)
- Create an assertion to compare characters.
Equal
public Equal(float value)
- Create an assertion to compare floating point numbers, using
Float.MIN_VALUE as the tolerance.
Equal
public Equal(float value,
double tolerance)
- Create an assertion to compare floating point numbers.
Equal
public Equal(double value)
- Create an assertion to compare double precision numbers, using
Double.MIN_VALUE as the tolerance.
Equal
public Equal(double value,
double tolerance)
- Create an assertion to compare double precision numbers.
| Method Detail |
eval
public boolean eval(java.lang.Object o)
- Test an object to see if it is equal to the target value.
- Specified by:
evalin interfaceedu.ucsb.ccs.jaqual.Assertion
compare
protected int compare(double val1,
double val2)
- Compare two floating point numbers.
_Invariant
protected boolean _Invariant()
|
|||||||||
| Home >> All >> edu >> ucsb >> ccs >> jaqual >> [ standard overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
edu.ucsb.ccs.jaqual.standard.Equal