v0.12
This commit is contained in:
@@ -12,7 +12,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("me.alex_s168:blitz:0.11")
|
implementation("me.alex_s168:blitz:0.12")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "me.alex_s168"
|
group = "me.alex_s168"
|
||||||
version = "0.11"
|
version = "0.12"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
@@ -1,7 +1,5 @@
|
|||||||
package blitz.async
|
package blitz.async
|
||||||
|
|
||||||
import kotlin.random.Random
|
|
||||||
|
|
||||||
// TODO: use coroutines?
|
// TODO: use coroutines?
|
||||||
fun <R> async(fn: () -> R): Future<R> {
|
fun <R> async(fn: () -> R): Future<R> {
|
||||||
lateinit var future: ThreadWaitingFuture<R>
|
lateinit var future: ThreadWaitingFuture<R>
|
||||||
|
@@ -4,7 +4,7 @@ import kotlin.math.max
|
|||||||
|
|
||||||
object Search {
|
object Search {
|
||||||
/**
|
/**
|
||||||
* Find a element by comparing.
|
* Find an element by comparing.
|
||||||
* Only works on sorted lists
|
* Only works on sorted lists
|
||||||
*/
|
*/
|
||||||
fun <T, C: Comparable<C>> findElementComparing(
|
fun <T, C: Comparable<C>> findElementComparing(
|
||||||
|
@@ -3,7 +3,7 @@ package blitz.logic
|
|||||||
/**
|
/**
|
||||||
* Execute a block if the boolean is true.
|
* Execute a block if the boolean is true.
|
||||||
*/
|
*/
|
||||||
fun Boolean.then(block: () -> Unit): Boolean {
|
inline fun Boolean.then(block: () -> Unit): Boolean {
|
||||||
if (this) {
|
if (this) {
|
||||||
block()
|
block()
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,7 @@ fun Boolean.then(block: () -> Unit): Boolean {
|
|||||||
/**
|
/**
|
||||||
* Execute a block if the boolean is false.
|
* Execute a block if the boolean is false.
|
||||||
*/
|
*/
|
||||||
fun Boolean.otherwise(block: () -> Unit): Boolean {
|
inline fun Boolean.otherwise(block: () -> Unit): Boolean {
|
||||||
if (!this) {
|
if (!this) {
|
||||||
block()
|
block()
|
||||||
}
|
}
|
||||||
@@ -25,7 +25,7 @@ fun Boolean.otherwise(block: () -> Unit): Boolean {
|
|||||||
/**
|
/**
|
||||||
* Execute a block if the boolean is true, otherwise execute another block.
|
* Execute a block if the boolean is true, otherwise execute another block.
|
||||||
*/
|
*/
|
||||||
fun Boolean.then(block: () -> Unit, otherwise: () -> Unit): Boolean {
|
inline fun Boolean.then(block: () -> Unit, otherwise: () -> Unit): Boolean {
|
||||||
if (this) {
|
if (this) {
|
||||||
block()
|
block()
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user