Commit Graph

55 Commits

Author SHA1 Message Date
Fedor Isakov cdb6c91958 Cleanup and refactor code for better readability 2024-06-14 13:42:46 +02:00
Fedor Isakov 506b245438 Drop obsolete deprecated code 2024-06-13 12:23:27 +02:00
Fedor Isakov dc4f046510 Cleanup and optimize Rule.Tag, drop unused methods 2021-05-18 12:32:03 +02:00
Fedor Isakov 207be07df9 Introduce try-tell protocol for invoking predicates
The default tell protocol assumes an exception is to be thrown
in case predicate is not satisfied. This may lead to unnecessary
exceptions being thrown in a situation where a simple failure
status would have been sufficient.
2021-04-08 11:31:29 +02:00
Grigorii Kirgizov fd43cc560c refactoring: introduce Rule.Tag instead of several fields (basetag/tag/uniqueTag)
Allows to carry logically connected information in one object.
Needed for subsequent changes to ConstraintOccurrence, which
must have better information on source rule: rule template name.
Used by occurrence cache.
2020-12-15 17:59:05 +03:00
Fedor Isakov f6123273d4 Minor refactoring: drop usages of Program.rulesLists() method. 2020-12-01 21:55:17 +01:00
Grigorii Kirgizov 15d6fe8eae Introduce ProcessingSession for creating session from token & ending it
Introduced to discern incremental strategies: Full,Preamble,Default.
because how SessionToken is used and stored depends on it.
EvaluationSessionImpl now simply dispatches to it.
Also rename 'IncrementalProcessing' to 'ProcessingStrategy'.
2020-11-18 11:36:28 +03:00
Fedor Isakov eec84330fc Make RuleIndex incrementally updatable. Drop segments feature. 2020-08-06 17:45:47 +02:00
Grigorii Kirgizov 2a0d4ef076 Observe all unbound logicals inside Occurrence to check contract (MPSCR-66)
Previously only logicals directly used ar occurrence args
were observed. Now terms in occurrence args are traversed
recursively and all contained logicals are observed.

Also clear occurrence contract observers on discarding occ-s.
Introduce a generic way to clear observers in LogicalState.
2020-07-28 18:53:41 +03:00
Grigorii Kirgizov a2675351b5 Track justifications for all occurrences, but weaken information they carry.
Now Evidence isn't unique for each Chunk: Occurrence Chunks fully
share evidence and justifications with their activating match.
So, less collections of justifications are created, approx. 2 times less.
2020-03-26 13:40:41 +03:00
Grigorii Kirgizov 6a53d15a21 Refactor: move logic related to tracking parent match from ControllerImpl to MatchJournal
Relates to machinery introduced in MPSCR-47.
Previously parent match was maintained in Controller on Java call stack.
Now this stack of parent matches is maintained manually in MatchJournal.

So MatchJournal gains new invariant: parentChunk()
returns correct parent after each logMatch() call.
Several tests fail, also need to maintain this
invariant after logActivation() calls.
2020-03-26 13:40:41 +03:00
Grigorii Kirgizov 2b92e5df04 minor: rename test method princConstraint to pconstraint 2020-03-02 17:58:05 +03:00
Grigorii Kirgizov ccd3ed6d45 Add tracking of last justifying MatchChunk during program eval to avoid searching for it in Journal
Such machinery is needed inside ControllerImpl.processBody
to provide nearest relevant match to feedback handling.
Also required for a fix for MPSCR-47.
Also enables back one assertion in incremental processing on rm stage.
2020-03-02 17:11:26 +03:00
Grigorii Kirgizov 37dd3ee4a8 Refactoring: extract Justified interface and hide lower-level work with Int sets behind it
Make Occurrence a Justified entity and drop .justifications() from
ConstraintOccurrence.java because justifications are used only internally.
A single justification is now called Evidence (typealias to Int),
so Justified entities are justified by Evidence-s.
2020-03-01 17:12:15 +03:00
Fedor Isakov 8af582f9b2 Refactoring: simplify contract b/w controller and logical state. 2020-01-14 15:34:54 +01:00
Fedor Isakov d208e802b9 Remove unnecessary feature: StateFrameStack is no longer used.
StateFrameStack adds no functionality but requires too much processing.
Rename StateFrameStack -> LogicalState.
Rename ProcessingStateImpl -> ConstraintsProcessing.
Simplify occurrence's logical observer.
Introduce transient dependency on controller to LogicalState.
Keep logical state as part of session token, avoid re-initializing
all logical observers.
Make replaying of match journal independent of controller.
2020-01-10 13:51:07 +01:00
Fedor Isakov 7d308cb0e3 Experimental feature: Rules segmentation.
The rules index is extended to observe the segment path a rule belongs to.
An occurrence is bound to the rule that activated it and thus has an
associated segment path.
Rules to be picked for activation can be selected on the basis
of matched segment path.
2019-09-27 21:59:58 +02:00
Grigorii Kirgizov be7283190f Propagate FeedbackStatus out of reactivate for incremental execution. 2019-07-26 17:00:30 +02:00
Grigorii Kirgizov d7b7d40f8a Don't expose InitialRule to RuleDiff. Add first test for rm algo stage. 2019-06-12 14:56:57 +03:00
Grigorii Kirgizov 767eb057f5 Add helper method in Tests builder, adjust few tests with it 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov 52fd54afce Hide use of TIntSet from trove behind typealias; one usage in ConstraintOccurrence.java is left 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov e5942d2c77 Fix MatchHistory tests: fix impl of storeView, taking into account current pos in history (not all of it) 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 612f0a212c Refine MatchHistory impl, extract interface for tests, add several tests. 2019-06-12 13:28:05 +03:00
Fedor Isakov 0e02bab768 Replace tag() method in rule with uniqueTag() returning Object. This
allows for further memory optimization.
2019-05-17 17:10:52 +02:00
Fedor Isakov 658963903d Refactor controller: extract component for managing dispatching front,
drop Store, introduce ProcessingState and StateFrame.

ProcessingState class to represent current state, including the
dispatching front and all the logical observers.
StateFrame is a persistent class that reacts to activated constraint
and launches processing via Controller.
Breaking change: the frames correspond to an activated constraint occurrence,
and not to a triggered rule match as it has been the case before.
2019-05-16 12:35:52 +02:00
Fedor Isakov 11a9505ee9 Decompose controller's processing of constraints for better separation of concerns.
Restructure the code in controller to enable being called from an
external component.
2019-05-14 11:38:19 +02:00
Fedor Isakov bfc4b641bb Refactor constraint occurrence to depend on controller directly.
Drop creating of a frame stack from a store view.
2019-05-13 10:48:10 +02:00
Fedor Isakov eb5b38384f Rename Handler class in reactor API to RulesList. 2019-05-09 17:30:14 +02:00
Fedor Isakov 09ca1f1236 Fix the Store implementation and the test harness to support incremental
program launch.
2019-05-03 22:03:17 +02:00
Fedor Isakov 13e8f4a205 Cleanup obsolete code in test helper.
Refactor mock program builder for ease of use.
2019-05-03 22:03:17 +02:00
Fedor Isakov 9db8bfcdca Minor code cleanup and documentation.
Switch Dispatcher to use tag as Rule's unique identifier.
De-couple RuleMatcherImpl from the Rule instance.

Rule instances are externally provided, and in case of incremental
Program update these will be all replaced with new ones.
Better to keep loose coupling between those and  the reactor implementation.
2019-05-01 15:36:59 +02:00
Fedor Isakov a26dee8508 Merge API module into Core, drop API. Reactor lib to have only one jar. 2019-04-24 21:21:03 +02:00
Fedor Isakov a9a7f66a3a Refactorings and code cleanup in reactor lib. Documenting the code.
Breaking change: ReactorLifecycle to be used to initialize session
backend.

Remove deprecated stuff, deprecate some more.
Consolidate useless interfaces into bigger ones.
Extract interfaces for core classes, move implementation into "internal"
subpackage.
2019-04-24 21:21:03 +02:00
Fedor Isakov 3f930ba530 Introduce solver() method to PredicateSymbol.
Drop requirement to provide evaluation session with list of solvers; remove unnecessary configuration step.
Minor refactorings in tests.
2019-02-17 11:39:56 +01:00
Fedor Isakov c8d7e52b6f Introduce feedback handling API to facilitate processing of messages during program evaluation.
Minor refactorings in conreactor. Drop deprecated stuff. Default implementations for deprecated methods.
2019-02-15 17:15:09 +01:00
Fedor Isakov c5c198cf8b Refactoring in the reactor API: move invocation/occurrence factory methods to evaluation session, enable access to logical context from an invocation. 2017-03-27 19:01:07 +02:00
Fedor Isakov 466c015263 Handlers to have multiple primary constraints. RuleIndex to select handlers with matching primary symbol, if a handler has one. Only "accept-all" handlers process non-primary constraints. 2016-12-28 12:54:19 +01:00
Fedor Isakov 26f12f187d Refactor the evaluation controller to have handlers. RuleIndex to select handlers with matching primary symbol first, then the "accept-all" handlers. Tests. 2016-12-23 16:50:31 +01:00
Fedor Isakov 49a6ee0bd0 New naming convention for test helper classes (prefix Mock-). 2016-12-22 15:56:23 +01:00
Fedor Isakov d0bf94fc91 Support body alternation in Handler. Adopt the changes in the API. 2016-04-15 13:59:23 +02:00
Fedor Isakov 8c103ddbd1 Integrate changes in the API imported from the Logic project. Change the code accordingly. 2016-03-16 16:26:25 +01:00
Fedor Isakov 619337151f Updated API sources from the latest version of Logic. Adapted to the new API. LogicalPattern -> MetaLogical. Renamed all *pattern entities. RuleBuilder for tests. 2016-01-29 14:41:57 +01:00
Fedor Isakov ed76bdae73 Optimizing looking up constraint occurrences to complete a match.
Parent observer for logicals, maintaining the logical-to-occurrence index in occurrence store.
Some code refactoring.
2016-01-24 20:45:46 +01:00
Fedor Isakov 057c4d7c69 Logical value observers. Testing reactivation of constraint occurrences. 2016-01-08 15:11:09 +01:00
Fedor Isakov 8aa6b04c70 Extract away program builder-related stuff: this part is going to be provided by the reactor's client 2016-01-07 12:07:55 +01:00
Fedor Isakov c3bfcc9311 Updated API sources from the latest version of Logic. Adapted to the new API. 2016-01-06 20:30:54 +01:00
Fedor Isakov 2f38824ed5 Updated API sources from the latest version of Logic. Adapted to the new API. 2015-12-27 23:42:58 +01:00
Fedor Isakov 20948a859c First real program working 2015-12-25 10:32:05 +01:00
Fedor Isakov a3346ae57f Adapting to changes in the API. Implemented LogicalContext. Generifying code in tests. Testing LogicalPattern. 2015-12-23 16:26:35 +01:00
Fedor Isakov 51bcebfc01 Small refactorings and code cleanup in tests 2015-12-22 18:42:06 +01:00