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.base.Preconditions;
11 import com.google.common.collect.ImmutableList;
12 import java.util.Collection;
13 import java.util.List;
14 import javax.annotation.Nonnull;
15 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
16 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
17 import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition;
19 final class RestrictedBitsType extends AbstractRestrictedType<BitsTypeDefinition> implements BitsTypeDefinition {
20 private final List<Bit> bits;
22 RestrictedBitsType(final BitsTypeDefinition baseType, final SchemaPath path,
23 final Collection<UnknownSchemaNode> unknownSchemaNodes, final Collection<Bit> bits) {
24 super(baseType, path, unknownSchemaNodes);
25 this.bits = ImmutableList.copyOf(Preconditions.checkNotNull(bits));
30 public List<Bit> getBits() {
35 public int hashCode() {
36 return BitsTypeDefinition.hashCode(this);
40 public boolean equals(final Object obj) {
41 return BitsTypeDefinition.equals(this, obj);
45 public String toString() {
46 return BitsTypeDefinition.toString(this);