Construct a the first Ordinal
for a run.
Construct a the first Ordinal
for a run.
a number that identifies a particular run
o != arg0
is the same as !(o == (arg0))
.
o != arg0
is the same as !(o == (arg0))
.
the object to compare against this object for dis-equality.
false
if the receiver object is equivalent to the argument; true
otherwise.
o == arg0
is the same as if (o eq null) arg0 eq null else o.equals(arg0)
.
o == arg0
is the same as if (o eq null) arg0 eq null else o.equals(arg0)
.
the object to compare against this object for equality.
true
if the receiver object is equivalent to the argument; false
otherwise.
o == arg0
is the same as o.equals(arg0)
.
o == arg0
is the same as o.equals(arg0)
.
the object to compare against this object for equality.
true
if the receiver object is equivalent to the argument; false
otherwise.
This method is used to cast the receiver object to be of type T0
.
This method is used to cast the receiver object to be of type T0
.
Note that the success of a cast at runtime is modulo Scala's erasure semantics. Therefore the expression1.asInstanceOf[String]
will throw a ClassCastException
at runtime, while the expressionList(1).asInstanceOf[List[String]]
will not. In the latter example, because the type argument is erased as
part of compilation it is not possible to check whether the contents of the list are of the requested typed.
the receiver object.
This method creates and returns a copy of the receiver object.
This method creates and returns a copy of the receiver object.
The default implementation of the clone
method is platform dependent.
a copy of the receiver object.
Compares this Ordinal
with the passed Ordinal
for order.
Compares this Ordinal
with the passed Ordinal
for order. If this object is "less than" (ordered before)
the passed object, compare
will return a negative integer. If this class is "greater than" (ordered after)
the passed object, compare
will return a positive integer. Otherwise, this Ordinal
is equal to
the passed object, and compare
will return 0.
a negative integer, 0, or positive integer indicating this Ordinal
is less than, equal to, or greater than the passed Ordinal
.
This method is used to test whether the argument (arg0
) is a reference to the
receiver object (this
).
This method is used to test whether the argument (arg0
) is a reference to the
receiver object (this
).
The eq
method implements an [http://en.wikipedia.org/wiki/Equivalence_relation equivalence relation] on
non-null instances of AnyRef
:
* It is reflexive: for any non-null instance x
of type AnyRef
, x.eq(x)
returns true
.
* It is symmetric: for any non-null instances x
and y
of type AnyRef
, x.eq(y)
returns true
if and
only if y.eq(x)
returns true
.
* It is transitive: for any non-null instances x
, y
, and z
of type AnyRef
if x.eq(y)
returns true
and y.eq(z)
returns true
, then x.eq(z)
returns true
.
Additionally, the eq
method has three other properties.
* It is consistent: for any non-null instances x
and y
of type AnyRef
, multiple invocations of
x.eq(y)
consistently returns true
or consistently returns false
.
* For any non-null instance x
of type AnyRef
, x.eq(null)
and null.eq(x)
returns false
.
* null.eq(null)
returns true
.
When overriding the equals
or hashCode
methods, it is important to ensure that their behavior is
consistent with reference equality. Therefore, if two objects are references to each other (o1 eq o2
), they
should be equal to each other (o1 == o2
) and they should hash to the same value (o1.hashCode == o2.hashCode
).
the object to compare against this object for reference equality.
true
if the argument is a reference to the receiver object; false
otherwise.
Indicates whether the passed object is equal to this one.
Indicates whether the passed object is equal to this one.
true if the passed object is equal to this one
This method is called by the garbage collector on the receiver object when garbage collection determines that there are no more references to the object.
This method is called by the garbage collector on the receiver object when garbage collection determines that there are no more references to the object.
The details of when and if the finalize
method are invoked, as well as the interaction between finalize
and non-local returns and exceptions, are all platform dependent.
Returns a representation that corresponds to the dynamic class of the receiver object.
Returns a representation that corresponds to the dynamic class of the receiver object.
The nature of the representation is platform dependent.
a representation that corresponds to the dynamic class of the receiver object.
Returns a hash code value for this object.
Returns a hash code value for this object.
a hash code for this object
This method is used to test whether the dynamic type of the receiver object is T0
.
This method is used to test whether the dynamic type of the receiver object is T0
.
Note that the test result of the test is modulo Scala's erasure semantics. Therefore the expression1.isInstanceOf[String]
will return false
, while the expression List(1).isInstanceOf[List[String]]
will
return true
. In the latter example, because the type argument is erased as part of compilation it is not
possible to check whether the contents of the list are of the requested typed.
true
if the receiver object is an instance of erasure of type T0
; false
otherwise.
o.ne(arg0)
is the same as !(o.eq(arg0))
.
o.ne(arg0)
is the same as !(o.eq(arg0))
.
the object to compare against this object for reference dis-equality.
false
if the argument is not a reference to the receiver object; true
otherwise.
Construct the next Ordinal
for the current suite or other entity, such as a runner.
Construct the next Ordinal
for the current suite or other entity, such as a runner.
Construct two new Ordinal
s, one for a new Suite
about to be executed and
one for the current Suite
or other entity, such as a runner.
Construct two new Ordinal
s, one for a new Suite
about to be executed and
one for the current Suite
or other entity, such as a runner. The Ordinal
for the new Suite
is the first (_1
) element in the tuple:
val (nextOrdinalForNewSuite, nextOrdinalForThisSuite) currentOrdinal.nextNewOldPair
The reason the next Ordinal
for the new Suite
is first is because it will
be ordered before the next Ordinal
for the current Suite
(or other
entity such as a runner). In fact, any event reported within the context of the new Suite
or
its nested Suite
s will be ordered before the next Ordinal
for the current Suite
.
a tuple whose first element is the first Ordinal
for the new Suite
and whose
second element is the next Ordinal
for the current Suite
or other entity, such
as a runner.
Wakes up a single thread that is waiting on the receiver object's monitor.
Wakes up a single thread that is waiting on the receiver object's monitor.
Wakes up all threads that are waiting on the receiver object's monitor.
Wakes up all threads that are waiting on the receiver object's monitor.
Returns a List[Int]
representation of this Ordinal
.
Returns a List[Int]
representation of this Ordinal
. A set of Ordinal
s will be ordered
in the same order as the set of List[Int]
s that are returned by invoking this method on each of the Ordinal
s.
The first element of the returned List[Int]
is the runStamp
.
a List[Int]
representation of this Ordinal
.
Returns a string representation of the object.
Returns a string representation of the object.
The default representation is platform dependent.
a string representation of the object.
Class used to specify a sequential order for events reported during a test run, so they can be arranged in that order in a report even if the events were fired in some other order during concurrent or distributed execution.
An
Ordinal
is an immutable object holding a run stamp and a sequence of stamps. The run stamp is an integer that identifies a particular run. All events reported during the same run should share the same run stamp. By contrast, each event reported during a particular run should have a different stamps sequence. One use case for the run stamp is that the initial run from ScalaTest's GUI will have run stamp 0. Subsequent reruns will have run stamps 1, 2, 3, etc., so that reports in the GUI can simply be sorted in "ordinal" order. Another use case is a set of servers used to run multiple tests simultaneously in a distributed fashion. The run stamp can be used to identify the run for which an event belongs.The stamps sequence is designed to allow a sequential order of events to be specified during concurrent execution of ScalaTest suites. ScalaTest's model for concurrent execution is that the suites that make up a run may be executed concurrently, but the tests within a single suite will be executed sequentially. In addition to tests, suites may contain nested suites. The default implementation of
execute
in classSuite
will first invokerunNestedSuites
and thenrunTests
. If noDistributor
is passed toexecute
, therunNestedSuites
method will execute the nested suites sequentially via the same thread that invokedrunNestedSuites
. As a result, suites will by default executed in depth first order when executed sequentially. If aDistributor
is passed toexecute
, therunNestedSuites
method will simply put its nested suites into theDistributor
and return. Some other threads or processes must then execute those nested suites. Given the default implementations ofexecute
andrunNestedSuites
described here, theOrdinal
will allow the events from a concurrent run to be sorted in the same depth-first order that the events from a corresponding sequential run would arrive.Each event reported during a run should be given a unique
Ordinal
. AnOrdinal
is required by allEvent
subclasses, instances of which are used to send information to thereport
function passed to aSuite
'sexecute
method. The firstOrdinal
for a run can be produced be passing a run stamp toOrdinal
's lone public constructor:The run stamp can be any integer. The
Ordinal
created in this way can be passed along with the first reported event of the run, such as aRunStarting
event. Thereafter, newOrdinal
s for the same run can be obtained by calling eithernext
ornextNewOldPair
on the previously obtainedOrdinal
. In other words, given anOrdinal
, you can obtain the nextOrdinal
by invoking one of these two "next" methods on theOrdinal
you have in hand. Before executing a newSuite
, thenextNewOldPair
method should be invoked. This will return two newOrdinal
s, one for the newSuite
about to be executed, and one for the currently executing entity (either aSuite
or some sort of test runner). At any other time, the nextOrdinal
can be obtained by simply invokingnext
on the currentOrdinal
.You can convert an
Ordinal
to aList
by invokingtoList
on it. The resultingList
will contain the run stamp as its first element, and the contents of its stamps sequence as the subsequent elements. The stamps sequence will initially be composed of a single element with the value 0. Thus,toList
invoked on thefirstOrdinal
shown above will result in:Each time
next
is invoked, the rightmost integer returned bytoList
will increment:When
nextNewOldPair
is invoked the result will be a tuple whose first element is the firstOrdinal
for the newSuite
about to be executed (for example, a nestedSuite
of the currently executingSuite
). The second element is the nextOrdinal
for the currently executingSuite
or other entity:The
toList
method of theOrdinal
for the new suite starts with the same sequence of elements as theOrdinal
from which it was created, but has one more element, a 0, appended at the end. Subsequent invocations ofnext
on this series ofOrdinal
s will increment that last element:This behavior allows events fired by
Suite
running concurrently to be reordered in a pre-determined sequence after all the events have been reported. The ordering of twoOrdinal
s can be determined by first comparing the first element of theList
s obtained by invokingtoList
on bothOrdinal
s. These values represent therunStamp
. If one run stamp is a lower number than the other, thatOrdinal
comes first. For example, anOrdinal
with a run stamp of 98 is ordered before anOrdinal
with a run stamp of 99. If the run stamps are equal, the next number in the list is inspected. As with the run stamps, anOrdinal
with a lower number is ordered before anOrdinal
with a higher number. If two corresponding elements are equal, the next pair of elements will be inspected. This will continue no down the length of theList
s until a position is found where the element values are not equal, or the end of one or both of theList
s are reached. If the twoList
s are identical all the way to the end, and bothList
s have the same lengths, then theOrdinal
s are equal. (EqualOrdinal
s will not happen if correctly used by creating a newOrdinal
for each fired event and each newSuite
.). If the twoList
s are identical all the way to the end of one, but the otherList
is longer (has more elements), then the shorter list is ordered before the longer one.As an example, here are some
Ordinal
List
forms in order:authors:
Bill Venners