/* * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.yangtools.yang.model.ri.stmt.impl.eff; import com.google.common.collect.ImmutableList; import java.util.Collection; import java.util.Optional; import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.CaseSchemaNode; import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode; import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; import org.opendaylight.yangtools.yang.model.api.stmt.ChoiceEffectiveStatement; import org.opendaylight.yangtools.yang.model.api.stmt.ChoiceStatement; import org.opendaylight.yangtools.yang.model.spi.meta.AbstractDeclaredEffectiveStatement.DefaultWithDataTree; import org.opendaylight.yangtools.yang.model.spi.meta.EffectiveStatementMixins.AugmentationTargetMixin; import org.opendaylight.yangtools.yang.model.spi.meta.EffectiveStatementMixins.DataSchemaNodeMixin; import org.opendaylight.yangtools.yang.model.spi.meta.EffectiveStatementMixins.MandatoryMixin; public abstract class AbstractChoiceEffectiveStatement extends DefaultWithDataTree implements ChoiceEffectiveStatement, ChoiceSchemaNode, DataSchemaNodeMixin, AugmentationTargetMixin, MandatoryMixin { private final int flags; AbstractChoiceEffectiveStatement(final ChoiceStatement declared, final ImmutableList> substatements, final int flags) { super(declared, substatements); this.flags = flags; } AbstractChoiceEffectiveStatement(final AbstractChoiceEffectiveStatement original, final int flags) { super(original); this.flags = flags; } @Override public final int flags() { return flags; } @Override public final Optional findCaseNode(final QName qname) { return filterOptional(findSchemaTreeNode(qname), CaseSchemaNode.class); } @Override public final Collection getCases() { return filterEffectiveStatements(CaseSchemaNode.class); } @Override public final ChoiceEffectiveStatement asEffectiveStatement() { return this; } }