-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d346e49
commit ad73a28
Showing
34 changed files
with
300 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
project/module-core/src/main/kotlin/cn/fd/ratziel/core/serialization/MutableJsonObject.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
project/module-core/src/main/kotlin/cn/fd/ratziel/function/SimpleArgumentContext.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
project/module-core/src/main/kotlin/cn/fd/ratziel/function/internal/FutureLazyImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package cn.fd.ratziel.function.internal | ||
|
||
import java.util.concurrent.Future | ||
|
||
/** | ||
* CompletableFutureLazyImpl | ||
* | ||
* @author TheFloodDragon | ||
* @since 2024/8/13 21:07 | ||
*/ | ||
internal class FutureLazyImpl<out T>(private val future: Future<T>) : Lazy<T> { | ||
|
||
override fun isInitialized() = future.isDone | ||
|
||
override val value: T get() = if (isInitialized()) future.get() else throw UninitializedPropertyAccessException("Lazy value not initialized yet!") | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
project/module-core/src/main/kotlin/cn/fd/ratziel/function/lazy.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package cn.fd.ratziel.function | ||
|
||
import cn.fd.ratziel.function.internal.FutureLazyImpl | ||
import java.util.concurrent.Future | ||
|
||
/** | ||
* 将 [Future] 转为 [Lazy] | ||
*/ | ||
fun <T> Future<T>.asLazy(): Lazy<T> = FutureLazyImpl(this) | ||
|
||
/** | ||
* 获取 [Lazy] 的值 | ||
* 未初始化时返回为空 | ||
*/ | ||
fun <T> Lazy<T>.getOrNull(): T? = if (isInitialized()) value else null | ||
|
||
/** | ||
* 获取 [Lazy] 的值 | ||
* 未初始化时返回为默认值 | ||
*/ | ||
fun <T> Lazy<T>.getOr(default: T): T = if (isInitialized()) value else default |
2 changes: 1 addition & 1 deletion
2
...in/cn/fd/ratziel/function/util/Uncheck.kt → .../kotlin/cn/fd/ratziel/function/uncheck.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
project/module-item/src/main/kotlin/cn/fd/ratziel/module/item/api/builder/ItemStream.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package cn.fd.ratziel.module.item.api.builder | ||
|
||
import cn.fd.ratziel.function.ArgumentContext | ||
|
||
/** | ||
* ItemStream - 物品生成过程流 | ||
* | ||
* @author TheFloodDragon | ||
* @since 2024/8/13 22:11 | ||
*/ | ||
interface ItemStream { | ||
|
||
/** | ||
* 上下文参数 | ||
*/ | ||
val context: ArgumentContext | ||
|
||
// TODO Finish this | ||
|
||
} |
4 changes: 3 additions & 1 deletion
4
...atziel/module/item/api/ItemTransformer.kt → ...odule/item/api/builder/ItemTransformer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...t/module-item/src/main/kotlin/cn/fd/ratziel/module/item/api/registry/ComponentRegistry.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.