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  import edu.umd.cs.findbugs.annotations.Nullable;
12  
13  /**
14   * Represents a model container with grouped instances.
15   * <p>
16   * Grouped instances are part of a choice group and share a common group-as
17   * name. This interface narrows the return types of {@link IContainerModel}
18   * methods to grouped instance types.
19   */
20  public interface IContainerModelGrouped extends IContainerModel {
21  
22    @Override
23    IAssemblyDefinition getOwningDefinition();
24  
25    @Override
26    @NonNull
27    default Collection<? extends INamedModelInstanceGrouped> getModelInstances() {
28      return getNamedModelInstances();
29    }
30  
31    /**
32     * Get all named model instances within the container.
33     *
34     * @return the named model instances in this container
35     */
36    @Override
37    @NonNull
38    Collection<? extends INamedModelInstanceGrouped> getNamedModelInstances();
39  
40    /**
41     * Get the model instance contained within the model with the associated use
42     * name.
43     *
44     * @param name
45     *          the effective name of the model instance
46     * @return the matching model instance, or {@code null} if no match was found
47     * @see INamedModelInstance#getEffectiveName()
48     */
49    @Override
50    @Nullable
51    INamedModelInstanceGrouped getNamedModelInstanceByName(Integer name);
52  
53    /**
54     * Get all field instances within the container.
55     *
56     * @return the field instances in this container
57     */
58    @Override
59    @NonNull
60    Collection<? extends IFieldInstanceGrouped> getFieldInstances();
61  
62    /**
63     * Get the field instance contained within the model with the associated use
64     * name.
65     *
66     * @param name
67     *          the use name of the field instance
68     * @return the matching field instance, or {@code null} if no match was found
69     * @see IFieldInstance#getUseName()
70     */
71    @Override
72    @Nullable
73    IFieldInstanceGrouped getFieldInstanceByName(Integer name);
74  
75    /**
76     * Get all assembly instances within the container.
77     *
78     * @return the assembly instances in this container
79     */
80    @Override
81    @NonNull
82    Collection<? extends IAssemblyInstanceGrouped> getAssemblyInstances();
83  
84    /**
85     * Get the assembly instance contained within the model with the associated use
86     * name.
87     *
88     * @param name
89     *          the effective name of the assembly instance
90     * @return the matching assembly instance, or {@code null} if no match was found
91     * @see INamedModelInstance#getEffectiveName()
92     */
93    @Override
94    @Nullable
95    IAssemblyInstanceGrouped getAssemblyInstanceByName(Integer name);
96  }