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

org.ccsds.moims.mo.common.structures.ServiceKey Maven / Gradle / Ivy

package org.ccsds.moims.mo.common.structures;
public final class ServiceKey implements org.ccsds.moims.mo.mal.structures.Composite {

    /**
     * Short form for type.
     */
    @Deprecated
    private static final Integer TYPE_SHORT_FORM = 1;
    /**
     * Absolute short form for type. This will be replaced by the TypeId.
     */
    @Deprecated
    public static final Long SHORT_FORM = 844424946909185L;
    private static final long serialVersionUID = 844424946909185L;
    /**
     * Absolute short form for type.
     */
    public static final org.ccsds.moims.mo.mal.TypeId TYPE_ID = new org.ccsds.moims.mo.mal.TypeId(SHORT_FORM);

    /**
     * The area of this service taken from the numeric Area identifier of the 
     * service specification. 
     */
    private org.ccsds.moims.mo.mal.structures.UShort keyArea;

    /**
     * The service taken from the numeric Service identifier of the service specification. 
     */
    private org.ccsds.moims.mo.mal.structures.UShort keyService;

    /**
     * The version of this service taken from the Area Version of the area specification. 
     */
    private org.ccsds.moims.mo.mal.structures.UOctet keyAreaVersion;

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

    /**
     * Constructor that initialises the values of the structure.
     * 
     * @param keyArea The area of this service taken from the numeric Area identifier 
     * of the service specification. 
     * @param keyService The service taken from the numeric Service identifier 
     * of the service specification. 
     * @param keyAreaVersion The version of this service taken from the Area Version 
     * of the area specification. 
     */
    public ServiceKey(org.ccsds.moims.mo.mal.structures.UShort keyArea,
            org.ccsds.moims.mo.mal.structures.UShort keyService,
            org.ccsds.moims.mo.mal.structures.UOctet keyAreaVersion) {
        this.keyArea = keyArea;
        this.keyService = keyService;
        this.keyAreaVersion = keyAreaVersion;
    }

    /**
     * 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.common.structures.ServiceKey();
    }

    /**
     * Returns the field keyArea.
     * 
     * @return The field keyArea.
     */
    public org.ccsds.moims.mo.mal.structures.UShort getKeyArea() {
        return keyArea;
    }

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

    /**
     * Returns the field keyService.
     * 
     * @return The field keyService.
     */
    public org.ccsds.moims.mo.mal.structures.UShort getKeyService() {
        return keyService;
    }

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

    /**
     * Returns the field keyAreaVersion.
     * 
     * @return The field keyAreaVersion.
     */
    public org.ccsds.moims.mo.mal.structures.UOctet getKeyAreaVersion() {
        return keyAreaVersion;
    }

    /**
     * Sets the field keyAreaVersion.
     * 
     * @param __newValue The new value.
     */
    @Deprecated
    public void setKeyAreaVersion(org.ccsds.moims.mo.mal.structures.UOctet __newValue) {
        keyAreaVersion = __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 ServiceKey) {
            ServiceKey other = (ServiceKey) obj;
            if (keyArea == null) {
                if (other.keyArea != null) {
                    return false;
                }
            } else {
                if (! keyArea.equals(other.keyArea)) {
                    return false;
                }
            }
            if (keyService == null) {
                if (other.keyService != null) {
                    return false;
                }
            } else {
                if (! keyService.equals(other.keyService)) {
                    return false;
                }
            }
            if (keyAreaVersion == null) {
                if (other.keyAreaVersion != null) {
                    return false;
                }
            } else {
                if (! keyAreaVersion.equals(other.keyAreaVersion)) {
                    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 + (keyArea != null ? keyArea.hashCode() : 0);
        hash = 83 * hash + (keyService != null ? keyService.hashCode() : 0);
        hash = 83 * hash + (keyAreaVersion != null ? keyAreaVersion.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("(ServiceKey: ");
        buf.append("keyArea=");
        buf.append(keyArea);
        buf.append(", keyService=");
        buf.append(keyService);
        buf.append(", keyAreaVersion=");
        buf.append(keyAreaVersion);
        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 (keyArea == null) {
            throw new org.ccsds.moims.mo.mal.MALException("The field 'keyArea' cannot be null!");
        }
        if (keyService == null) {
            throw new org.ccsds.moims.mo.mal.MALException("The field 'keyService' cannot be null!");
        }
        if (keyAreaVersion == null) {
            throw new org.ccsds.moims.mo.mal.MALException("The field 'keyAreaVersion' cannot be null!");
        }
        encoder.encodeUShort(keyArea);
        encoder.encodeUShort(keyService);
        encoder.encodeUOctet(keyAreaVersion);
    }

    /**
     * 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 {
        keyArea = decoder.decodeUShort();
        keyService = decoder.decodeUShort();
        keyAreaVersion = decoder.decodeUOctet();
        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.common.CommonHelper.COMMON_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.common.CommonHelper.COMMON_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);
    }

    /**
     * Returns the TypeId of this element.
     * 
     * @return The TypeId of this element.
     */
    public org.ccsds.moims.mo.mal.TypeId getTypeId() {
        return TYPE_ID;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy