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 TestContextDateTzItem 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 TestContextDateItem dateValue = new TestContextDateItem(System.currentTimeMillis());
37 private String timeZoneString = TimeZone.getTimeZone("Europe/Dublin").getDisplayName();
38 private boolean dst = false;
43 public TestContextDateTzItem() {
50 * @param dateValue the date value
51 * @param tzValue the tz value
54 public TestContextDateTzItem(final TestContextDateItem 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 TestContextDateTzItem(final TestContextDateTzItem 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 TestContextDateItem getDateValue() {
81 * Sets the date value.
83 * @param dateValue the date value
85 public void setDateValue(final TestContextDateItem 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 if (tzValue != null) {
105 this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName();
108 this.timeZoneString = null;
117 public boolean getDst() {
124 * @param newDst the dst
126 public void setDst(final boolean newDst) {
133 * @see java.lang.Object#hashCode()
136 public int hashCode() {
137 final int prime = HASH_PRIME_1;
139 result = prime * result + ((dateValue == null) ? 0 : dateValue.hashCode());
140 result = prime * result + (dst ? HASH_PRIME_2 : HASH_PRIME_3);
141 result = prime * result + ((timeZoneString == null) ? 0 : timeZoneString.hashCode());
148 * @see java.lang.Object#equals(java.lang.Object)
151 public boolean equals(final Object obj) {
158 if (getClass() != obj.getClass()) {
161 final TestContextDateTzItem other = (TestContextDateTzItem) obj;
162 if (dateValue == null) {
163 if (other.dateValue != null) {
166 } else if (!dateValue.equals(other.dateValue)) {
169 if (dst != other.dst) {
172 if (timeZoneString == null) {
173 if (other.timeZoneString != null) {
177 else if (!timeZoneString.equals(other.timeZoneString)) {
186 * @see java.lang.Object#toString()
189 public String toString() {
190 return "TestContextItem009 [dateValue=" + dateValue + ", tzValue=" + timeZoneString + ", dst=" + dst + "]";