alpha-asp / Alpha

A lazy-grounding Answer-Set Programming system
BSD 2-Clause "Simplified" License
58 stars 10 forks source link

Refactoring: Decouple API implementation from config structures #336

Open madmike200590 opened 2 years ago

madmike200590 commented 2 years ago

The aim of this PR is to get rid of all dependencies between SystemConfig and API implementations (like AlphaImpl, NaiveGrounder, DefaultSolver etc). The idea is that these objects should get their dependencies at the time of construction from an external source (AlphaFactory as it is implemented now) and not need to be aware of any configuration mechanisms or structures themselves.

The same mechanism of obtaining Alpha instances (only through AlphaFactory) has been applied to all tests that test complete workflows (i.e. tests constituting end-to-end-tests in that they test the complete system rather than a single unit of code) as well. These tests (everything annotated RegressionTest or AggregateRegressionTest) have been moved to the alpha-solver module and adapted to be parameterized using a SystemConfig which is used to obtain an Alpha instance from the factory.

Additional changes:

codecov[bot] commented 2 years ago

Codecov Report

Merging #336 (1b04d74) into refactor-tests (515949e) will decrease coverage by 32.76%. The diff coverage is 34.24%.

Impacted file tree graph

@@                  Coverage Diff                  @@
##             refactor-tests     #336       +/-   ##
=====================================================
- Coverage             71.11%   38.35%   -32.77%     
+ Complexity             2167     1200      -967     
=====================================================
  Files                   182      185        +3     
  Lines                  8033     8073       +40     
  Branches               1424     1422        -2     
=====================================================
- Hits                   5713     3096     -2617     
- Misses                 1938     4639     +2701     
+ Partials                382      338       -44     
Impacted Files Coverage Δ
.../tuwien/kr/alpha/app/config/CommandLineParser.java 82.47% <ø> (-0.42%) :arrow_down:
...tuwien/kr/alpha/core/grounder/GrounderFactory.java 0.00% <0.00%> (-50.00%) :arrow_down:
...c/tuwien/kr/alpha/core/grounder/NaiveGrounder.java 45.38% <0.00%> (-35.19%) :arrow_down:
...tuwien/kr/alpha/core/parser/ProgramParserImpl.java 65.30% <0.00%> (-12.25%) :arrow_down:
...wien/kr/alpha/core/programs/NormalProgramImpl.java 100.00% <ø> (ø)
.../at/ac/tuwien/kr/alpha/core/programs/Programs.java 0.00% <ø> (-50.00%) :arrow_down:
.../programs/transformation/EnumerationRewriting.java 0.00% <0.00%> (-85.72%) :arrow_down:
...transformation/NormalizeProgramTransformation.java 0.00% <0.00%> (-100.00%) :arrow_down:
...programs/transformation/PredicateInternalizer.java 0.00% <0.00%> (-74.20%) :arrow_down:
.../programs/transformation/StratifiedEvaluation.java 0.00% <0.00%> (-97.80%) :arrow_down:
... and 110 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 515949e...1b04d74. Read the comment docs.