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.TimeZone;
27 * The Class TestContextItem009.
29 public class TestContextItem009 implements Serializable {
30 private static final long serialVersionUID = 5604426823170331706L;
32 private static final int HASH_PRIME_1 = 31;
33 private static final int HASH_PRIME_2 = 1231;
34 private static final int HASH_PRIME_3 = 1237;
36 private TestContextItem008 dateValue = new TestContextItem008(System.currentTimeMillis());
37 private String timeZoneString = TimeZone.getTimeZone("Europe/Dublin").getDisplayName();
38 private boolean dst = false;
43 public TestContextItem009() {
50 * @param dateValue the date value
51 * @param tzValue the tz value
54 public TestContextItem009(final TestContextItem008 dateValue, final String tzValue, final boolean dst) {
55 this.dateValue = dateValue;
56 this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName();
63 * @param original the original
65 public TestContextItem009(final TestContextItem009 original) {
66 this.dateValue = original.dateValue;
67 this.timeZoneString = original.timeZoneString;
68 this.dst = original.dst;
72 * Gets the date value.
74 * @return the date value
76 public TestContextItem008 getDateValue() {
81 * Sets the date value.
83 * @param dateValue the date value
85 public void setDateValue(final TestContextItem008 dateValue) {
86 this.dateValue = dateValue;
92 * @return the TZ value
94 public String getTZValue() {
95 return timeZoneString;
101 * @param tzValue the TZ value
103 public void setTZValue(final String tzValue) {
104 this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName();
112 public boolean getDST() {
119 * @param newDst the dst
121 public void setDST(final boolean newDst) {
128 * @see java.lang.Object#hashCode()
131 public int hashCode() {
132 final int prime = HASH_PRIME_1;
134 result = prime * result + ((dateValue == null) ? 0 : dateValue.hashCode());
135 result = prime * result + (dst ? HASH_PRIME_2 : HASH_PRIME_3);
136 result = prime * result + ((timeZoneString == null) ? 0 : timeZoneString.hashCode());
143 * @see java.lang.Object#equals(java.lang.Object)
146 public boolean equals(final Object obj) {
153 if (getClass() != obj.getClass()) {
156 final TestContextItem009 other = (TestContextItem009) obj;
157 if (dateValue == null) {
158 if (other.dateValue != null) {
161 } else if (!dateValue.equals(other.dateValue)) {
164 if (dst != other.dst) {
167 if (timeZoneString == null) {
168 if (other.timeZoneString != null) {
171 } else if (!timeZoneString.equals(other.timeZoneString)) {
180 * @see java.lang.Object#toString()
183 public String toString() {
184 return "TestContextItem009 [dateValue=" + dateValue + ", tzValue=" + timeZoneString + ", dst=" + dst + "]";