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.solver.proj;
18  
19  import io.github.tonywasher.joceanus.metis.field.MetisFieldSet;
20  import io.github.tonywasher.joceanus.themis.parser.base.ThemisDataResource;
21  import io.github.tonywasher.joceanus.themis.parser.base.ThemisInstance.ThemisMethodInstance;
22  import io.github.tonywasher.joceanus.themis.solver.proj.ThemisSolverDef.ThemisSolverClassDef;
23  import io.github.tonywasher.joceanus.themis.solver.proj.ThemisSolverDef.ThemisSolverMethodDef;
24  
25  /**
26   * Solver Method.
27   */
28  public class ThemisSolverMethod
29          implements ThemisSolverMethodDef {
30      /**
31       * Report fields.
32       */
33      private static final MetisFieldSet<ThemisSolverMethod> FIELD_DEFS = MetisFieldSet.newFieldSet(ThemisSolverMethod.class);
34  
35      /*
36       * Declare Fields.
37       */
38      static {
39          FIELD_DEFS.declareLocalField(ThemisDataResource.DATA_UNDERLYING, ThemisSolverMethod::getUnderlyingMethod);
40      }
41  
42      /**
43       * The owning class.
44       */
45      private final ThemisSolverClassDef theClass;
46  
47      /**
48       * The contained method.
49       */
50      private final ThemisMethodInstance theMethod;
51  
52      /**
53       * Constructor.
54       *
55       * @param pClass  the owning class
56       * @param pMethod the parsed method
57       */
58      ThemisSolverMethod(final ThemisSolverClassDef pClass,
59                         final ThemisMethodInstance pMethod) {
60          /* Store the parameters */
61          theClass = pClass;
62          theMethod = pMethod;
63      }
64  
65      @Override
66      public MetisFieldSet<ThemisSolverMethod> getDataFieldSet() {
67          return FIELD_DEFS;
68      }
69  
70      @Override
71      public ThemisSolverClassDef getOwningClass() {
72          return theClass;
73      }
74  
75      @Override
76      public ThemisMethodInstance getUnderlyingMethod() {
77          return theMethod;
78      }
79  }