9111109fe17c1c2219810c40b71c00b9d58175f2
[policy/apex-pdp.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
4  *  Modifications Copyright (C) 2019 Nordix Foundation.
5  * ================================================================================
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * SPDX-License-Identifier: Apache-2.0
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.policy.apex.context.test.concepts;
23
24 import java.io.Serializable;
25 import java.util.Map;
26 import java.util.TreeMap;
27
28 /**
29  * The Class TestContextItem00C.
30  */
31 public class TestContextTreeMapItem implements Serializable {
32     private static final long serialVersionUID = -7497746259264651884L;
33
34     private static final int HASH_PRIME_1 = 31;
35
36     private Map<String, String> mapValue = new TreeMap<>();
37
38     /**
39      * The Constructor.
40      */
41     public TestContextTreeMapItem() {}
42
43     /**
44      * The Constructor.
45      *
46      * @param mapValue the map value
47      */
48     public TestContextTreeMapItem(final Map<String, String> mapValue) {
49         this.mapValue = mapValue;
50     }
51
52     /**
53      * Gets the map value.
54      *
55      * @return the map value
56      */
57     public Map<String, String> getMapValue() {
58         if (mapValue == null) {
59             mapValue = new TreeMap<>();
60         }
61         return mapValue;
62     }
63
64     /**
65      * Sets the map value.
66      *
67      * @param mapValue the map value
68      */
69     public void setMapValue(final Map<String, String> mapValue) {
70         this.mapValue = mapValue;
71     }
72
73     /*
74      * (non-Javadoc)
75      *
76      * @see java.lang.Object#hashCode()
77      */
78     @Override
79     public int hashCode() {
80         final int prime = HASH_PRIME_1;
81         int result = 1;
82         result = prime * result + ((mapValue == null) ? 0 : mapValue.hashCode());
83         return result;
84     }
85
86     /*
87      * (non-Javadoc)
88      *
89      * @see java.lang.Object#equals(java.lang.Object)
90      */
91     @Override
92     public boolean equals(final Object obj) {
93         if (this == obj) {
94             return true;
95         }
96         if (obj == null) {
97             return false;
98         }
99         if (getClass() != obj.getClass()) {
100             return false;
101         }
102         final TestContextTreeMapItem other = (TestContextTreeMapItem) obj;
103         if (mapValue == null) {
104             if (other.mapValue != null) {
105                 return false;
106             }
107         } else if (!mapValue.equals(other.mapValue)) {
108             return false;
109         }
110         return true;
111     }
112
113     /*
114      * (non-Javadoc)
115      *
116      * @see java.lang.Object#toString()
117      */
118     @Override
119     public String toString() {
120         return "TestContextItem00C [mapValue=" + mapValue + "]";
121     }
122
123 }