Sorted

com.phasmidsoftware.sort.Sorted
See theSorted companion class
object Sorted

Attributes

Companion
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Sorted.type

Members list

Value members

Concrete methods

def create[T : Ordering : ClassTag](ts: Seq[T]): Sorted[T]

Method to create a Sorted(ts). The result can then be sorted using sort, async, parSort, apply (sorted).

Method to create a Sorted(ts). The result can then be sorted using sort, async, parSort, apply (sorted).

Type parameters

T

the type of the elements of ts (provides a given Ordering[T]).

Value parameters

ts

a sequence of T values.

Attributes

Returns

an instance of Sorted.

def merge[T : Ordering](ts1: Seq[T], ts2: Seq[T]): Seq[T]

Method to merge the sorted sequences ts1 and ts2. NOTE: could be private but we cannot test it directly then (because it has a second parameter set).

Method to merge the sorted sequences ts1 and ts2. NOTE: could be private but we cannot test it directly then (because it has a second parameter set).

Type parameters

T

the underlying type to be sorted on, providing a given Ordering[T].

Value parameters

ts1

a sorted sequence of T values to be merged.

ts2

a sorted sequence of T values to be merged.

Attributes

Returns

a sorted sequence of T.

def mergeSort[T](ts: Seq[T], threads: Int = ...)(using evidence$1: Ordering[T], evidence$2: ClassTag[T], ExecutionContext): Future[Seq[T]]

Invoke parSort on two equal partitions of ts. TODO: implement parallel merge sort properly.

Invoke parSort on two equal partitions of ts. TODO: implement parallel merge sort properly.

Type parameters

T

the underlying type to be sorted on, providing a given Ordering[T].

Value parameters

threads

the number of threads (defaults to TotalThreads).

ts

the sequence of T values to be sorted.

Attributes

Returns

a sorted sequence of T, wrapped in Future.

def parSort[T](tst: (Seq[T], Seq[T]))(using evidence$1: Ordering[T], ExecutionContext): Future[Seq[T]]

Perform sort in exactly two parallel processes, each using the system sort, based on the given Ordering[T].

Perform sort in exactly two parallel processes, each using the system sort, based on the given Ordering[T].

Type parameters

T

the underlying type to be sorted on, providing a given Ordering[T].

Value parameters

tst

a tuple of two Seq[T].

Attributes

Returns

a sorted sequence of T, wrapped in Future.

def verify[T : Comparer](ts: Seq[T]): Boolean

Verify that the sequence ts is in fact in ascending order.

Verify that the sequence ts is in fact in ascending order.

Type parameters

T

the type of the elements of ts.

Value parameters

ts

the sequence of T values.

Attributes

Returns

true if all consecutive pairs of elements are in the correct order.

Concrete fields

val TotalThreads: Int

The default number of threads for mergeSort.

The default number of threads for mergeSort.

Attributes