Add missing copyright text
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / test / java / org / opendaylight / controller / sal / restconf / impl / test / structures / Lf.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.sal.restconf.impl.test.structures;
9
10 public class Lf extends YangElement {
11     private Object value;
12     private int numOfEqualItems = 0;
13
14     public Lf(String name, Object value) {
15         super(name);
16         this.value = value;
17     }
18
19     public Lf(Object value) {
20         super("");
21         this.value = value;
22     }
23
24     public Object getValue() {
25         return value;
26     }
27
28     @Override
29     public boolean equals(Object obj) {
30         if (this == obj) {
31             return true;
32         }
33         if (!this.getClass().equals(obj.getClass())) {
34             return false;
35         }
36         if (!super.equals(obj)) {
37             return false;
38         }
39         Lf lf = (Lf) obj;
40         if (this.value == null) {
41             if (lf.value != null) {
42                 return false;
43             }
44         } else if (!this.value.equals(lf.value)) {
45             return false;
46         }
47         if (this.numOfEqualItems != lf.numOfEqualItems) {
48             return false;
49         }
50         return true;
51     }
52
53     public void incNumOfEqualItems() {
54         this.numOfEqualItems++;
55     }
56
57     @Override
58     public int hashCode() {
59         final int prime = 31;
60         int result = super.hashCode();
61         result = prime * result + ((value == null) ? 0 : value.hashCode());
62         result = prime * result + numOfEqualItems;
63         return result;
64     }
65
66     @Override
67     public String toString() {
68         return super.toString() + ":" + value;
69     }
70
71 }