1   /*
2    * SPDX-FileCopyrightText: none
3    * SPDX-License-Identifier: CC0-1.0
4    */
5   
6   package gov.nist.secauto.metaschema.core.model;
7   
8   import java.util.Collection;
9   
10  import edu.umd.cs.findbugs.annotations.NonNull;
11  
12  /**
13   * Common interface for model container support classes.
14   *
15   * @param <MI>
16   *          the model instance Java type
17   * @param <NMI>
18   *          the named model instance Java type
19   * @param <FI>
20   *          the field instance Java type
21   * @param <AI>
22   *          the assembly instance Java type
23   */
24  public interface IFeatureContainerModelAbsolute<
25      MI extends IModelInstanceAbsolute,
26      NMI extends INamedModelInstanceAbsolute,
27      FI extends IFieldInstanceAbsolute,
28      AI extends IAssemblyInstanceAbsolute>
29      extends IContainerModelAbsolute, IContainerModel {
30    /**
31     * Get the model container implementation instance.
32     *
33     * @return the model container instance
34     */
35    @NonNull
36    IContainerModelSupport<MI, NMI, FI, AI> getModelContainer();
37  
38    @Override
39    default Collection<? extends MI> getModelInstances() {
40      return getModelContainer().getModelInstances();
41    }
42  
43    @Override
44    default NMI getNamedModelInstanceByName(Integer name) {
45      return getModelContainer().getNamedModelInstanceMap().get(name);
46    }
47  
48    @SuppressWarnings("null")
49    @Override
50    default Collection<NMI> getNamedModelInstances() {
51      return getModelContainer().getNamedModelInstanceMap().values();
52    }
53  
54    @Override
55    default FI getFieldInstanceByName(Integer name) {
56      return getModelContainer().getFieldInstanceMap().get(name);
57    }
58  
59    @SuppressWarnings("null")
60    @Override
61    default Collection<FI> getFieldInstances() {
62      return getModelContainer().getFieldInstanceMap().values();
63    }
64  
65    @Override
66    default AI getAssemblyInstanceByName(Integer name) {
67      return getModelContainer().getAssemblyInstanceMap().get(name);
68    }
69  
70    @SuppressWarnings("null")
71    @Override
72    default Collection<AI> getAssemblyInstances() {
73      return getModelContainer().getAssemblyInstanceMap().values();
74    }
75  }