3e3aae121d695272af6367a14629023aced2c480
[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         // Default constructor
43     }
44
45     /**
46      * The Constructor.
47      *
48      * @param mapValue the map value
49      */
50     public TestContextTreeMapItem(final Map<String, String> mapValue) {
51         this.mapValue = mapValue;
52     }
53
54     /**
55      * Gets the map value.
56      *
57      * @return the map value
58      */
59     public Map<String, String> getMapValue() {
60         if (mapValue == null) {
61             mapValue = new TreeMap<>();
62         }
63         return mapValue;
64     }
65
66     /**
67      * Sets the map value.
68      *
69      * @param mapValue the map value
70      */
71     public void setMapValue(final Map<String, String> mapValue) {
72         this.mapValue = mapValue;
73     }
74
75     /**
76      * {@inheritDoc}.
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      * {@inheritDoc}.
88      */
89     @Override
90     public boolean equals(final Object obj) {
91         if (this == obj) {
92             return true;
93         }
94         if (obj == null) {
95             return false;
96         }
97         if (getClass() != obj.getClass()) {
98             return false;
99         }
100         final TestContextTreeMapItem other = (TestContextTreeMapItem) obj;
101         if (mapValue == null) {
102             if (other.mapValue != null) {
103                 return false;
104             }
105         } else if (!mapValue.equals(other.mapValue)) {
106             return false;
107         }
108         return true;
109     }
110
111     /**
112      * {@inheritDoc}.
113      */
114     @Override
115     public String toString() {
116         return "TestContextItem00C [mapValue=" + mapValue + "]";
117     }
118
119 }