2 * Copyright (c) 2014 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.controller.sal.restconf.impl.test.structures;
10 import java.util.HashSet;
13 public class Lst extends YangElement {
14 private final Set<LstItem> lstItems;
16 public Lst(final String name) {
18 lstItems = new HashSet<>();
21 public Lst addLstItem(final LstItem lstItem) {
22 lstItem.setLstName(name);
23 while (this.lstItems.contains(lstItem)) {
24 lstItem.incNumOfEqualItems();
26 this.lstItems.add(lstItem);
30 public Set<LstItem> getLstItems() {
35 public boolean equals(final Object obj) {
39 if (!this.getClass().equals(obj.getClass())) {
42 if (!super.equals(obj)) {
46 if (this.lstItems == null) {
47 if (lst.lstItems != null) {
50 } else if (!this.lstItems.equals(lst.lstItems)) {
57 public int hashCode() {
59 int result = super.hashCode();
60 result = prime * result + ((lstItems == null) ? 0 : lstItems.hashCode());