e38d9c64042adcf2a99dec6d13729d695ceee880
[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.SortedSet;
26 import java.util.TreeSet;
27
28 /**
29  * The Class TestContextItem00B.
30  */
31 public class TestContextTreeSetItem implements Serializable {
32     private static final long serialVersionUID = 1254589722957250388L;
33
34     private static final int HASH_PRIME_1 = 31;
35
36     private SortedSet<String> setValue = new TreeSet<>();
37
38     /**
39      * The Constructor.
40      */
41     public TestContextTreeSetItem() {}
42
43     /**
44      * The Constructor.
45      *
46      * @param setArray the set array
47      */
48     public TestContextTreeSetItem(final String[] setArray) {}
49
50     /**
51      * The Constructor.
52      *
53      * @param setValue the set value
54      */
55     public TestContextTreeSetItem(final SortedSet<String> setValue) {
56         this.setValue = setValue;
57     }
58
59     /**
60      * Gets the set value.
61      *
62      * @return the sets the value
63      */
64     public Set<String> getSetValue() {
65         if (setValue == null) {
66             setValue = new TreeSet<>();
67         }
68         return setValue;
69     }
70
71     /**
72      * Sets the set value.
73      *
74      * @param setValue the sets the value
75      */
76     public void setSetValue(final SortedSet<String> setValue) {
77         this.setValue = setValue;
78     }
79
80     /*
81      * (non-Javadoc)
82      *
83      * @see java.lang.Object#hashCode()
84      */
85     @Override
86     public int hashCode() {
87         final int prime = HASH_PRIME_1;
88         int result = 1;
89         result = prime * result + ((setValue == null) ? 0 : setValue.hashCode());
90         return result;
91     }
92
93     /*
94      * (non-Javadoc)
95      *
96      * @see java.lang.Object#equals(java.lang.Object)
97      */
98     @Override
99     public boolean equals(final Object obj) {
100         if (this == obj) {
101             return true;
102         }
103         if (obj == null) {
104             return false;
105         }
106         if (getClass() != obj.getClass()) {
107             return false;
108         }
109         final TestContextTreeSetItem other = (TestContextTreeSetItem) obj;
110         if (setValue == null) {
111             if (other.setValue != null) {
112                 return false;
113             }
114         } else if (!setValue.equals(other.setValue)) {
115             return false;
116         }
117         return true;
118     }
119
120     /*
121      * (non-Javadoc)
122      *
123      * @see java.lang.Object#toString()
124      */
125     @Override
126     public String toString() {
127         return "TestContextItem00B [setValue=" + setValue + "]";
128     }
129 }