2 * Copyright (c) 2015 Pantheon Technologies 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.model.util.type;
10 import com.google.common.collect.ImmutableList;
11 import java.util.Collection;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
15 import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition;
17 final class BaseBitsType extends AbstractBaseType<BitsTypeDefinition> implements BitsTypeDefinition {
18 private final @NonNull ImmutableList<Bit> bits;
20 BaseBitsType(final QName qname, final Collection<? extends UnknownSchemaNode> unknownSchemaNodes,
21 final Collection<Bit> bits) {
22 super(qname, unknownSchemaNodes);
23 this.bits = ImmutableList.copyOf(bits);
26 private BaseBitsType(final BaseBitsType original, final QName qname) {
27 super(original, qname);
28 this.bits = original.bits;
32 BaseBitsType bindTo(final QName newQName) {
33 return new BaseBitsType(this, newQName);
37 public Collection<? extends Bit> getBits() {
42 public int hashCode() {
43 return BitsTypeDefinition.hashCode(this);
47 public boolean equals(final Object obj) {
48 return BitsTypeDefinition.equals(this, obj);
52 public String toString() {
53 return BitsTypeDefinition.toString(this);