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