Switched codecs infrastructure to use yang-data-impl codecs
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / test / java / org / opendaylight / controller / sal / restconf / impl / test / structures / Lf.java
1 package org.opendaylight.controller.sal.restconf.impl.test.structures;
2
3 public class Lf extends YangElement {
4     private Object value;
5     private int numOfEqualItems = 0;
6
7     public Lf(String name, Object value) {
8         super(name);
9         this.value = value;
10     }
11
12     public Lf(Object value) {
13         super("");
14         this.value = value;
15     }
16
17     public Object getValue() {
18         return value;
19     }
20
21     @Override
22     public boolean equals(Object obj) {
23         if (this == obj) {
24             return true;
25         }
26         if (!this.getClass().equals(obj.getClass())) {
27             return false;
28         }
29         if (!super.equals(obj)) {
30             return false;
31         }
32         Lf lf = (Lf) obj;
33         if (this.value == null) {
34             if (lf.value != null) {
35                 return false;
36             }
37         } else if (!this.value.equals(lf.value)) {
38             return false;
39         }
40         if (this.numOfEqualItems != lf.numOfEqualItems) {
41             return false;
42         }
43         return true;
44     }
45
46     public void incNumOfEqualItems() {
47         this.numOfEqualItems++;
48     }
49
50     @Override
51     public int hashCode() {
52         final int prime = 31;
53         int result = super.hashCode();
54         result = prime * result + ((value == null) ? 0 : value.hashCode());
55         result = prime * result + numOfEqualItems;
56         return result;
57     }
58
59     @Override
60     public String toString() {
61         return super.toString() + ":" + value;
62     }
63
64 }