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.solver.proj;
18
19 import io.github.tonywasher.joceanus.themis.parser.ThemisParser;
20 import io.github.tonywasher.joceanus.themis.parser.proj.ThemisModule;
21 import io.github.tonywasher.joceanus.themis.parser.proj.ThemisProject;
22 import io.github.tonywasher.joceanus.themis.solver.proj.ThemisSolverDef.ThemisSolverProjectDef;
23
24 import java.util.ArrayList;
25 import java.util.List;
26
27 /**
28 * Solver Project.
29 */
30 public class ThemisSolverProject
31 implements ThemisSolverProjectDef {
32 /**
33 * The project parser.
34 */
35 private final ThemisParser theParser;
36
37 /**
38 * The underlying project.
39 */
40 private final ThemisProject theProject;
41
42 /**
43 * The list of modules.
44 */
45 private final List<ThemisSolverModule> theModules;
46
47 /**
48 * Constructor.
49 *
50 * @param pParser the analysis parser
51 */
52 public ThemisSolverProject(final ThemisParser 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 (ThemisModule myModule : theProject.getModules()) {
62 theModules.add(new ThemisSolverModule(this, myModule));
63 }
64 }
65
66 /**
67 * Obtain the project parser.
68 *
69 * @return the parser
70 */
71 public ThemisParser getProjectParser() {
72 return theParser;
73 }
74
75 @Override
76 public ThemisProject getUnderlyingProject() {
77 return theProject;
78 }
79
80 /**
81 * Obtain the modules.
82 *
83 * @return the modules
84 */
85 public List<ThemisSolverModule> getModules() {
86 return theModules;
87 }
88
89 @Override
90 public String toString() {
91 return theProject.toString();
92 }
93 }