Test composite node with empty conts and lists to Json
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / test / java / org / opendaylight / controller / sal / restconf / impl / test / structures / LfLst.java
1 package org.opendaylight.controller.sal.restconf.impl.test.structures;
2
3 import java.util.*;
4
5 public class LfLst extends YangElement {
6     Set<Lf> lfs;
7
8     public LfLst(String name) {
9         super(name);
10         lfs = new HashSet<>();
11     }
12
13     public LfLst addLf(String value) {
14         return addLf(new Lf(value));
15     }
16
17     
18     public LfLst addLf(Lf lf) {
19         while (this.lfs.contains(lf)) {
20             lf.incNumOfEqualItems();
21         }
22         this.lfs.add(lf);
23         return this;
24     }
25
26     public Set<Lf> getLfs() {
27         return lfs;
28     }
29
30     @Override
31     public boolean equals(Object obj) {
32         if (this == obj) {
33             return true;
34         }
35         if (!this.getClass().equals(obj.getClass())) {
36             return false;
37         }
38         if (!super.equals(obj)) {
39             return false;
40         }
41         LfLst lfLst = (LfLst) obj;
42         if (this.lfs == null) {
43             if (lfLst.lfs != null) {
44                 return false;
45             }
46         } else if (!this.lfs.equals(lfLst.lfs)) {
47             return false;
48         }
49         return true;
50     }
51
52     @Override
53     public int hashCode() {
54         final int prime = 31;
55         int result = super.hashCode();
56         result = prime * result + ((lfs == null) ? 0 : lfs.hashCode());
57         return result;
58     }
59
60     @Override
61     public String toString() {
62
63         return super.toString();
64     }
65
66 }