4a5c750667a835ab9b5fc99a80c92a7d7f38c179
[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      * {@inheritDoc}.
75      */
76     @Override
77     public int hashCode() {
78         final int prime = HASH_PRIME_1;
79         int result = 1;
80         result = prime * result + ((mapValue == null) ? 0 : mapValue.hashCode());
81         return result;
82     }
83
84     /**
85      * {@inheritDoc}.
86      */
87     @Override
88     public boolean equals(final Object obj) {
89         if (this == obj) {
90             return true;
91         }
92         if (obj == null) {
93             return false;
94         }
95         if (getClass() != obj.getClass()) {
96             return false;
97         }
98         final TestContextTreeMapItem other = (TestContextTreeMapItem) obj;
99         if (mapValue == null) {
100             if (other.mapValue != null) {
101                 return false;
102             }
103         } else if (!mapValue.equals(other.mapValue)) {
104             return false;
105         }
106         return true;
107     }
108
109     /**
110      * {@inheritDoc}.
111      */
112     @Override
113     public String toString() {
114         return "TestContextItem00C [mapValue=" + mapValue + "]";
115     }
116
117 }