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.HashMap;
13 public class LstItem {
16 Map<String, LfLst> lfLsts;
17 Map<String, Lst> lsts;
18 Map<String, Cont> conts;
19 private int numOfEqualItems = 0;
22 lfs = new HashMap<>();
23 conts = new HashMap<>();
24 lfLsts = new HashMap<>();
25 lsts = new HashMap<>();
28 public Map<String, Lst> getLsts() {
32 public Map<String, Cont> getConts() {
36 public Map<String, LfLst> getLfLsts() {
40 public Map<String, Lf> getLfs() {
44 public String getLstName() {
48 public LstItem addLf(Lf lf) {
49 lfs.put(lf.getName(), lf);
53 public LstItem addLf(String name, Object value) {
54 lfs.put(name, new Lf(name, value));
58 public void addLfLst(LfLst lfLst) {
59 lfLsts.put(lfLst.getName(), lfLst);
62 public void addLst(Lst lst) {
63 lsts.put(lst.getName(), lst);
66 public void addCont(Cont cont) {
67 conts.put(cont.getName(), cont);
70 public void incNumOfEqualItems() {
71 this.numOfEqualItems++;
75 public boolean equals(Object obj) {
79 if (!this.getClass().equals(obj.getClass())) {
82 LstItem lstItem = (LstItem) obj;
83 if (this.conts == null) {
84 if (lstItem.conts != null) {
87 } else if (!this.conts.equals(lstItem.conts)) {
90 if (this.lfs == null) {
91 if (lstItem.lfs != null) {
94 } else if (!this.lfs.equals(lstItem.lfs)) {
97 if (this.lfLsts == null) {
98 if (lstItem.lfLsts != null) {
101 } else if (!this.lfLsts.equals(lstItem.lfLsts)) {
104 if (this.lsts == null) {
105 if (lstItem.lsts != null) {
108 } else if (!this.lsts.equals(lstItem.lsts)) {
111 if (this.numOfEqualItems != lstItem.numOfEqualItems) {
118 public int hashCode() {
119 final int prime = 31;
121 result = prime * result + ((lfs == null) ? 0 : lfs.hashCode());
122 result = prime * result + ((lfLsts == null) ? 0 : lfLsts.hashCode());
123 result = prime * result + ((lsts == null) ? 0 : lsts.hashCode());
124 result = prime * result + ((conts == null) ? 0 : conts.hashCode());
125 result = prime * result + numOfEqualItems;
130 public String toString() {
131 return "lst item of " + lstName;
134 public void setLstName(String name) {