Grid

open class Grid<P : Position<P>> @JvmOverloads constructor(environment: Environment<*, P>, randomGenerator: RandomGenerator, xStart: Double, yStart: Double, xEnd: Double, yEnd: Double, xStep: Double, yStep: Double, xRand: Double = 0.0, yRand: Double = 0.0, xShift: Double = 0.0, yShift: Double = 0.0) : Deployment<P>

A (possibly randomized) grid of nodes.

Parameters

environment
        the {@link Environment}
randomGenerator
        the {@link RandomGenerator}
xStart
        the start x position
yStart
        the start y position
xEnd
        the end x position
yEnd
        the end y position
xStep
        how distant on the x axis (on average) nodes should be
yStep
        how distant on the y axis (on average) nodes should be
xRand
        how randomized should be positions along the x axis
yRand
        how randomized should be positions along the y axis
xShift
        how shifted should be positions between lines
yShift
        how shifted should be positions along columns

Constructors

Link copied to clipboard
constructor(environment: Environment<*, P>, randomGenerator: RandomGenerator, xStart: Double, yStart: Double, xEnd: Double, yEnd: Double, xStep: Double, yStep: Double, xRand: Double = 0.0, yRand: Double = 0.0, xShift: Double = 0.0, yShift: Double = 0.0)

Functions

Link copied to clipboard

Returns the optional NetworkModel associated to the deployment, or null if there is none.

Link copied to clipboard
open operator override fun iterator(): Iterator<P>
Link copied to clipboard
fun <R> Iterable<R>.randomElement(randomGenerator: RandomGenerator): R

Returns a random element of the Iterable using the provided randomGenerator.

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

Fisher–Yates shuffle algorithm using a RandomGenerator. More information on Wikipedia.

Link copied to clipboard
open override fun stream(): Stream<P>

Returns a Stream over the positions of this Deployment.