All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ccsds.moims.mo.mal.structures.UpdateHeader Maven / Gradle / Ivy

package org.ccsds.moims.mo.mal.structures;

/**
 * The UpdateHeader structure shall be used by updates using the PUBSUB Interaction 
 * Pattern. It shall hold information that identifies a single update. 
 */
public final class UpdateHeader implements org.ccsds.moims.mo.mal.structures.Composite {

    /**
     * Short form for type.
     */
    public static final Integer TYPE_SHORT_FORM = 1003;
    /**
     * Absolute short form for type.
     */
    public static final Long SHORT_FORM = 281475027043307L;
    private static final long serialVersionUID = 281475027043307L;
    /**
     * The source of the update, usually a PUBSUB provider.
     */
    private org.ccsds.moims.mo.mal.structures.Identifier source;

    /**
     * The domain of this update. The individual domain identifier parts shall not be set 
     * as the wildcard character ‘*’. 
     */
    private org.ccsds.moims.mo.mal.structures.IdentifierList domain;

    /**
     * The values for the PUBSUB keys. The values shall be ordered according to the defined 
     * keys if the consumer subscription did not enable trimming. 
     */
    private org.ccsds.moims.mo.mal.structures.NullableAttributeList keyValues;

    /**
     * Default constructor for UpdateHeader.
     * 
     */
    public UpdateHeader() {
    }

    /**
     * Constructor that initialises the values of the structure.
     * 
     * @param source The source of the update, usually a PUBSUB provider.
     * @param domain The domain of this update. The individual domain identifier parts shall 
     * not be set as the wildcard character ‘*’. 
     * @param keyValues The values for the PUBSUB keys. The values shall be ordered according 
     * to the defined keys if the consumer subscription did not enable trimming. 
     */
    public UpdateHeader(org.ccsds.moims.mo.mal.structures.Identifier source,
            org.ccsds.moims.mo.mal.structures.IdentifierList domain,
            org.ccsds.moims.mo.mal.structures.NullableAttributeList keyValues) {
        this.source = source;
        this.domain = domain;
        this.keyValues = keyValues;
    }

    /**
     * Creates an instance of this type using the default constructor. It is a generic factory 
     * method. 
     * 
     * @return A new instance of this type with default field values.
     */
    public org.ccsds.moims.mo.mal.structures.Element createElement() {
        return new org.ccsds.moims.mo.mal.structures.UpdateHeader();
    }

    /**
     * Returns the field source.
     * 
     * @return The field source.
     */
    public org.ccsds.moims.mo.mal.structures.Identifier getSource() {
        return source;
    }

    /**
     * Sets the field source.
     * 
     * @param __newValue The new value.
     */
    @Deprecated
    public void setSource(org.ccsds.moims.mo.mal.structures.Identifier __newValue) {
        source = __newValue;
    }

    /**
     * Returns the field domain.
     * 
     * @return The field domain.
     */
    public org.ccsds.moims.mo.mal.structures.IdentifierList getDomain() {
        return domain;
    }

    /**
     * Sets the field domain.
     * 
     * @param __newValue The new value.
     */
    @Deprecated
    public void setDomain(org.ccsds.moims.mo.mal.structures.IdentifierList __newValue) {
        domain = __newValue;
    }

    /**
     * Returns the field keyValues.
     * 
     * @return The field keyValues.
     */
    public org.ccsds.moims.mo.mal.structures.NullableAttributeList getKeyValues() {
        return keyValues;
    }

    /**
     * Sets the field keyValues.
     * 
     * @param __newValue The new value.
     */
    @Deprecated
    public void setKeyValues(org.ccsds.moims.mo.mal.structures.NullableAttributeList __newValue) {
        keyValues = __newValue;
    }

    /**
     * Compares this object to the specified object. The result is true if and only if the 
     * argument is not null and is the same type that contains the same value as this object. 
     * 
     * @param obj The object to compare with.
     * @return true if the objects are the same; false otherwise.
     */
    public boolean equals(Object obj) {
        if (obj instanceof UpdateHeader) {
            UpdateHeader other = (UpdateHeader) obj;
            if (source == null) {
                if (other.source != null) {
                    return false;
                }
            } else {
                if (! source.equals(other.source)) {
                    return false;
                }
            }
            if (domain == null) {
                if (other.domain != null) {
                    return false;
                }
            } else {
                if (! domain.equals(other.domain)) {
                    return false;
                }
            }
            if (keyValues == null) {
                if (other.keyValues != null) {
                    return false;
                }
            } else {
                if (! keyValues.equals(other.keyValues)) {
                    return false;
                }
            }
            return true;
        }
        return false;
    }

    /**
     * Returns a hash code for this object.
     * 
     * @return a hash code value for this object.
     */
    public int hashCode() {
        int hash = 7;
        hash = 83 * hash + (source != null ? source.hashCode() : 0);
        hash = 83 * hash + (domain != null ? domain.hashCode() : 0);
        hash = 83 * hash + (keyValues != null ? keyValues.hashCode() : 0);
        return hash;
    }

    /**
     * Returns a String object representing this type's value.
     * 
     * @return a string representation of the value of this object.
     */
    public String toString() {
        StringBuilder buf = new StringBuilder();
        buf.append("(UpdateHeader: ");
        buf.append("source=");
        buf.append(source);
        buf.append(", domain=");
        buf.append(domain);
        buf.append(", keyValues=");
        buf.append(keyValues);
        buf.append(')');
        return buf.toString();
    }

    /**
     * Encodes the value of this object using the provided MALEncoder.
     * 
     * @param encoder The encoder to use for encoding.
     * @throws org.ccsds.moims.mo.mal.MALException if any encoding errors are detected. 
     */
    public void encode(org.ccsds.moims.mo.mal.MALEncoder encoder) throws org.ccsds.moims.mo.mal.MALException {
        encoder.encodeNullableIdentifier(source);
        encoder.encodeNullableElement(domain);
        encoder.encodeNullableElement(keyValues);
    }

    /**
     * Decodes the value of this object using the provided MALDecoder.
     * 
     * @param decoder The decoder to use for decoding.
     * @return Returns this object.
     * @throws org.ccsds.moims.mo.mal.MALException if any decoding errors are detected. 
     */
    public org.ccsds.moims.mo.mal.structures.Element decode(org.ccsds.moims.mo.mal.MALDecoder decoder) throws org.ccsds.moims.mo.mal.MALException {
        source = decoder.decodeNullableIdentifier();
        domain = (org.ccsds.moims.mo.mal.structures.IdentifierList) decoder.decodeNullableElement(new org.ccsds.moims.mo.mal.structures.IdentifierList());
        keyValues = (org.ccsds.moims.mo.mal.structures.NullableAttributeList) decoder.decodeNullableElement(new org.ccsds.moims.mo.mal.structures.NullableAttributeList());
        return this;
    }

    /**
     * Returns the absolute short form of this type.
     * 
     * @return The absolute short form of this type.
     */
    public Long getShortForm() {
        return SHORT_FORM;
    }

    /**
     * Returns the type short form of this type which is unique to the area/service it is 
     * defined in but not unique across all types. 
     * 
     * @return The type short form of this type.
     */
    public Integer getTypeShortForm() {
        return TYPE_SHORT_FORM;
    }

    /**
     * Returns the area number of this type.
     * 
     * @return The area number of this type.
     */
    public org.ccsds.moims.mo.mal.structures.UShort getAreaNumber() {
        return org.ccsds.moims.mo.mal.MALHelper.MAL_AREA_NUMBER;
    }

    /**
     * Returns the area version of this type.
     * 
     * @return The area number of this type.
     */
    public org.ccsds.moims.mo.mal.structures.UOctet getAreaVersion() {
        return org.ccsds.moims.mo.mal.MALHelper.MAL_AREA_VERSION;
    }

    /**
     * Returns the service number of this type.
     * 
     * @return The service number of this type.
     */
    public org.ccsds.moims.mo.mal.structures.UShort getServiceNumber() {
        return new org.ccsds.moims.mo.mal.structures.UShort(0);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy