org.somda.sdc.biceps.model.participant.ClockState Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of biceps-model Show documentation
Show all versions of biceps-model Show documentation
SDCri is a set of Java libraries that implements a network communication framework conforming
with the IEEE 11073 SDC specifications. This project implements the model for
IEEE 11073-10207.
The newest version!
package org.somda.sdc.biceps.model.participant;
import java.math.BigDecimal;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.jetbrains.annotations.Nullable;
import org.jvnet.jaxb.lang.CopyStrategy;
import org.jvnet.jaxb.lang.CopyTo;
import org.jvnet.jaxb.lang.JAXBCopyStrategy;
import org.jvnet.jaxb.lang.JAXBToStringStrategy;
import org.jvnet.jaxb.lang.ToString;
import org.jvnet.jaxb.lang.ToStringStrategy;
import org.jvnet.jaxb.locator.ObjectLocator;
import org.jvnet.jaxb.locator.util.LocatorUtils;
import org.somda.sdc.common.model.TimestampAdapter;
/**
* State of a clock of an MDS.
*
* Java class for ClockState complex type
.
*
* The following schema fragment specifies the expected content contained within this class.
*
* {@code
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
* }
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ClockState", namespace = "http://standards.ieee.org/downloads/11073/11073-10207-2017/participant", propOrder = {
"activeSyncProtocol",
"referenceSource"
})
public class ClockState
extends AbstractDeviceComponentState
implements Cloneable, CopyTo, ToString
{
/**
* Protocol that is actively being used for time sync.
*
* Examples: MDC:MDC_TIME_SYNC_NTPV3 if the clock is synchronized using NTP v3.0 (RFC 1305) or MDC:MDC_TIME_SYNC_NONE if the clock is not synchronized.
*
*/
@XmlElement(name = "ActiveSyncProtocol", namespace = "http://standards.ieee.org/downloads/11073/11073-10207-2017/participant")
protected CodedValue activeSyncProtocol;
/**
* Identifies the clock's external reference source(s), e.g., NTP server addresses.
*
*/
@XmlElement(name = "ReferenceSource", namespace = "http://standards.ieee.org/downloads/11073/11073-10207-2017/participant")
protected List referenceSource;
/**
* Current date/time setting. As the current date/time changes at a high frequency, a change of this value SHALL NOT cause an update of the state version unless it has been synchronized either remotely or manually.
*
* NOTE—DateAndTime could be filled when the clock is explicitly requested.
*
*/
@XmlAttribute(name = "DateAndTime")
@XmlJavaTypeAdapter(TimestampAdapter.class)
protected Instant dateAndTime;
/**
* Indicates if the time is synchronized to an external source or set by an operator.
*
*/
@XmlAttribute(name = "RemoteSync", required = true)
protected boolean remoteSync;
/**
* Accuracy is a decimal number indicating the maximum error in seconds of the absolute time relative to a primary reference clock source.
*
* In systems where time synchronization is not used and the clock is set manually by "eyeball and wristwatch" (EBWW), this SHALL be initialized to three minutes when the clock time is set. If NTP is used, this is equivalent to Root Dispersion + 1⁄2 Root Delay.
*
*/
@XmlAttribute(name = "Accuracy")
protected BigDecimal accuracy;
/**
* Time point when the absolute time was set or synchronized.
*
* NOTE 1—If a time synchronization protocol is used that "changes" the time and date at a high frequency, it is proposed to update this value at a lower periodicity (e.g., once every 10 minutes or once an hour), so as not to consume communications bandwidth unnecessarily.
* NOTE 2—Synchronization might be achieved by slewing the time. This means that the virtual frequency of the software clock is adjusted to make the clock go faster or slower until it is corrected.
*
*/
@XmlAttribute(name = "LastSet")
@XmlJavaTypeAdapter(TimestampAdapter.class)
protected Instant lastSet;
/**
* Identifies the time zone and DST of the clock.
*
*/
@XmlAttribute(name = "TimeZone")
protected String timeZone;
/**
* Identifies that the clock information is actively being used in care delivery algorithms/protocols. The implied value SHALL be "false".
*
*/
@XmlAttribute(name = "CriticalUse")
protected Boolean criticalUse;
/**
* Protocol that is actively being used for time sync.
*
* Examples: MDC:MDC_TIME_SYNC_NTPV3 if the clock is synchronized using NTP v3.0 (RFC 1305) or MDC:MDC_TIME_SYNC_NONE if the clock is not synchronized.
*
* @return
* possible object is
* {@link CodedValue }
*
*/
@Nullable
public CodedValue getActiveSyncProtocol() {
return activeSyncProtocol;
}
/**
* Sets the value of the activeSyncProtocol property.
*
* @param value
* allowed object is
* {@link CodedValue }
*
* @see #getActiveSyncProtocol()
*/
public void setActiveSyncProtocol(
@Nullable
CodedValue value) {
this.activeSyncProtocol = value;
}
/**
* Identifies the clock's external reference source(s), e.g., NTP server addresses.
*
* Gets the value of the referenceSource property.
*
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a set
method for the referenceSource property.
*
*
* For example, to add a new item, do as follows:
*
*
* getReferenceSource().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link String }
*
*
*
* @return
* The value of the referenceSource property.
*/
public List getReferenceSource() {
if (referenceSource == null) {
referenceSource = new ArrayList<>();
}
return this.referenceSource;
}
/**
* Current date/time setting. As the current date/time changes at a high frequency, a change of this value SHALL NOT cause an update of the state version unless it has been synchronized either remotely or manually.
*
* NOTE—DateAndTime could be filled when the clock is explicitly requested.
*
* @return
* possible object is
* {@link String }
*
*/
@Nullable
public Instant getDateAndTime() {
return dateAndTime;
}
/**
* Sets the value of the dateAndTime property.
*
* @param value
* allowed object is
* {@link String }
*
* @see #getDateAndTime()
*/
public void setDateAndTime(
@Nullable
Instant value) {
this.dateAndTime = value;
}
/**
* Indicates if the time is synchronized to an external source or set by an operator.
*
*/
public boolean isRemoteSync() {
return remoteSync;
}
/**
* Sets the value of the remoteSync property.
*
*/
public void setRemoteSync(boolean value) {
this.remoteSync = value;
}
/**
* Accuracy is a decimal number indicating the maximum error in seconds of the absolute time relative to a primary reference clock source.
*
* In systems where time synchronization is not used and the clock is set manually by "eyeball and wristwatch" (EBWW), this SHALL be initialized to three minutes when the clock time is set. If NTP is used, this is equivalent to Root Dispersion + 1⁄2 Root Delay.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
@Nullable
public BigDecimal getAccuracy() {
return accuracy;
}
/**
* Sets the value of the accuracy property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
* @see #getAccuracy()
*/
public void setAccuracy(
@Nullable
BigDecimal value) {
this.accuracy = value;
}
/**
* Time point when the absolute time was set or synchronized.
*
* NOTE 1—If a time synchronization protocol is used that "changes" the time and date at a high frequency, it is proposed to update this value at a lower periodicity (e.g., once every 10 minutes or once an hour), so as not to consume communications bandwidth unnecessarily.
* NOTE 2—Synchronization might be achieved by slewing the time. This means that the virtual frequency of the software clock is adjusted to make the clock go faster or slower until it is corrected.
*
* @return
* possible object is
* {@link String }
*
*/
@Nullable
public Instant getLastSet() {
return lastSet;
}
/**
* Sets the value of the lastSet property.
*
* @param value
* allowed object is
* {@link String }
*
* @see #getLastSet()
*/
public void setLastSet(
@Nullable
Instant value) {
this.lastSet = value;
}
/**
* Identifies the time zone and DST of the clock.
*
* @return
* possible object is
* {@link String }
*
*/
@Nullable
public String getTimeZone() {
return timeZone;
}
/**
* Sets the value of the timeZone property.
*
* @param value
* allowed object is
* {@link String }
*
* @see #getTimeZone()
*/
public void setTimeZone(
@Nullable
String value) {
this.timeZone = value;
}
/**
* Identifies that the clock information is actively being used in care delivery algorithms/protocols. The implied value SHALL be "false".
*
* @return
* possible object is
* {@link Boolean }
*
*/
@Nullable
public Boolean isCriticalUse() {
return criticalUse;
}
/**
* Sets the value of the criticalUse property.
*
* @param value
* allowed object is
* {@link Boolean }
*
* @see #isCriticalUse()
*/
public void setCriticalUse(
@Nullable
Boolean value) {
this.criticalUse = value;
}
public void setReferenceSource(
@Nullable
List value) {
this.referenceSource = null;
if (value!= null) {
List draftl = this.getReferenceSource();
draftl.addAll(value);
}
}
@Override
public boolean equals(Object object) {
if ((object == null)||(this.getClass()!= object.getClass())) {
return false;
}
if (this == object) {
return true;
}
if (!super.equals(object)) {
return false;
}
final ClockState that = ((ClockState) object);
{
CodedValue leftActiveSyncProtocol;
leftActiveSyncProtocol = this.getActiveSyncProtocol();
CodedValue rightActiveSyncProtocol;
rightActiveSyncProtocol = that.getActiveSyncProtocol();
if (this.activeSyncProtocol!= null) {
if (that.activeSyncProtocol!= null) {
if (!leftActiveSyncProtocol.equals(rightActiveSyncProtocol)) {
return false;
}
} else {
return false;
}
} else {
if (that.activeSyncProtocol!= null) {
return false;
}
}
}
{
List leftReferenceSource;
leftReferenceSource = (((this.referenceSource!= null)&&(!this.referenceSource.isEmpty()))?this.getReferenceSource():null);
List rightReferenceSource;
rightReferenceSource = (((that.referenceSource!= null)&&(!that.referenceSource.isEmpty()))?that.getReferenceSource():null);
if ((this.referenceSource!= null)&&(!this.referenceSource.isEmpty())) {
if ((that.referenceSource!= null)&&(!that.referenceSource.isEmpty())) {
if (!leftReferenceSource.equals(rightReferenceSource)) {
return false;
}
} else {
return false;
}
} else {
if ((that.referenceSource!= null)&&(!that.referenceSource.isEmpty())) {
return false;
}
}
}
{
Instant leftDateAndTime;
leftDateAndTime = this.getDateAndTime();
Instant rightDateAndTime;
rightDateAndTime = that.getDateAndTime();
if (this.dateAndTime!= null) {
if (that.dateAndTime!= null) {
if (!leftDateAndTime.equals(rightDateAndTime)) {
return false;
}
} else {
return false;
}
} else {
if (that.dateAndTime!= null) {
return false;
}
}
}
{
boolean leftRemoteSync;
leftRemoteSync = this.isRemoteSync();
boolean rightRemoteSync;
rightRemoteSync = that.isRemoteSync();
if (leftRemoteSync!= rightRemoteSync) {
return false;
}
}
{
BigDecimal leftAccuracy;
leftAccuracy = this.getAccuracy();
BigDecimal rightAccuracy;
rightAccuracy = that.getAccuracy();
if (this.accuracy!= null) {
if (that.accuracy!= null) {
if (!leftAccuracy.equals(rightAccuracy)) {
return false;
}
} else {
return false;
}
} else {
if (that.accuracy!= null) {
return false;
}
}
}
{
Instant leftLastSet;
leftLastSet = this.getLastSet();
Instant rightLastSet;
rightLastSet = that.getLastSet();
if (this.lastSet!= null) {
if (that.lastSet!= null) {
if (!leftLastSet.equals(rightLastSet)) {
return false;
}
} else {
return false;
}
} else {
if (that.lastSet!= null) {
return false;
}
}
}
{
String leftTimeZone;
leftTimeZone = this.getTimeZone();
String rightTimeZone;
rightTimeZone = that.getTimeZone();
if (this.timeZone!= null) {
if (that.timeZone!= null) {
if (!leftTimeZone.equals(rightTimeZone)) {
return false;
}
} else {
return false;
}
} else {
if (that.timeZone!= null) {
return false;
}
}
}
{
Boolean leftCriticalUse;
leftCriticalUse = this.isCriticalUse();
Boolean rightCriticalUse;
rightCriticalUse = that.isCriticalUse();
if (this.criticalUse!= null) {
if (that.criticalUse!= null) {
if (!leftCriticalUse.equals(rightCriticalUse)) {
return false;
}
} else {
return false;
}
} else {
if (that.criticalUse!= null) {
return false;
}
}
}
return true;
}
@Override
public int hashCode() {
int currentHashCode = 1;
currentHashCode = ((currentHashCode* 31)+ super.hashCode());
{
currentHashCode = (currentHashCode* 31);
CodedValue theActiveSyncProtocol;
theActiveSyncProtocol = this.getActiveSyncProtocol();
if (this.activeSyncProtocol!= null) {
currentHashCode += theActiveSyncProtocol.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
List theReferenceSource;
theReferenceSource = (((this.referenceSource!= null)&&(!this.referenceSource.isEmpty()))?this.getReferenceSource():null);
if ((this.referenceSource!= null)&&(!this.referenceSource.isEmpty())) {
currentHashCode += theReferenceSource.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
Instant theDateAndTime;
theDateAndTime = this.getDateAndTime();
if (this.dateAndTime!= null) {
currentHashCode += theDateAndTime.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
boolean theRemoteSync;
theRemoteSync = this.isRemoteSync();
currentHashCode += (theRemoteSync? 1231 : 1237);
}
{
currentHashCode = (currentHashCode* 31);
BigDecimal theAccuracy;
theAccuracy = this.getAccuracy();
if (this.accuracy!= null) {
currentHashCode += theAccuracy.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
Instant theLastSet;
theLastSet = this.getLastSet();
if (this.lastSet!= null) {
currentHashCode += theLastSet.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
String theTimeZone;
theTimeZone = this.getTimeZone();
if (this.timeZone!= null) {
currentHashCode += theTimeZone.hashCode();
}
}
{
currentHashCode = (currentHashCode* 31);
Boolean theCriticalUse;
theCriticalUse = this.isCriticalUse();
if (this.criticalUse!= null) {
currentHashCode += theCriticalUse.hashCode();
}
}
return currentHashCode;
}
@Override
public String toString() {
final ToStringStrategy strategy = JAXBToStringStrategy.getInstance();
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
@Override
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
@Override
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
super.appendFields(locator, buffer, strategy);
{
CodedValue theActiveSyncProtocol;
theActiveSyncProtocol = this.getActiveSyncProtocol();
strategy.appendField(locator, this, "activeSyncProtocol", buffer, theActiveSyncProtocol, (this.activeSyncProtocol!= null));
}
{
List theReferenceSource;
theReferenceSource = (((this.referenceSource!= null)&&(!this.referenceSource.isEmpty()))?this.getReferenceSource():null);
strategy.appendField(locator, this, "referenceSource", buffer, theReferenceSource, ((this.referenceSource!= null)&&(!this.referenceSource.isEmpty())));
}
{
Instant theDateAndTime;
theDateAndTime = this.getDateAndTime();
strategy.appendField(locator, this, "dateAndTime", buffer, theDateAndTime, (this.dateAndTime!= null));
}
{
boolean theRemoteSync;
theRemoteSync = this.isRemoteSync();
strategy.appendField(locator, this, "remoteSync", buffer, theRemoteSync, true);
}
{
BigDecimal theAccuracy;
theAccuracy = this.getAccuracy();
strategy.appendField(locator, this, "accuracy", buffer, theAccuracy, (this.accuracy!= null));
}
{
Instant theLastSet;
theLastSet = this.getLastSet();
strategy.appendField(locator, this, "lastSet", buffer, theLastSet, (this.lastSet!= null));
}
{
String theTimeZone;
theTimeZone = this.getTimeZone();
strategy.appendField(locator, this, "timeZone", buffer, theTimeZone, (this.timeZone!= null));
}
{
Boolean theCriticalUse;
theCriticalUse = this.isCriticalUse();
strategy.appendField(locator, this, "criticalUse", buffer, theCriticalUse, (this.criticalUse!= null));
}
return buffer;
}
@Override
public Object clone() {
return copyTo(createNewInstance());
}
@Override
public Object copyTo(Object target) {
final CopyStrategy strategy = JAXBCopyStrategy.getInstance();
return copyTo(null, target, strategy);
}
@Override
public Object copyTo(ObjectLocator locator, Object target, CopyStrategy strategy) {
final Object draftCopy = ((target == null)?createNewInstance():target);
super.copyTo(locator, draftCopy, strategy);
if (draftCopy instanceof ClockState) {
final ClockState copy = ((ClockState) draftCopy);
{
Boolean activeSyncProtocolShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.activeSyncProtocol!= null));
if (activeSyncProtocolShouldBeCopiedAndSet == Boolean.TRUE) {
CodedValue sourceActiveSyncProtocol;
sourceActiveSyncProtocol = this.getActiveSyncProtocol();
CodedValue copyActiveSyncProtocol = ((CodedValue) strategy.copy(LocatorUtils.property(locator, "activeSyncProtocol", sourceActiveSyncProtocol), sourceActiveSyncProtocol, (this.activeSyncProtocol!= null)));
copy.setActiveSyncProtocol(copyActiveSyncProtocol);
} else {
if (activeSyncProtocolShouldBeCopiedAndSet == Boolean.FALSE) {
copy.activeSyncProtocol = null;
}
}
}
{
Boolean referenceSourceShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.referenceSource!= null)&&(!this.referenceSource.isEmpty())));
if (referenceSourceShouldBeCopiedAndSet == Boolean.TRUE) {
List sourceReferenceSource;
sourceReferenceSource = (((this.referenceSource!= null)&&(!this.referenceSource.isEmpty()))?this.getReferenceSource():null);
@SuppressWarnings("unchecked")
List copyReferenceSource = ((List ) strategy.copy(LocatorUtils.property(locator, "referenceSource", sourceReferenceSource), sourceReferenceSource, ((this.referenceSource!= null)&&(!this.referenceSource.isEmpty()))));
copy.setReferenceSource(copyReferenceSource);
} else {
if (referenceSourceShouldBeCopiedAndSet == Boolean.FALSE) {
copy.referenceSource = null;
}
}
}
{
Boolean dateAndTimeShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.dateAndTime!= null));
if (dateAndTimeShouldBeCopiedAndSet == Boolean.TRUE) {
Instant sourceDateAndTime;
sourceDateAndTime = this.getDateAndTime();
Instant copyDateAndTime = ((Instant) strategy.copy(LocatorUtils.property(locator, "dateAndTime", sourceDateAndTime), sourceDateAndTime, (this.dateAndTime!= null)));
copy.setDateAndTime(copyDateAndTime);
} else {
if (dateAndTimeShouldBeCopiedAndSet == Boolean.FALSE) {
copy.dateAndTime = null;
}
}
}
{
Boolean remoteSyncShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, true);
if (remoteSyncShouldBeCopiedAndSet == Boolean.TRUE) {
boolean sourceRemoteSync;
sourceRemoteSync = this.isRemoteSync();
boolean copyRemoteSync = strategy.copy(LocatorUtils.property(locator, "remoteSync", sourceRemoteSync), sourceRemoteSync, true);
copy.setRemoteSync(copyRemoteSync);
} else {
if (remoteSyncShouldBeCopiedAndSet == Boolean.FALSE) {
}
}
}
{
Boolean accuracyShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.accuracy!= null));
if (accuracyShouldBeCopiedAndSet == Boolean.TRUE) {
BigDecimal sourceAccuracy;
sourceAccuracy = this.getAccuracy();
BigDecimal copyAccuracy = ((BigDecimal) strategy.copy(LocatorUtils.property(locator, "accuracy", sourceAccuracy), sourceAccuracy, (this.accuracy!= null)));
copy.setAccuracy(copyAccuracy);
} else {
if (accuracyShouldBeCopiedAndSet == Boolean.FALSE) {
copy.accuracy = null;
}
}
}
{
Boolean lastSetShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.lastSet!= null));
if (lastSetShouldBeCopiedAndSet == Boolean.TRUE) {
Instant sourceLastSet;
sourceLastSet = this.getLastSet();
Instant copyLastSet = ((Instant) strategy.copy(LocatorUtils.property(locator, "lastSet", sourceLastSet), sourceLastSet, (this.lastSet!= null)));
copy.setLastSet(copyLastSet);
} else {
if (lastSetShouldBeCopiedAndSet == Boolean.FALSE) {
copy.lastSet = null;
}
}
}
{
Boolean timeZoneShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.timeZone!= null));
if (timeZoneShouldBeCopiedAndSet == Boolean.TRUE) {
String sourceTimeZone;
sourceTimeZone = this.getTimeZone();
String copyTimeZone = ((String) strategy.copy(LocatorUtils.property(locator, "timeZone", sourceTimeZone), sourceTimeZone, (this.timeZone!= null)));
copy.setTimeZone(copyTimeZone);
} else {
if (timeZoneShouldBeCopiedAndSet == Boolean.FALSE) {
copy.timeZone = null;
}
}
}
{
Boolean criticalUseShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.criticalUse!= null));
if (criticalUseShouldBeCopiedAndSet == Boolean.TRUE) {
Boolean sourceCriticalUse;
sourceCriticalUse = this.isCriticalUse();
Boolean copyCriticalUse = ((Boolean) strategy.copy(LocatorUtils.property(locator, "criticalUse", sourceCriticalUse), sourceCriticalUse, (this.criticalUse!= null)));
copy.setCriticalUse(copyCriticalUse);
} else {
if (criticalUseShouldBeCopiedAndSet == Boolean.FALSE) {
copy.criticalUse = null;
}
}
}
}
return draftCopy;
}
@Override
public Object createNewInstance() {
return new ClockState();
}
}