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 edu.umd.cs.findbugs.annotations.NonNull;
9   
10  public interface IFlagInstance extends IFlag, IValuedInstance, IInstanceAbsolute {
11  
12    boolean DEFAULT_FLAG_REQUIRED = false;
13  
14    @Override
15    IModelDefinition getParentContainer();
16  
17    @Override
18    IFlagDefinition getDefinition();
19  
20    @Override
21    default IModelDefinition getContainingDefinition() {
22      return getParentContainer();
23    }
24  
25    /**
26     * Determines if a flag value is required to be provided.
27     *
28     * @return {@code true} if a value is required, or {@code false} otherwise
29     * @see #DEFAULT_FLAG_REQUIRED
30     */
31    default boolean isRequired() {
32      return DEFAULT_FLAG_REQUIRED;
33    }
34  
35    /**
36     * A visitor callback.
37     *
38     * @param <CONTEXT>
39     *          the type of the context parameter
40     * @param <RESULT>
41     *          the type of the visitor result
42     * @param visitor
43     *          the calling visitor
44     * @param context
45     *          a parameter used to pass contextual information between visitors
46     * @return the visitor result
47     */
48    @Override
49    default <CONTEXT, RESULT> RESULT accept(@NonNull IModelElementVisitor<CONTEXT, RESULT> visitor, CONTEXT context) {
50      return visitor.visitFlagInstance(this, context);
51    }
52  }