Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
3e644426
Commit
3e644426
authored
Apr 22, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make `MessageChainBuilder` open
parent
a63af806
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/builder.kt
...commonMain/kotlin/net.mamoe.mirai/message/data/builder.kt
+11
-11
No files found.
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/builder.kt
View file @
3e644426
...
...
@@ -48,13 +48,13 @@ inline fun buildMessageChain(initialSize: Int, block: MessageChainBuilder.() ->
* @see asMessageChain 完成构建
*/
@OptIn
(
MiraiExperimentalAPI
::
class
)
class
MessageChainBuilder
private
constructor
(
open
class
MessageChainBuilder
private
constructor
(
private
val
container
:
MutableList
<
SingleMessage
>
)
:
MutableList
<
SingleMessage
>
by
container
,
Appendable
{
constructor
()
:
this
(
mutableListOf
())
constructor
(
initialSize
:
Int
)
:
this
(
ArrayList
<
SingleMessage
>(
initialSize
))
override
fun
add
(
element
:
SingleMessage
):
Boolean
{
final
override
fun
add
(
element
:
SingleMessage
):
Boolean
{
checkBuilt
()
flushCache
()
return
addAndCheckConstrainSingle
(
element
)
...
...
@@ -72,7 +72,7 @@ class MessageChainBuilder private constructor(
}
}
override
fun
addAll
(
elements
:
Collection
<
SingleMessage
>):
Boolean
{
final
override
fun
addAll
(
elements
:
Collection
<
SingleMessage
>):
Boolean
{
checkBuilt
()
flushCache
()
return
addAll
(
elements
.
flatten
())
...
...
@@ -124,9 +124,9 @@ class MessageChainBuilder private constructor(
withCache
{
append
(
charSequence
)
}
}
override
fun
append
(
value
:
Char
):
MessageChainBuilder
=
withCache
{
append
(
value
)
}
override
fun
append
(
value
:
CharSequence
?):
MessageChainBuilder
=
withCache
{
append
(
value
)
}
override
fun
append
(
value
:
CharSequence
?,
startIndex
:
Int
,
endIndex
:
Int
):
MessageChainBuilder
=
final
override
fun
append
(
value
:
Char
):
MessageChainBuilder
=
withCache
{
append
(
value
)
}
final
override
fun
append
(
value
:
CharSequence
?):
MessageChainBuilder
=
withCache
{
append
(
value
)
}
final
override
fun
append
(
value
:
CharSequence
?,
startIndex
:
Int
,
endIndex
:
Int
):
MessageChainBuilder
=
withCache
{
append
(
value
,
startIndex
,
endIndex
)
}
fun
append
(
message
:
Message
):
MessageChainBuilder
=
apply
{
add
(
message
)
}
...
...
@@ -153,27 +153,27 @@ class MessageChainBuilder private constructor(
///////
// FOR IMMUTABLE SAFETY
override
fun
remove
(
element
:
SingleMessage
):
Boolean
{
final
override
fun
remove
(
element
:
SingleMessage
):
Boolean
{
checkBuilt
()
return
container
.
remove
(
element
)
}
override
fun
removeAll
(
elements
:
Collection
<
SingleMessage
>):
Boolean
{
final
override
fun
removeAll
(
elements
:
Collection
<
SingleMessage
>):
Boolean
{
checkBuilt
()
return
container
.
removeAll
(
elements
)
}
override
fun
removeAt
(
index
:
Int
):
SingleMessage
{
final
override
fun
removeAt
(
index
:
Int
):
SingleMessage
{
checkBuilt
()
return
container
.
removeAt
(
index
)
}
override
fun
clear
()
{
final
override
fun
clear
()
{
checkBuilt
()
return
container
.
clear
()
}
override
fun
set
(
index
:
Int
,
element
:
SingleMessage
):
SingleMessage
{
final
override
fun
set
(
index
:
Int
,
element
:
SingleMessage
):
SingleMessage
{
checkBuilt
()
return
container
.
set
(
index
,
element
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment