-
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.
Merge pull request #15 from simplecloudapp/feat/numerical-operation-m…
…atcher feat: added NumericOperationMatcher and GreaterThanOperation
- Loading branch information
Showing
17 changed files
with
122 additions
and
83 deletions.
There are no files selected for viewing
32 changes: 24 additions & 8 deletions
32
plugin-shared/src/main/kotlin/app/simplecloud/plugin/api/shared/matcher/OperationType.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
12 changes: 0 additions & 12 deletions
12
...in/kotlin/app/simplecloud/plugin/api/shared/matcher/operation/ContainsOperationMatcher.kt
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
...in/kotlin/app/simplecloud/plugin/api/shared/matcher/operation/EndsWithOperationMatcher.kt
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
...main/kotlin/app/simplecloud/plugin/api/shared/matcher/operation/EqualsOperationMatcher.kt
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
...ain/kotlin/app/simplecloud/plugin/api/shared/matcher/operation/NumericOperationMatcher.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,3 @@ | ||
package app.simplecloud.plugin.api.shared.matcher.operation | ||
|
||
interface NumericOperationMatcher : OperationMatcher<Int, Int> |
4 changes: 2 additions & 2 deletions
4
...d/src/main/kotlin/app/simplecloud/plugin/api/shared/matcher/operation/OperationMatcher.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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package app.simplecloud.plugin.api.shared.matcher.operation | ||
|
||
interface OperationMatcher { | ||
interface OperationMatcher<K, V> { | ||
|
||
fun matches(name: String, value: String): Boolean | ||
fun matches(key: K, value: V): Boolean | ||
|
||
} |
13 changes: 0 additions & 13 deletions
13
...ain/kotlin/app/simplecloud/plugin/api/shared/matcher/operation/PatternOperationMatcher.kt
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
.../main/kotlin/app/simplecloud/plugin/api/shared/matcher/operation/RegexOperationMatcher.kt
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
.../kotlin/app/simplecloud/plugin/api/shared/matcher/operation/StartsWithOperationMatcher.kt
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
...main/kotlin/app/simplecloud/plugin/api/shared/matcher/operation/StringOperationMatcher.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,3 @@ | ||
package app.simplecloud.plugin.api.shared.matcher.operation | ||
|
||
interface StringOperationMatcher : OperationMatcher<String, String> |
13 changes: 13 additions & 0 deletions
13
...tlin/app/simplecloud/plugin/api/shared/matcher/operation/impl/ContainsOperationMatcher.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,13 @@ | ||
package app.simplecloud.plugin.api.shared.matcher.operation.impl | ||
|
||
import app.simplecloud.plugin.api.shared.matcher.operation.StringOperationMatcher | ||
import org.spongepowered.configurate.objectmapping.ConfigSerializable | ||
|
||
@ConfigSerializable | ||
object ContainsOperationMatcher : StringOperationMatcher { | ||
|
||
override fun matches(key: String, value: String): Boolean { | ||
return key.contains(value, ignoreCase = true) | ||
} | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
...tlin/app/simplecloud/plugin/api/shared/matcher/operation/impl/EndsWithOperationMatcher.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,13 @@ | ||
package app.simplecloud.plugin.api.shared.matcher.operation.impl | ||
|
||
import app.simplecloud.plugin.api.shared.matcher.operation.StringOperationMatcher | ||
import org.spongepowered.configurate.objectmapping.ConfigSerializable | ||
|
||
@ConfigSerializable | ||
object EndsWithOperationMatcher : StringOperationMatcher { | ||
|
||
override fun matches(key: String, value: String): Boolean { | ||
return key.endsWith(value, ignoreCase = true) | ||
} | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
...kotlin/app/simplecloud/plugin/api/shared/matcher/operation/impl/EqualsOperationMatcher.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,13 @@ | ||
package app.simplecloud.plugin.api.shared.matcher.operation.impl | ||
|
||
import app.simplecloud.plugin.api.shared.matcher.operation.StringOperationMatcher | ||
import org.spongepowered.configurate.objectmapping.ConfigSerializable | ||
|
||
@ConfigSerializable | ||
object EqualsOperationMatcher : StringOperationMatcher { | ||
|
||
override fun matches(key: String, value: String): Boolean { | ||
return key.equals(value, ignoreCase = true) | ||
} | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
...n/app/simplecloud/plugin/api/shared/matcher/operation/impl/GreaterThanOperationMatcher.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,11 @@ | ||
package app.simplecloud.plugin.api.shared.matcher.operation.impl | ||
|
||
import app.simplecloud.plugin.api.shared.matcher.operation.NumericOperationMatcher | ||
|
||
object GreaterThanOperationMatcher : NumericOperationMatcher { | ||
|
||
override fun matches(key: Int, value: Int): Boolean { | ||
return key > value | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...otlin/app/simplecloud/plugin/api/shared/matcher/operation/impl/PatternOperationMatcher.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,14 @@ | ||
package app.simplecloud.plugin.api.shared.matcher.operation.impl | ||
|
||
import app.simplecloud.plugin.api.shared.matcher.operation.StringOperationMatcher | ||
import org.spongepowered.configurate.objectmapping.ConfigSerializable | ||
import java.util.regex.Pattern | ||
|
||
@ConfigSerializable | ||
object PatternOperationMatcher : StringOperationMatcher { | ||
|
||
override fun matches(key: String, value: String): Boolean { | ||
return Pattern.matches(key, value) | ||
} | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
.../kotlin/app/simplecloud/plugin/api/shared/matcher/operation/impl/RegexOperationMatcher.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,13 @@ | ||
package app.simplecloud.plugin.api.shared.matcher.operation.impl | ||
|
||
import app.simplecloud.plugin.api.shared.matcher.operation.StringOperationMatcher | ||
import org.spongepowered.configurate.objectmapping.ConfigSerializable | ||
|
||
@ConfigSerializable | ||
object RegexOperationMatcher : StringOperationMatcher { | ||
|
||
override fun matches(key: String, value: String): Boolean { | ||
return Regex(value).matches(key) | ||
} | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
...in/app/simplecloud/plugin/api/shared/matcher/operation/impl/StartsWithOperationMatcher.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,13 @@ | ||
package app.simplecloud.plugin.api.shared.matcher.operation.impl | ||
|
||
import app.simplecloud.plugin.api.shared.matcher.operation.StringOperationMatcher | ||
import org.spongepowered.configurate.objectmapping.ConfigSerializable | ||
|
||
@ConfigSerializable | ||
object StartsWithOperationMatcher : StringOperationMatcher { | ||
|
||
override fun matches(key: String, value: String): Boolean { | ||
return key.startsWith(value, ignoreCase = true) | ||
} | ||
|
||
} |