public class QueryObject extends Object implements Serializable, Cloneable, Comparable
| Modifier and Type | Field and Description |
|---|---|
Boolean |
aBoolean |
Byte |
aByte |
byte[] |
aByteArray |
Character |
aCharacter |
Double |
aDouble |
Float |
aFloat |
Long |
aLong |
Integer |
anInteger |
boolean |
aPrimitiveBoolean |
byte |
aPrimitiveByte |
char |
aPrimitiveChar |
double |
aPrimitiveDouble |
float |
aPrimitiveFloat |
int |
aPrimitiveInt |
long |
aPrimitiveLong |
short |
aPrimitiveShort |
QueryObject |
aQueryObject |
Short |
aShort |
String |
aString |
static int |
EQUAL_VALUES
All fields (except aByteArray, aQueryObject) have equal values
except when the values are out of range for the field type, for
example when a long value is out of range for a byte value.
|
Object |
extra |
long |
id |
static int |
INCREMENT
Increment fields
|
String |
myVersion |
static int |
NEGATE
Negate fields
|
static int |
NULL_NONPRIM_FIELDS
Null non-primitive fields
|
static int |
RANDOM_VALUES
The fields (except aByteArray, aQueryObject) have random values,
determined by util.RandomValue parameters.
|
static int |
SEQUENTIAL_VALUES
The fields (except aByteArray, aQueryObject) have sequential values.
|
| Constructor and Description |
|---|
QueryObject()
No-arg constructor.
|
QueryObject(long base,
int valueGeneration,
int byteArraySize,
int levels)
All the query fields are initialized using the given base value
and valueGeneration to determine the values of each field.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
Make a copy of the QueryObject and any QueryObjects referenced
by it, with a different id for all new QueryObjects.
|
int |
compareTo(Object anObj) |
String |
constantToString(int constant)
Return a string showing the given QueryObject constant.
|
int |
depth()
Return the depth of the QueryObject.
|
boolean |
equals(Object anObj)
Return true if the argument is equal to this QueryObject,
false otherwise.
|
protected void |
fieldsToString(StringBuffer aStr)
Append to the given StringBuffer the basic fields in this
QueryObject.
|
void |
fillInBaseValues(long base,
int valueGeneration,
int byteArraySize)
Init fields using base as appropriate, but does not
initialize aQueryObject field.
|
QueryObject |
getAtDepth(int depth)
Return the QueryObject at the given depth.
|
boolean |
hasEqualId(QueryObject anObj)
Return true if the two QueryObjects have the same id, false otherwise.
|
int |
hashCode()
Return whether this QueryObject is equal to the argument.
|
static void |
main(String[] args)
Test QueryObject methods
|
void |
modify(int changeValueGeneration,
int delta,
boolean log)
Modify the QueryObject according to changeValueGeneration and delta.
|
void |
modify(int depth,
int changeValueGeneration,
int delta,
boolean randomDepth,
boolean log)
Modifies the QueryObject at the given depth by changing its values
according to changeValueGeneration and delta.
|
QueryObject |
modifyWithNewInstance(int changeValueGeneration,
int delta,
boolean log)
Return a new instance of QueryObject.
|
QueryObject |
modifyWithNewInstance(int depth,
int changeValueGeneration,
int delta,
boolean randomDepth,
boolean log)
Creates new instance of the root QueryObject and modifies the values of
the QueryObject at the given depth by changing its values according to
changeValueGeneration and delta.
|
String |
toString()
Return a string representation of a QueryObject.
|
static String |
toString(List aList)
Return a String showing the given list of QueryObjects in
abbreviated form.
|
static String |
toString(Map aMap)
Return a String showing the given Map of QueryObjects in
abbreviated form.
|
String |
toStringAbbreviated()
Return an abbreviated string representation of a QueryObject.
|
static String |
toStringAbbreviated(List aList)
Return a String showing the given list of QueryObjects in an
abbreviated form.
|
static String |
toStringAbbreviated(Map aMap)
Return a String showing the given Map of QueryObjects in an
abbreviated form.
|
String |
toStringFull()
Return a full string representation of a QueryObject, included all levels.
|
static String |
toStringFull(List aList)
Return a String showing the given list of QueryObjects in
full form.
|
static String |
toStringFull(Map aMap)
Return a String showing the given Map of QueryObjects in
full form.
|
String |
toStringOneLevel()
Return a one-level string representation of a QueryObject without
printing out any nested QueryObjects.
|
public String myVersion
public long aPrimitiveLong
public Long aLong
public int aPrimitiveInt
public Integer anInteger
public short aPrimitiveShort
public Short aShort
public float aPrimitiveFloat
public Float aFloat
public double aPrimitiveDouble
public Double aDouble
public byte aPrimitiveByte
public Byte aByte
public char aPrimitiveChar
public Character aCharacter
public boolean aPrimitiveBoolean
public Boolean aBoolean
public String aString
public byte[] aByteArray
public QueryObject aQueryObject
public Object extra
public long id
public static final int EQUAL_VALUES
public static final int SEQUENTIAL_VALUES
public static final int RANDOM_VALUES
public static final int INCREMENT
public static final int NEGATE
public static final int NULL_NONPRIM_FIELDS
public QueryObject()
public QueryObject(long base,
int valueGeneration,
int byteArraySize,
int levels)
base - The base value for all fields. Fields are all set
to a value using base as appropriate. Unused if
valueGeneration is RANDOM_VALUES.valueGeneration - How to generate the values of the
fields. Can be one of
QueryObject.EQUAL_VALUES
QueryObject.SEQUENTIAL_VALUES
QueryObject.RANDOM_VALUESbyteArraySize - The size of byte[]. If < 0 then there is
no byteArray (it is null).levels - The number of levels of QueryObjects. 1 means
the field aQueryObject is null, 2 means aQueryObject
contains an instance of QueryObject with fields
initialized with base+1, the next level is initialized
with base+2 etc.public void fillInBaseValues(long base,
int valueGeneration,
int byteArraySize)
base - The base value for all fields. Fields are all set
to a value using base as appropriate.valueGeneration - How to generate the values of the
fields. Can be one of
QueryObject.EQUAL_VALUES
QueryObject.SEQUENTIAL_VALUES
QueryObject.RANDOM_VALUESbyteArraySize - The size of byte[].public int hashCode()
public boolean equals(Object anObj)
public Object clone() throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionpublic String toString()
public String toStringFull()
public String constantToString(int constant)
public static String toString(List aList)
aList - A List of QueryObjects.public static String toStringFull(List aList)
aList - A List of QueryObjects.public static String toStringAbbreviated(List aList)
aList - A List of QueryObjects.public static String toString(Map aMap)
aMap - A Map of QueryObjects as values.public static String toStringFull(Map aMap)
aMap - A Map of QueryObjects as values.public static String toStringAbbreviated(Map aMap)
aMap - A Map of QueryObjects as values.public String toStringAbbreviated()
public String toStringOneLevel()
protected void fieldsToString(StringBuffer aStr)
public void modify(int changeValueGeneration,
int delta,
boolean log)
changeValueGeneration - How to determine the new values
Can be one of:
QueryObject.INCREMENT
QueryObject.NEGATE
QueryObject.NULL_NONPRIM_FIELDS
If any fields are null and this is INCREMENT or NEGATE then
the field is filled in with a random value.delta - The number to increment or decrement; unused if
changeValueGeneration is QueryObject.NEGATE.log - If true, then log what is being modified, if false don't
log since output can be large.public QueryObject modifyWithNewInstance(int changeValueGeneration, int delta, boolean log)
changeValueGeneration - How to determine the values of new
instance. Can be one of :
QueryObject.INCREMENT
QueryObject.NEGATEdelta - The number to increment or decrement; unused if
changeValueGeneration is QueryObject.NEGATE.log - If true, then log what is being modified, if false don't
log since output can be large.public void modify(int depth,
int changeValueGeneration,
int delta,
boolean randomDepth,
boolean log)
depth - Level number of the QueryObject, to be used according
to other arguments.changeValueGeneration - How to determine the values of the
modified QueryObject. Can be one of :
QueryObject.INCREMENT
QueryObject.NEGATEdelta - The number to increment or decrement; unused if
changeValueGeneration is QueryObject.NEGATE.randomDepth - If true then modify a QueryObject at a randomly
chosen depth between 1 and depth, if false then modify the
QueryObject at the given depth.log - If true, then log what is being modified, if false don't
log since output can be large.public QueryObject modifyWithNewInstance(int depth, int changeValueGeneration, int delta, boolean randomDepth, boolean log)
changeValueGeneration - How to determine the values of the
modified QueryObject. Can be one of :
QueryObject.INCREMENT
QueryObject.NEGATEdelta - The number to increment or decrement; unused if
changeValueGeneration is QueryObject.NEGATE.randomDepth - If true then modify a QueryObject at a randomly
chosen depth between 1 and depth, if false then modify the
QueryObject at the given depth.log - If true, then log what is being modified, if false don't
log since output can be large.public int depth()
public QueryObject getAtDepth(int depth)
depth - The desired depth of the QueryObject.public boolean hasEqualId(QueryObject anObj)
public int compareTo(Object anObj)
compareTo in interface ComparableCopyright © 2010-2015 Pivotal Software, Inc. All rights reserved.