Package it.unibo.alchemist

Types

Link copied to clipboard
object BugReporting

Entrypoint for printing meaningful debug information in case of failed internal consistency checks.

Link copied to clipboard
object ClassPathScanner

An utility class providing support for loading arbitrary subclasses available in the classpath.

Link copied to clipboard
class SupportedIncarnations
This enum interfaces the generic components of the graphical interface with the specific incarnation details.

Functions

Link copied to clipboard
fun <T : Comparable<T>> ClosedRange<T>.coincidesWith(other: ClosedRange<T>): Boolean

Checks whether two ranges coincide. It's a different way of checking if they're equals, which doesn't depend on their actual implementation. Note that the way you obtain a range may influence the actual class used, and you can have two coincident ranges which don't result equals because of different classes.

Link copied to clipboard
fun <T : Comparable<T>> ClosedRange<T>.contains(other: ClosedRange<T>): Boolean

Checks whether the range contains the other one. This method is faster than checking if the range contains both of the endpoints of other.

Link copied to clipboard
fun <V : Vector2D<V>> List<V>.findExtremeCoordsOnX(): ClosedRange<Double>

Given a non empty list of points represented as vectors, this method finds the extreme coordinates (i.e. min and max coordinates) on the X-axis, these are used to create the returned ClosedRange.

Link copied to clipboard
fun <V : Vector2D<V>> List<V>.findExtremeCoordsOnY(): ClosedRange<Double>

Given a non empty list of points represented as vectors, this method finds the extreme coordinates (i.e. min and max coordinates) on the Y-axis, these are used to create the returned ClosedRange.

Link copied to clipboard
infix fun Double.fuzzyIn(range: ClosedRange<Double>): Boolean

Checks if a double value is fuzzy contained in a range.

Link copied to clipboard
fun <T : Comparable<T>> ClosedRange<T>.intersect(other: ClosedRange<T>): ClosedRange<T>?

Finds the intersection between two ranges, the resulting range may feature a single value (if the ranges only share an endpoint) or can be null, if they don't intersect at all.

Link copied to clipboard
fun <T : Comparable<T>> ClosedRange<T>.intersects(other: ClosedRange<T>): Boolean

Checks whether the range intersects the other one.

Link copied to clipboard
fun <T : Comparable<T>> ClosedRange<T>.intersectsBoundsExcluded(other: ClosedRange<T>): Boolean

Checks whether two ranges intersect, excluding their bounds (i.e., excluding both ClosedRange.start and ClosedRange.endInclusive). This means false is returned in case the ranges share a single endpoint.

Link copied to clipboard
infix operator fun <T : Comparable<T>> ClosedRange<T>.minus(other: ClosedRange<T>): List<ClosedRange<T>>

Performs a subtraction between ranges. The operation can produce an empty list (e.g. if the current range is contained in the other one), a list featuring a single element, or a list featuring two elements (e.g. if the current range contains the other one).

Link copied to clipboard
fun <T> murmur3Hash32(vararg data: T): Int

Hashes a number of Anys with Hashing.murmur3_32. The charset used for strings is Charsets.UTF_16. For Iterable and Sequence, the elements are hashed rather than the Iterable or Sequence itself. If the Iterable or Sequence contains a null element, it is skipped.

Link copied to clipboard
fun RandomGenerator.nextDouble(from: Double, to: Double): Double

Generate a random double between the given bounds.

Link copied to clipboard
fun <T : Comparable<T>> rangeFromUnordered(bound1: T, bound2: T): ClosedRange<T>

Creates a ClosedRange from a couple of unordered values.

Link copied to clipboard
fun runOnFXThread(task: () -> Unit)

Checks if the current thread is the FX Application thread and calls runLater if so, otherwise runs the task.

Link copied to clipboard
fun <R> Iterable<R>.shuffled(rg: RandomGenerator): Iterable<R>

Fisher–Yates shuffle algorithm using Apache random number generator. More information on Wikipedia.

Link copied to clipboard
fun <T : Comparable<T>> ClosedRange<T>.subtractAll(others: List<ClosedRange<T>>): List<ClosedRange<T>>

Subtracts all the given ranges from the current one. See ClosedRange.minus.

Link copied to clipboard
fun <T : Any> syncRunLater(task: () -> T): T

Runs the given task on the FX thread and waits for the task to finish, returning any value the task returns. Throws an exception if the task takes more than a given amount of milliseconds.

Link copied to clipboard
fun <T : Any> syncRunOnFXThread(task: () -> T): T

Checks if the current thread is the FX Application thread and calls syncRunLater if so, otherwise runs the task.

Link copied to clipboard
inline fun <T, P : Position<P>> T.toPosition(environment: Environment<T, P>): P

Tries to convert a concentration T into a valid position of type P descriptor. Types are bound to the environment types.

Link copied to clipboard
fun <E> E.unfold(extractor: (E) -> Sequence<E>): Sequence<E>

The opposite of fold.