1   /*
2    * SPDX-FileCopyrightText: none
3    * SPDX-License-Identifier: CC0-1.0
4    */
5   
6   package gov.nist.secauto.metaschema.core.metapath.cst;
7   
8   import gov.nist.secauto.metaschema.core.metapath.IExpression;
9   
10  import java.util.List;
11  import java.util.Objects;
12  
13  import edu.umd.cs.findbugs.annotations.NonNull;
14  
15  /**
16   * An immutable expression that has a number of sub-expression children.
17   */
18  public abstract class AbstractNAryExpression
19      extends AbstractExpression {
20    @NonNull
21    private final List<IExpression> children;
22  
23    /**
24     * Construct a new n-ary expression.
25     *
26     * @param text
27     *          the parsed text of the expression
28     * @param children
29     *          the sub-expression children
30     */
31    public AbstractNAryExpression(@NonNull String text, @NonNull List<IExpression> children) {
32      super(text);
33      this.children = Objects.requireNonNull(children);
34    }
35  
36    @Override
37    public List<IExpression> getChildren() {
38      return children;
39    }
40  }