Skip to content

Commit 6865178

Browse files
Remove provider-transforming extension functions
These were originally intended to make reactive gui code more compact but no longer needed due to the DSL API.
1 parent fd2b6ae commit 6865178

File tree

10 files changed

+0
-190
lines changed

10 files changed

+0
-190
lines changed

invui-kotlin/src/main/kotlin/xyz/xenondevs/invui/gui/PagedGuiExtensions.kt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,6 @@ import java.lang.ref.WeakReference
1515
fun <C : Any> PagedGui.Builder<C>.setPage(page: MutableProvider<Int>): PagedGui.Builder<C> =
1616
setPage(PropertyAdapter(page))
1717

18-
/**
19-
* Sets the provider containing the content of the [PagedGui] built by this builder to the result
20-
* of applying [transform] to the value of [provider].
21-
* (Shortcut for `setContent(provider.map(transform))`)
22-
*/
23-
@ExperimentalReactiveApi
24-
fun <C : Any, T> PagedGui.Builder<C>.setContent(provider: Provider<T>, transform: (T) -> List<C>): PagedGui.Builder<C> =
25-
setContent(provider.map(transform))
26-
2718
/**
2819
* Sets the provider containing the content of the [PagedGui] built by this builder.
2920
* If [content] is not a [MutableProvider], attempting to change the content through other means will throw an exception.

invui-kotlin/src/main/kotlin/xyz/xenondevs/invui/gui/ScrollGuiExtensions.kt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,6 @@ import java.lang.ref.WeakReference
1515
fun <C : Any> ScrollGui.Builder<C>.setLine(line: MutableProvider<Int>): ScrollGui.Builder<C> =
1616
setLine(PropertyAdapter(line))
1717

18-
/**
19-
* Sets the provider containing the content of the [ScrollGui] built by this builder to the result
20-
* of applying [transform] to the value of [provider].
21-
* (Shortcut for `setContent(provider.map(transform))`)
22-
*/
23-
@ExperimentalReactiveApi
24-
fun <C : Any, T> ScrollGui.Builder<C>.setContent(provider: Provider<T>, transform: (T) -> List<C>): ScrollGui.Builder<C> =
25-
setContent(provider.map(transform))
26-
2718
/**
2819
* Sets the provider containing the content of the [ScrollGui] built by this builder.
2920
* If [content] is not a [MutableProvider], attempting to change the content through other means will throw an exception.

invui-kotlin/src/main/kotlin/xyz/xenondevs/invui/gui/TabGuiExtensions.kt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@ import java.lang.ref.WeakReference
1616
fun TabGui.Builder.setTab(tab: MutableProvider<Int>): TabGui.Builder =
1717
setTab(PropertyAdapter(tab))
1818

19-
/**
20-
* Sets the provider containing the tabs of the [TabGui] built by this builder to the result
21-
* of applying [transform] to the value of [provider].
22-
* (Shortcut for `setTabs(provider.map(transform))`)
23-
*/
24-
@ExperimentalReactiveApi
25-
fun <T> TabGui.Builder.setTabs(provider: Provider<T>, transform: (T) -> List<Gui?>): TabGui.Builder =
26-
setTabs(provider.map(transform))
27-
2819
/**
2920
* Sets the tabs containing the tabs of the [TabGui] built by this builder.
3021
* If [tabs] is not a [MutableProvider], attempting to change the tabs through other means will throw an exception.

invui-kotlin/src/main/kotlin/xyz/xenondevs/invui/item/ItemExtensions.kt

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,6 @@ import kotlin.experimental.ExperimentalTypeInference
1212
*/
1313
fun Iterable<Item>.notifyWindows() = forEach { it.notifyWindows() }
1414

15-
/**
16-
* Sets the [Provider] containing the [ItemProvider] for the [Item] built by this builder to the result
17-
* of applying [transform] to the value of [provider].
18-
* (Shortcut for `setItemProvider(provider.map(transform))`)
19-
*/
20-
@OverloadResolutionByLambdaReturnType
21-
@ExperimentalReactiveApi
22-
fun <S : Item.Builder<*>, T> S.setItemProvider(provider: Provider<T>, transform: (T) -> ItemProvider) =
23-
setItemProvider(provider.map(transform))
24-
2515
/**
2616
* Sets the [provider] containing the [ItemProvider] for the [Item] built by this builder.
2717
*/
@@ -34,16 +24,6 @@ fun <S : Item.Builder<*>> S.setItemProvider(
3424
return this
3525
}
3626

37-
/**
38-
* Sets the [Provider] containing the [ItemStack] for the [Item] built by this builder to the result
39-
* of applying [transform] to the value of [provider].
40-
* (Shortcut for `setItemProvider(provider.map(transform))`)
41-
*/
42-
@JvmName("setItemProvider1")
43-
@ExperimentalReactiveApi
44-
fun <S : Item.Builder<*>, T> S.setItemProvider(provider: Provider<T>, transform: (T) -> ItemStack) =
45-
setItemProvider(provider.map(transform))
46-
4727
/**
4828
* Sets the [provider] containing the [ItemStack] for the [Item] built by this builder.
4929
* (Shortcut for `setItemProvider(provider.map(::ItemWrapper))`)

invui-kotlin/src/main/kotlin/xyz/xenondevs/invui/window/AnvilWindowExtensions.kt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,6 @@ import xyz.xenondevs.invui.PropertyAdapter
1313
fun AnvilWindow.Builder.addRenameHandler(handler: MutableProvider<String>): AnvilWindow.Builder =
1414
addRenameHandler(handler::set)
1515

16-
/**
17-
* Sets the provider containing the setting whether the text field of the [AnvilWindow] built by this builder is always enabled
18-
* to the result of applying [transform] to the value of [provider].
19-
* (Shortcut for `setTextFieldAlwaysEnabled(provider.map(transform))`)
20-
*/
21-
@ExperimentalReactiveApi
22-
fun <T> AnvilWindow.Builder.setTextFieldAlwaysEnabled(provider: Provider<T>, transform: (T) -> Boolean): AnvilWindow.Builder =
23-
setTextFieldAlwaysEnabled(provider.map(transform))
24-
2516
/**
2617
* Sets the provider containing the setting whether the text field of the [AnvilWindow] built by this builder is always enabled.
2718
* If [textFieldAlwaysEnabled] is not a [MutableProvider], attempting to change the setting through other means will throw an exception.
@@ -30,15 +21,6 @@ fun <T> AnvilWindow.Builder.setTextFieldAlwaysEnabled(provider: Provider<T>, tra
3021
fun AnvilWindow.Builder.setTextFieldAlwaysEnabled(textFieldAlwaysEnabled: Provider<Boolean>): AnvilWindow.Builder =
3122
setTextFieldAlwaysEnabled(PropertyAdapter(textFieldAlwaysEnabled))
3223

33-
/**
34-
* Sets the provider containing the setting whether the result of the [AnvilWindow] built by this builder is always valid
35-
* to the result of applying [transform] to the value of [provider].
36-
* (Shortcut for `setResultAlwaysValid(provider.map(transform))`)
37-
*/
38-
@ExperimentalReactiveApi
39-
fun <T> AnvilWindow.Builder.setResultAlwaysValid(provider: Provider<T>, transform: (T) -> Boolean): AnvilWindow.Builder =
40-
setResultAlwaysValid(provider.map(transform))
41-
4224
/**
4325
* Sets the provider containing the setting whether the result of the [AnvilWindow] built by this builder is always valid.
4426
* If [resultAlwaysValid] is not a [MutableProvider], attempting to change the setting through other means will throw an exception.

invui-kotlin/src/main/kotlin/xyz/xenondevs/invui/window/BrewingWindowExtensions.kt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@ import xyz.xenondevs.commons.provider.Provider
55
import xyz.xenondevs.invui.ExperimentalReactiveApi
66
import xyz.xenondevs.invui.PropertyAdapter
77

8-
/**
9-
* Sets the provider containing the [brew progress][BrewingWindow.Builder.setBrewProgress] of the [BrewingWindow] built by this builder
10-
* to the result of applying [transform] to the value of [provider].
11-
* (Shortcut for `setBrewProgress(provider.map(transform))`)
12-
*/
13-
@ExperimentalReactiveApi
14-
fun <T> BrewingWindow.Builder.setBrewProgress(provider: Provider<T>, transform: (T) -> Double): BrewingWindow.Builder =
15-
setBrewProgress(provider.map(transform))
16-
178
/**
189
* Sets the provider containing the [brew progress][BrewingWindow.Builder.setBrewProgress] of the [BrewingWindow] built by this builder.
1910
* If [brewProgress] is not a [MutableProvider], attempting to change the brew progress through other means will throw an exception.
@@ -22,15 +13,6 @@ fun <T> BrewingWindow.Builder.setBrewProgress(provider: Provider<T>, transform:
2213
fun BrewingWindow.Builder.setBrewProgress(brewProgress: Provider<Double>): BrewingWindow.Builder =
2314
setBrewProgress(PropertyAdapter(brewProgress))
2415

25-
/**
26-
* Sets the provider containing the [fuel progress][BrewingWindow.Builder.setFuelProgress] of the [BrewingWindow] built by this builder
27-
* to the result of applying [transform] to the value of [provider].
28-
* (Shortcut for `setFuelProgress(provider.map(transform))`)
29-
*/
30-
@ExperimentalReactiveApi
31-
fun <T> BrewingWindow.Builder.setFuelProgress(provider: Provider<T>, transform: (T) -> Double): BrewingWindow.Builder =
32-
setFuelProgress(provider.map(transform))
33-
3416
/**
3517
* Sets the provider containing the [fuel progress][BrewingWindow.Builder.setFuelProgress] of the [BrewingWindow] built by this builder.
3618
* If [fuelProgress] is not a [MutableProvider], attempting to change the fuel progress through other means will throw an exception.

invui-kotlin/src/main/kotlin/xyz/xenondevs/invui/window/CartographyWindowExtensions.kt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@ import xyz.xenondevs.commons.provider.Provider
55
import xyz.xenondevs.invui.ExperimentalReactiveApi
66
import xyz.xenondevs.invui.PropertyAdapter
77

8-
/**
9-
* Sets the provider containing the icons on the map of the [CartographyWindow] built by this builder to the result
10-
* of applying [transform] to the value of [provider].
11-
* (Shortcut for `setIcons(provider.map(transform))`)
12-
*/
13-
@ExperimentalReactiveApi
14-
fun <T> CartographyWindow.Builder.setIcons(provider: Provider<T>, transform: (T) -> Set<CartographyWindow.MapIcon>): CartographyWindow.Builder =
15-
setIcons(provider.map(transform))
16-
178
/**
189
* Sets the provider containing the icons on the map of the [CartographyWindow] built by this builder.
1910
* If [icons] is not a [MutableProvider], attempting to change the icons through other means will throw an exception.
@@ -22,15 +13,6 @@ fun <T> CartographyWindow.Builder.setIcons(provider: Provider<T>, transform: (T)
2213
fun CartographyWindow.Builder.setIcons(icons: Provider<Set<CartographyWindow.MapIcon>>): CartographyWindow.Builder =
2314
setIcons(PropertyAdapter(icons))
2415

25-
/**
26-
* Sets the provider containing the view of the [CartographyWindow] built by this builder to the result
27-
* of applying [transform] to the value of [provider].
28-
* (Shortcut for `setView(provider.map(transform))`)
29-
*/
30-
@ExperimentalReactiveApi
31-
fun <T> CartographyWindow.Builder.setView(provider: Provider<T>, transform: (T) -> CartographyWindow.View): CartographyWindow.Builder =
32-
setView(provider.map(transform))
33-
3416
/**
3517
* Sets the provider containing the view of the [CartographyWindow] built by this builder.
3618
* If [view] is not a [MutableProvider], attempting to change the view through other means will throw an exception.

invui-kotlin/src/main/kotlin/xyz/xenondevs/invui/window/FurnaceWindowExtensions.kt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@ import xyz.xenondevs.commons.provider.Provider
55
import xyz.xenondevs.invui.ExperimentalReactiveApi
66
import xyz.xenondevs.invui.PropertyAdapter
77

8-
/**
9-
* Sets the provider containing the [cook progress][FurnaceWindow.Builder.setCookProgress] of the [FurnaceWindow] built by this builder
10-
* to the result of applying [transform] to the value of [provider].
11-
* (Shortcut for `setCookProgress(provider.map(transform))`)
12-
*/
13-
@ExperimentalReactiveApi
14-
fun <T> FurnaceWindow.Builder.setCookProgress(provider: Provider<T>, transform: (T) -> Double): FurnaceWindow.Builder =
15-
setCookProgress(provider.map(transform))
16-
178
/**
189
* Sets the provider containing the [cook progress][FurnaceWindow.Builder.setCookProgress] of the [FurnaceWindow] built by this builder.
1910
* If [cookProgress] is not a [MutableProvider], attempting to change the cook progress through other means will throw an exception.
@@ -22,15 +13,6 @@ fun <T> FurnaceWindow.Builder.setCookProgress(provider: Provider<T>, transform:
2213
fun FurnaceWindow.Builder.setCookProgress(cookProgress: Provider<Double>): FurnaceWindow.Builder =
2314
setCookProgress(PropertyAdapter(cookProgress))
2415

25-
/**
26-
* Sets the provider containing the [burn progress][FurnaceWindow.Builder.setBurnProgress] of the [FurnaceWindow] built by this builder
27-
* to the result of applying [transform] to the value of [provider].
28-
* (Shortcut for `setBurnProgress(provider.map(transform))`)
29-
*/
30-
@ExperimentalReactiveApi
31-
fun <T> FurnaceWindow.Builder.setBurnProgress(provider: Provider<T>, transform: (T) -> Double): FurnaceWindow.Builder =
32-
setBurnProgress(provider.map(transform))
33-
3416
/**
3517
* Sets the provider containing the [burn progress][FurnaceWindow.Builder.setBurnProgress] of the [FurnaceWindow] built by this builder.
3618
* If [burnProgress] is not a [MutableProvider], attempting to change the burn progress through other means will throw an exception.

invui-kotlin/src/main/kotlin/xyz/xenondevs/invui/window/MerchantWindowExtensions.kt

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,13 @@ import xyz.xenondevs.commons.provider.Provider
55
import xyz.xenondevs.invui.ExperimentalReactiveApi
66
import xyz.xenondevs.invui.PropertyAdapter
77

8-
/**
9-
* Sets the provider containing the trades of the [MerchantWindow] built by this builder to the result
10-
* of applying [transform] to the value of [provider].
11-
* (Shortcut for `setTrades(provider.map(transform))`)
12-
*/
13-
@ExperimentalReactiveApi
14-
fun <T> MerchantWindow.Builder.setTrades(provider: Provider<T>, transform: (T) -> List<MerchantWindow.Trade>): MerchantWindow.Builder =
15-
setTrades(provider.map(transform))
16-
178
/**
189
* Sets the provider containing the trades of the [MerchantWindow] built by this builder.
1910
*/
2011
@ExperimentalReactiveApi
2112
fun MerchantWindow.Builder.setTrades(trades: Provider<List<MerchantWindow.Trade>>): MerchantWindow.Builder =
2213
setTrades(PropertyAdapter(trades))
2314

24-
/**
25-
* Sets the provider containing the [level][MerchantWindow.Builder.setLevel] of the [MerchantWindow] built by this builder
26-
* to the result of applying [transform] to the value of [provider].
27-
* (Shortcut for `setLevel(provider.map(transform))`)
28-
*/
29-
@ExperimentalReactiveApi
30-
fun <T> MerchantWindow.Builder.setLevel(provider: Provider<T>, transform: (T) -> Int): MerchantWindow.Builder =
31-
setLevel(provider.map(transform))
32-
3315
/**
3416
* Sets the provider containing the [level][MerchantWindow.Builder.setLevel] of the [MerchantWindow] built by this builder.
3517
* If [level] is not a [MutableProvider], attempting to change the level through other means will throw an exception.
@@ -38,15 +20,6 @@ fun <T> MerchantWindow.Builder.setLevel(provider: Provider<T>, transform: (T) ->
3820
fun MerchantWindow.Builder.setLevel(level: Provider<Int>): MerchantWindow.Builder =
3921
setLevel(PropertyAdapter(level))
4022

41-
/**
42-
* Sets the provider containing the [progress][MerchantWindow.Builder.setProgress] of the [MerchantWindow] built by this builder
43-
* to the result of applying [transform] to the value of [provider].
44-
* (Shortcut for `setProgress(provider.map(transform))`)
45-
*/
46-
@ExperimentalReactiveApi
47-
fun <T> MerchantWindow.Builder.setProgress(provider: Provider<T>, transform: (T) -> Double): MerchantWindow.Builder =
48-
setProgress(provider.map(transform))
49-
5023
/**
5124
* Sets the provider containing the [progress][MerchantWindow.Builder.setProgress] of the [MerchantWindow] built by this builder.
5225
* If [progress] is not a [MutableProvider], attempting to change the progress through other means will throw an exception.
@@ -55,15 +28,6 @@ fun <T> MerchantWindow.Builder.setProgress(provider: Provider<T>, transform: (T)
5528
fun MerchantWindow.Builder.setProgress(progress: Provider<Double>): MerchantWindow.Builder =
5629
setProgress(PropertyAdapter(progress))
5730

58-
/**
59-
* Sets the provider containing whether the [MerchantWindow] built by this builder should show a restock message
60-
* to the result of applying [transform] to the value of [provider].
61-
* (Shortcut for `setRestockMessageEnabled(provider.map(transform))`)
62-
*/
63-
@ExperimentalReactiveApi
64-
fun <T> MerchantWindow.Builder.setRestockMessageEnabled(provider: Provider<T>, transform: (T) -> Boolean): MerchantWindow.Builder =
65-
setRestockMessageEnabled(provider.map(transform))
66-
6731
/**
6832
* Sets the provider containing whether the [MerchantWindow] built by this builder should show a restock message.
6933
* If [restockMessageEnabled] is not a [MutableProvider], attempting to change the setting through other means will throw an exception.
@@ -72,15 +36,6 @@ fun <T> MerchantWindow.Builder.setRestockMessageEnabled(provider: Provider<T>, t
7236
fun MerchantWindow.Builder.setRestockMessageEnabled(restockMessageEnabled: Provider<Boolean>): MerchantWindow.Builder =
7337
setRestockMessageEnabled(PropertyAdapter(restockMessageEnabled))
7438

75-
/**
76-
* Sets the provider containing the [discount][MerchantWindow.Trade.Builder.setDiscount] of the [MerchantWindow.Trade] built by this builder
77-
* to the result of applying [transform] to the value of [provider].
78-
* (Shortcut for `setDiscount(provider.map(transform))`)
79-
*/
80-
@ExperimentalReactiveApi
81-
fun <T> MerchantWindow.Trade.Builder.setDiscount(provider: Provider<T>, transform: (T) -> Int): MerchantWindow.Trade.Builder =
82-
setDiscount(provider.map(transform))
83-
8439
/**
8540
* Sets the provider containing the [discount][MerchantWindow.Trade.Builder.setDiscount] of the [MerchantWindow.Trade] built by this builder.
8641
* If [discount] is not a [MutableProvider], attempting to change the discount through other means will throw an exception.
@@ -89,14 +44,6 @@ fun <T> MerchantWindow.Trade.Builder.setDiscount(provider: Provider<T>, transfor
8944
fun MerchantWindow.Trade.Builder.setDiscount(discount: Provider<Int>): MerchantWindow.Trade.Builder =
9045
setDiscount(PropertyAdapter(discount))
9146

92-
/**
93-
* Sets the provider containing the [discount][MerchantWindow.Trade.Builder.setDiscount] of the [MerchantWindow.Trade] built by this builder
94-
* to the result of applying [transform] to the value of [provider].
95-
*/
96-
@ExperimentalReactiveApi
97-
fun <T> MerchantWindow.Trade.Builder.setAvailable(provider: Provider<T>, transform: (T) -> Boolean): MerchantWindow.Trade.Builder =
98-
setAvailable(provider.map(transform))
99-
10047
/**
10148
* Sets the provider containing the [available][MerchantWindow.Trade.Builder.setAvailable] of the [MerchantWindow.Trade] built by this builder.
10249
* If [available] is not a [MutableProvider], attempting to change the availability through other

invui-kotlin/src/main/kotlin/xyz/xenondevs/invui/window/WindowExtensions.kt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@ import xyz.xenondevs.commons.provider.Provider
66
import xyz.xenondevs.invui.ExperimentalReactiveApi
77
import xyz.xenondevs.invui.PropertyAdapter
88

9-
/**
10-
* Sets the provider containing the title of the [Window] built by this builder to the result
11-
* of applying [transform] to the value of [provider].
12-
* (Shortcut for `setTitle(provider.map(transform))`)
13-
*/
14-
@ExperimentalReactiveApi
15-
fun <S : Window.Builder<*, *>, T> S.setTitle(provider: Provider<T>, transform: (T) -> Component): S =
16-
setTitle(provider.map(transform))
17-
189
/**
1910
* Sets the provider containing the title of the [Window] built by this builder.
2011
*/
@@ -25,15 +16,6 @@ fun <S : Window.Builder<*, *>> S.setTitle(title: Provider<Component>): S {
2516
return this
2617
}
2718

28-
/**
29-
* Sets the provider containing the setting whether the [Window] built by this builder is closeable
30-
* to the result of applying [transform] to the value of [provider].
31-
* (Shortcut for `setCloseable(provider.map(transform))`)
32-
*/
33-
@ExperimentalReactiveApi
34-
fun <S : Window.Builder<*, *>, T> S.setCloseable(provider: Provider<T>, transform: (T) -> Boolean): S =
35-
setCloseable(provider.map(transform))
36-
3719
/**
3820
* Sets the provider containing the setting whether the [Window] built by this builder is closeable.
3921
* If [closeable] is not a [MutableProvider], attempting to change the setting through other means will throw an exception.

0 commit comments

Comments
 (0)