2 * Copyright (c) 2013 Cisco Systems, Inc. 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.model.api.type;
10 import java.util.Collection;
11 import java.util.Objects;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.eclipse.jdt.annotation.Nullable;
14 import org.opendaylight.yangtools.yang.common.Uint32;
15 import org.opendaylight.yangtools.yang.model.api.DocumentedNode;
16 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
19 * Makes is possible to access to the individual bits values of this type.
21 public interface BitsTypeDefinition extends TypeDefinition<BitsTypeDefinition> {
23 * Returns all bit values.
25 * @return list of {@code Bit} type instances with data about all individual bits of {@code bits} YANG built-in type
27 @NonNull Collection<? extends Bit> getBits();
29 static int hashCode(final @NonNull BitsTypeDefinition type) {
30 return Objects.hash(type.getQName(), type.getUnknownSchemaNodes(), type.getBaseType(),
31 type.getUnits().orElse(null), type.getDefaultValue().orElse(null), type.getBits());
34 static boolean equals(final @NonNull BitsTypeDefinition type, final @Nullable Object obj) {
39 final BitsTypeDefinition other = TypeDefinitions.castIfEquals(BitsTypeDefinition.class, type, obj);
40 return other != null && type.getBits().equals(other.getBits());
43 static String toString(final @NonNull BitsTypeDefinition type) {
44 return TypeDefinitions.toStringHelper(type).add("bits", type.getBits()).toString();
48 * Contains the methods for accessing the data about the individual bit of
49 * <code>bits</code> YANG type.
51 interface Bit extends DocumentedNode.WithStatus {
53 * Returns the name of the concrete bit.
55 * @return string with the name of the concrete bit
57 @NonNull String getName();
60 * The position value MUST be in the range 0 to 4294967295, and it MUST
61 * be unique within the bits type.
63 * @return The position value of bit in range from 0 to 4294967295.
65 @NonNull Uint32 getPosition();