View Javadoc
1   /*
2    * Themis: Java Project Framework
3    * Copyright 2012-2026. Tony Washer
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6    * use this file except in compliance with the License.  You may obtain a copy
7    * of the License at
8    *
9    *   http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
14   * License for the specific language governing permissions and limitations under
15   * the License.
16   */
17  package io.github.tonywasher.joceanus.themis.xanalysis.solver.proj;
18  
19  import io.github.tonywasher.joceanus.themis.xanalysis.parser.ThemisXAnalysisParser;
20  import io.github.tonywasher.joceanus.themis.xanalysis.parser.proj.ThemisXAnalysisModule;
21  import io.github.tonywasher.joceanus.themis.xanalysis.parser.proj.ThemisXAnalysisProject;
22  import io.github.tonywasher.joceanus.themis.xanalysis.solver.proj.ThemisXAnalysisSolverDef.ThemisXAnalysisSolverProjectDef;
23  
24  import java.util.ArrayList;
25  import java.util.List;
26  
27  /**
28   * Solver Project.
29   */
30  public class ThemisXAnalysisSolverProject
31          implements ThemisXAnalysisSolverProjectDef {
32      /**
33       * The project parser.
34       */
35      private final ThemisXAnalysisParser theParser;
36  
37      /**
38       * The underlying project.
39       */
40      private final ThemisXAnalysisProject theProject;
41  
42      /**
43       * The list of modules.
44       */
45      private final List<ThemisXAnalysisSolverModule> theModules;
46  
47      /**
48       * Constructor.
49       *
50       * @param pParser the analysis parser
51       */
52      public ThemisXAnalysisSolverProject(final ThemisXAnalysisParser pParser) {
53          /* Store the parameters */
54          theParser = pParser;
55          theProject = theParser.getProject();
56  
57          /* Create the Module list and parser */
58          theModules = new ArrayList<>();
59  
60          /* Initialise the modules */
61          for (ThemisXAnalysisModule myModule : theProject.getModules()) {
62              theModules.add(new ThemisXAnalysisSolverModule(this, myModule));
63          }
64      }
65  
66      /**
67       * Obtain the project parser.
68       *
69       * @return the parser
70       */
71      public ThemisXAnalysisParser getProjectParser() {
72          return theParser;
73      }
74  
75      @Override
76      public ThemisXAnalysisProject getUnderlyingProject() {
77          return theProject;
78      }
79  
80      /**
81       * Obtain the modules.
82       *
83       * @return the modules
84       */
85      public List<ThemisXAnalysisSolverModule> getModules() {
86          return theModules;
87      }
88  
89      @Override
90      public String toString() {
91          return theProject.toString();
92      }
93  }