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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.apex.context.test.concepts;
23 import java.io.Serializable;
24 import java.util.Arrays;
26 import java.util.SortedSet;
27 import java.util.TreeSet;
30 * The Class TestContextItem00B.
32 public class TestContextTreeSetItem implements Serializable {
33 private static final long serialVersionUID = 1254589722957250388L;
35 private static final int HASH_PRIME_1 = 31;
37 private SortedSet<String> setValue = new TreeSet<>();
42 public TestContextTreeSetItem() {}
47 * @param setArray the set array
49 public TestContextTreeSetItem(final String[] setArray) {
50 this.setValue = new TreeSet<>(Arrays.asList(setArray));
56 * @param setValue the set value
58 public TestContextTreeSetItem(final SortedSet<String> setValue) {
59 this.setValue = setValue;
65 * @return the sets the value
67 public Set<String> getSetValue() {
68 if (setValue == null) {
69 setValue = new TreeSet<>();
77 * @param setValue the sets the value
79 public void setSetValue(final SortedSet<String> setValue) {
80 this.setValue = setValue;
86 * @see java.lang.Object#hashCode()
89 public int hashCode() {
90 final int prime = HASH_PRIME_1;
92 result = prime * result + ((setValue == null) ? 0 : setValue.hashCode());
99 * @see java.lang.Object#equals(java.lang.Object)
102 public boolean equals(final Object obj) {
109 if (getClass() != obj.getClass()) {
112 final TestContextTreeSetItem other = (TestContextTreeSetItem) obj;
113 if (setValue == null) {
114 if (other.setValue != null) {
117 } else if (!setValue.equals(other.setValue)) {
126 * @see java.lang.Object#toString()
129 public String toString() {
130 return "TestContextItem00B [setValue=" + setValue + "]";