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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.apex.testsuites.integration.context.concepts;
24 import java.io.Serializable;
25 import java.util.TimeZone;
28 * The Class TestContextItem009.
30 public class TestContextDateTzItem implements Serializable {
31 private static final long serialVersionUID = 5604426823170331706L;
33 private static final int HASH_PRIME_1 = 31;
34 private static final int HASH_PRIME_2 = 1231;
35 private static final int HASH_PRIME_3 = 1237;
37 private TestContextDateItem dateValue = new TestContextDateItem(System.currentTimeMillis());
38 private String timeZoneString = TimeZone.getTimeZone("Europe/Dublin").getDisplayName();
39 private boolean dst = false;
44 public TestContextDateTzItem() {
51 * @param dateValue the date value
52 * @param tzValue the tz value
55 public TestContextDateTzItem(final TestContextDateItem dateValue, final String tzValue, final boolean dst) {
56 this.dateValue = dateValue;
57 this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName();
64 * @param original the original
66 public TestContextDateTzItem(final TestContextDateTzItem original) {
67 this.dateValue = original.dateValue;
68 this.timeZoneString = original.timeZoneString;
69 this.dst = original.dst;
73 * Gets the date value.
75 * @return the date value
77 public TestContextDateItem getDateValue() {
82 * Sets the date value.
84 * @param dateValue the date value
86 public void setDateValue(final TestContextDateItem dateValue) {
87 this.dateValue = dateValue;
93 * @return the TZ value
95 public String getTzValue() {
96 return timeZoneString;
102 * @param tzValue the TZ value
104 public void setTzValue(final String tzValue) {
105 if (tzValue != null) {
106 this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName();
109 this.timeZoneString = null;
118 public boolean getDst() {
125 * @param newDst the dst
127 public void setDst(final boolean newDst) {
134 * @see java.lang.Object#hashCode()
137 public int hashCode() {
138 final int prime = HASH_PRIME_1;
140 result = prime * result + ((dateValue == null) ? 0 : dateValue.hashCode());
141 result = prime * result + (dst ? HASH_PRIME_2 : HASH_PRIME_3);
142 result = prime * result + ((timeZoneString == null) ? 0 : timeZoneString.hashCode());
149 * @see java.lang.Object#equals(java.lang.Object)
152 public boolean equals(final Object obj) {
159 if (getClass() != obj.getClass()) {
162 final TestContextDateTzItem other = (TestContextDateTzItem) obj;
163 if (dateValue == null) {
164 if (other.dateValue != null) {
167 } else if (!dateValue.equals(other.dateValue)) {
170 if (dst != other.dst) {
173 if (timeZoneString == null) {
174 if (other.timeZoneString != null) {
178 else if (!timeZoneString.equals(other.timeZoneString)) {
187 * @see java.lang.Object#toString()
190 public String toString() {
191 return "TestContextItem009 [dateValue=" + dateValue + ", tzValue=" + timeZoneString + ", dst=" + dst + "]";