public class QueryObject
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable, java.lang.Comparable
| Modifier and Type | Field and Description |
|---|---|
java.lang.Boolean |
aBoolean |
java.lang.Byte |
aByte |
byte[] |
aByteArray |
java.lang.Character |
aCharacter |
java.lang.Double |
aDouble |
java.lang.Float |
aFloat |
java.lang.Long |
aLong |
java.lang.Integer |
anInteger |
boolean |
aPrimitiveBoolean |
byte |
aPrimitiveByte |
char |
aPrimitiveChar |
double |
aPrimitiveDouble |
float |
aPrimitiveFloat |
int |
aPrimitiveInt |
long |
aPrimitiveLong |
short |
aPrimitiveShort |
QueryObject |
aQueryObject |
java.lang.Short |
aShort |
java.lang.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.
|
java.lang.Object |
extra |
long |
id |
static int |
INCREMENT
Increment fields
|
java.lang.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 |
|---|---|
java.lang.Object |
clone()
Make a copy of the QueryObject and any QueryObjects referenced
by it, with a different id for all new QueryObjects.
|
int |
compareTo(java.lang.Object anObj) |
java.lang.String |
constantToString(int constant)
Return a string showing the given QueryObject constant.
|
int |
depth()
Return the depth of the QueryObject.
|
boolean |
equals(java.lang.Object anObj)
Return true if the argument is equal to this QueryObject,
false otherwise.
|
protected void |
fieldsToString(java.lang.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(java.lang.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.
|
java.lang.String |
toString()
Return a string representation of a QueryObject.
|
static java.lang.String |
toString(java.util.List aList)
Return a String showing the given list of QueryObjects in
abbreviated form.
|
static java.lang.String |
toString(java.util.Map aMap)
Return a String showing the given Map of QueryObjects in
abbreviated form.
|
java.lang.String |
toStringAbbreviated()
Return an abbreviated string representation of a QueryObject.
|
static java.lang.String |
toStringAbbreviated(java.util.List aList)
Return a String showing the given list of QueryObjects in an
abbreviated form.
|
static java.lang.String |
toStringAbbreviated(java.util.Map aMap)
Return a String showing the given Map of QueryObjects in an
abbreviated form.
|
java.lang.String |
toStringFull()
Return a full string representation of a QueryObject, included all levels.
|
static java.lang.String |
toStringFull(java.util.List aList)
Return a String showing the given list of QueryObjects in
full form.
|
static java.lang.String |
toStringFull(java.util.Map aMap)
Return a String showing the given Map of QueryObjects in
full form.
|
java.lang.String |
toStringOneLevel()
Return a one-level string representation of a QueryObject without
printing out any nested QueryObjects.
|
public java.lang.String myVersion
public long aPrimitiveLong
public java.lang.Long aLong
public int aPrimitiveInt
public java.lang.Integer anInteger
public short aPrimitiveShort
public java.lang.Short aShort
public float aPrimitiveFloat
public java.lang.Float aFloat
public double aPrimitiveDouble
public java.lang.Double aDouble
public byte aPrimitiveByte
public java.lang.Byte aByte
public char aPrimitiveChar
public java.lang.Character aCharacter
public boolean aPrimitiveBoolean
public java.lang.Boolean aBoolean
public java.lang.String aString
public byte[] aByteArray
public QueryObject aQueryObject
public java.lang.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()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object anObj)
equals in class java.lang.Objectpublic java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toStringFull()
public java.lang.String constantToString(int constant)
public static java.lang.String toString(java.util.List aList)
aList - A List of QueryObjects.public static java.lang.String toStringFull(java.util.List aList)
aList - A List of QueryObjects.public static java.lang.String toStringAbbreviated(java.util.List aList)
aList - A List of QueryObjects.public static java.lang.String toString(java.util.Map aMap)
aMap - A Map of QueryObjects as values.public static java.lang.String toStringFull(java.util.Map aMap)
aMap - A Map of QueryObjects as values.public static java.lang.String toStringAbbreviated(java.util.Map aMap)
aMap - A Map of QueryObjects as values.public java.lang.String toStringAbbreviated()
public java.lang.String toStringOneLevel()
protected void fieldsToString(java.lang.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(java.lang.Object anObj)
compareTo in interface java.lang.Comparablepublic static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.ExceptionCopyright © 2010-2015 Pivotal Software, Inc. All rights reserved.