Predicate Types

This page will go over the classes your predicate type can inherit from in increasing level of complexity. Examples implementing these can be found here.

If a predicate type doesn't take any arguments and doesn't need to keep track of any internal state during runtime, it can just inherit from BasicPredicateType

abstract class BasicPredicateType(typeName: String) {
    abstract fun test(): Boolean
}

If a predicate type takes arguments but it don't need it to have an internal state, it can inherit from StaticPredicateType

abstract class StaticPredicateType<TArg: TriggerArguments>(typeName: String, argumentType: KType) {
    abstract fun test(arguments: TArg): Boolean
}

Finally, if a predicate type takes both, it can inherit from PredicateType.

abstract class PredicateType<TArg: TriggerArguments, TState: TriggerState>(typeName: String, argumentType: KType) {
    abstract fun test(arguments: TArg, state: TState): Boolean
    abstract fun createState(arguments: TArg): TState
}