Class GKRule

  • All Implemented Interfaces:
    NSObject
    Direct Known Subclasses:
    GKNSPredicateRule

    public class GKRule
    extends NSObject
    The concrete class that the GKRuleSystem uses to evaluate the current state and facts with predicated rules. These are sharable between systems, so don't retain any state in the rules themselves. Use the system-provided state storage.
    See Also:
    GKRuleSystem.state
    • Constructor Detail

      • GKRule

        protected GKRule​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • alloc

        public static GKRule alloc()
      • allocWithZone

        public static java.lang.Object allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(java.lang.Object aTarget,
                                                                                 org.moe.natj.objc.SEL aSelector,
                                                                                 java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        public static org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(java.lang.String key)
      • new_objc

        public static java.lang.Object new_objc()
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • ruleWithPredicateAssertingFactGrade

        public static GKRule ruleWithPredicateAssertingFactGrade​(NSPredicate predicate,
                                                                 NSObject fact,
                                                                 float grade)
        Create a data-driven rule that uses NSPredicate and a single assert as the action.
      • ruleWithPredicateRetractingFactGrade

        public static GKRule ruleWithPredicateRetractingFactGrade​(NSPredicate predicate,
                                                                  NSObject fact,
                                                                  float grade)
        Short hand for data-driven rule that uses NSPredicate and a single retract as the action.
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • evaluatePredicateWithSystem

        public boolean evaluatePredicateWithSystem​(GKRuleSystem system)
        Called by the rule system when it is this rule's turn to be evaluated. If the predicate returns YES then the action for the rule will be performed. Once the action is performed the rule will move to the system's executed list until the agenda is reset.
        Returns:
        YES is the predicate passes and the action needs to be performed, NO otherwise.
        See Also:
        performAction, GKRuleSystem.agenda, GKRuleSystem.executed, GKRuleSystem.reset
      • performActionWithSystem

        public void performActionWithSystem​(GKRuleSystem system)
        Performs the action consequence for the rule. This will only be called if the predicate evaluates to YES. Any facts asserted or retracted by the action on the system will cause the system to evaluate the agenda rule set again once the action completes.
      • salience

        public long salience()
        Salience defines the order in the rule agenda that the system will evaluate. A rule with higher salience will be evaluated before another rule in the agenda that has a lower salience. Defaults to 0.
        See Also:
        GKRuleSystem.agenda
      • setSalience

        public void setSalience​(long value)
        Salience defines the order in the rule agenda that the system will evaluate. A rule with higher salience will be evaluated before another rule in the agenda that has a lower salience. Defaults to 0.
        See Also:
        GKRuleSystem.agenda