2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.list;
10 import com.google.common.collect.ImmutableList;
11 import java.util.Optional;
12 import org.opendaylight.yangtools.concepts.Immutable;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.ElementCountConstraint;
15 import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
16 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
17 import org.opendaylight.yangtools.yang.model.api.stmt.ListStatement;
19 final class RegularListEffectiveStatement extends AbstractListEffectiveStatement {
20 private final ElementCountConstraint elementCountConstraint;
21 private final ListSchemaNode original;
23 RegularListEffectiveStatement(final ListStatement declared, final Immutable path, final int flags,
24 final ImmutableList<? extends EffectiveStatement<?, ?>> substatements,
25 final ImmutableList<QName> keyDefinition, final ElementCountConstraint elementCountConstraint,
26 final ListSchemaNode original) {
27 super(declared, path, flags, substatements, keyDefinition);
28 this.elementCountConstraint = elementCountConstraint;
29 this.original = original;
32 RegularListEffectiveStatement(final RegularListEffectiveStatement originalEffective, final ListSchemaNode original,
33 final Immutable path, final int flags) {
34 super(originalEffective, path, flags);
35 this.elementCountConstraint = originalEffective.elementCountConstraint;
36 this.original = original;
39 RegularListEffectiveStatement(final EmptyListEffectiveStatement originalEffective, final ListSchemaNode original,
40 final Immutable path, final int flags) {
41 super(originalEffective, path, flags);
42 this.elementCountConstraint = null;
43 this.original = original;
47 public Optional<ListSchemaNode> getOriginal() {
48 return Optional.ofNullable(original);
52 public Optional<ElementCountConstraint> getElementCountConstraint() {
53 return Optional.ofNullable(elementCountConstraint);