2 * Copyright (c) 2021 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.spi.meta;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.annotations.Beta;
13 import com.google.common.base.MoreObjects.ToStringHelper;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaTreeEffectiveStatement;
18 * Simple {@link EffectiveStatementState} for use with typical {@link SchemaTreeEffectiveStatement}s. It differentiates
19 * on QName and an {@code int} flags field.
22 public final class QNameWithFlagsEffectiveStatementState extends EffectiveStatementState {
23 private final QName qname;
24 private final int flags;
26 public QNameWithFlagsEffectiveStatementState(final QName qname, final int flags) {
27 this.qname = requireNonNull(qname);
32 public int hashCode() {
33 return qname.hashCode() * 31 + Integer.hashCode(flags);
37 public boolean equals(final Object obj) {
41 if (!(obj instanceof QNameWithFlagsEffectiveStatementState)) {
44 final var other = (QNameWithFlagsEffectiveStatementState) obj;
45 return flags == other.flags && qname.equals(other.qname);
49 protected ToStringHelper addToStringAttributes(final ToStringHelper helper) {
50 return helper.add("qname", qname).add("flags", flags);