checkState

abstract fun checkState(param: T = (Unit as T)): Boolean

Run this check.

Return

whether this predicate currently allows autosnap

Note some (bad) magic here:

to achieve ability to implement IAutoSnappingPredicate with param or without it - we do unchecked cast here.

If IAutoSnappingPredicate's implementation explicitly defines some type to use as param - this cast will fail if nothing provided:

For class Foo : IAutoSnappingPredicate<MyClass> { ... } call myFoo.okDetected() will fail, as it expects myFoo.okDetected(myClassInstance).

To have implementation that does not need param, just use Unit and pass no parameter:

class Bar : IAutoSnappingPredicate<Unit> { ... }, and then myBar.okDetected()

Parameters

param

typed param that this implementation might need. Default is Unit