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

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

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

/**
 * The ObjectIdentity structure shall represent the Object Identity of an MO Object. 
 */
public final class ObjectIdentity implements org.ccsds.moims.mo.mal.structures.Composite {

    /**
     * Short form for type.
     */
    public static final Integer TYPE_SHORT_FORM = 1008;
    /**
     * Absolute short form for type.
     */
    public static final Long SHORT_FORM = 281475027043312L;
    private static final long serialVersionUID = 281475027043312L;
    /**
     * The domain of the MO Object being referenced.
     */
    private org.ccsds.moims.mo.mal.structures.IdentifierList domain;

    /**
     * The key of the MO Object being referenced.
     */
    private org.ccsds.moims.mo.mal.structures.Identifier key;

    /**
     * The version of the MO Object being referenced.
     */
    private org.ccsds.moims.mo.mal.structures.UInteger version;

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

    /**
     * Constructor that initialises the values of the structure.
     * 
     * @param domain The domain of the MO Object being referenced.
     * @param key The key of the MO Object being referenced.
     * @param version The version of the MO Object being referenced.
     */
    public ObjectIdentity(org.ccsds.moims.mo.mal.structures.IdentifierList domain,
            org.ccsds.moims.mo.mal.structures.Identifier key,
            org.ccsds.moims.mo.mal.structures.UInteger version) {
        this.domain = domain;
        this.key = key;
        this.version = version;
    }

    /**
     * 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.ObjectIdentity();
    }

    /**
     * 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 key.
     * 
     * @return The field key.
     */
    public org.ccsds.moims.mo.mal.structures.Identifier getKey() {
        return key;
    }

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

    /**
     * Returns the field version.
     * 
     * @return The field version.
     */
    public org.ccsds.moims.mo.mal.structures.UInteger getVersion() {
        return version;
    }

    /**
     * Sets the field version.
     * 
     * @param __newValue The new value.
     */
    @Deprecated
    public void setVersion(org.ccsds.moims.mo.mal.structures.UInteger __newValue) {
        version = __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 ObjectIdentity) {
            ObjectIdentity other = (ObjectIdentity) obj;
            if (domain == null) {
                if (other.domain != null) {
                    return false;
                }
            } else {
                if (! domain.equals(other.domain)) {
                    return false;
                }
            }
            if (key == null) {
                if (other.key != null) {
                    return false;
                }
            } else {
                if (! key.equals(other.key)) {
                    return false;
                }
            }
            if (version == null) {
                if (other.version != null) {
                    return false;
                }
            } else {
                if (! version.equals(other.version)) {
                    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 + (domain != null ? domain.hashCode() : 0);
        hash = 83 * hash + (key != null ? key.hashCode() : 0);
        hash = 83 * hash + (version != null ? version.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("(ObjectIdentity: ");
        buf.append("domain=");
        buf.append(domain);
        buf.append(", key=");
        buf.append(key);
        buf.append(", version=");
        buf.append(version);
        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 {
        if (domain == null) {
            throw new org.ccsds.moims.mo.mal.MALException("The field 'domain' cannot be null!");
        }
        if (key == null) {
            throw new org.ccsds.moims.mo.mal.MALException("The field 'key' cannot be null!");
        }
        if (version == null) {
            throw new org.ccsds.moims.mo.mal.MALException("The field 'version' cannot be null!");
        }
        encoder.encodeElement(domain);
        encoder.encodeIdentifier(key);
        encoder.encodeUInteger(version);
    }

    /**
     * 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 {
        domain = (org.ccsds.moims.mo.mal.structures.IdentifierList) decoder.decodeElement(new org.ccsds.moims.mo.mal.structures.IdentifierList());
        key = decoder.decodeIdentifier();
        version = decoder.decodeUInteger();
        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