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

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

There is a newer version: 10.1
Show newest version
package org.ccsds.moims.mo.mal.structures;

/**
 * The ServiceId holds a certain Service and its version within an Area.
 */
public final class ServiceId implements org.ccsds.moims.mo.mal.structures.Composite {

    /**
     * Short form for type.
     */
    public static final Integer TYPE_SHORT_FORM = 1009;
    /**
     * Short form for area.
     */
    public static final org.ccsds.moims.mo.mal.structures.UShort AREA_SHORT_FORM = new org.ccsds.moims.mo.mal.structures.UShort(1);

    /**
     * Version for area.
     */
    public static final org.ccsds.moims.mo.mal.structures.UOctet AREA_VERSION = new org.ccsds.moims.mo.mal.structures.UOctet((short) 1);

    /**
     * Short form for service.
     */
    public static final org.ccsds.moims.mo.mal.structures.UShort SERVICE_SHORT_FORM = new org.ccsds.moims.mo.mal.structures.UShort(0);

    /**
     * Absolute short form for type.
     */
    public static final Long SHORT_FORM = 281474993488881L;
    private static final long serialVersionUID = 281474993488881L;
    /**
     * 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 Service Version of the area specification. 
     */
    private org.ccsds.moims.mo.mal.structures.UOctet keyServiceVersion;

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

    /**
     * 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 keyServiceVersion The version of this service taken from the Service Version 
     * of the area specification. 
     */
    public ServiceId(org.ccsds.moims.mo.mal.structures.UShort keyArea, org.ccsds.moims.mo.mal.structures.UShort keyService, org.ccsds.moims.mo.mal.structures.UOctet keyServiceVersion) {
        this.keyArea = keyArea;
        this.keyService = keyService;
        this.keyServiceVersion = keyServiceVersion;
    }

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

    /**
     * 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 __newValue The new value.
     */
    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 __newValue The new value.
     */
    public void setKeyService(org.ccsds.moims.mo.mal.structures.UShort __newValue) {
        keyService = __newValue;
    }

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

    /**
     * Sets the field keyServiceVersion.
     * 
     * @param __newValue __newValue The new value.
     */
    public void setKeyServiceVersion(org.ccsds.moims.mo.mal.structures.UOctet __newValue) {
        keyServiceVersion = __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 obj the object to compare with.
     * @return true if the objects are the same; false otherwise.
     */
    public boolean equals(Object obj) {
        if (obj instanceof ServiceId) {
          ServiceId other = (ServiceId) 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 (keyServiceVersion == null) {
                if (other.keyServiceVersion != null) {
                    return false;
                }
            } else {
                if (! keyServiceVersion.equals(other.keyServiceVersion)) {
                    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 + (keyServiceVersion != null ? keyServiceVersion.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('(');
        buf.append("keyArea=");
        buf.append(keyArea);
        buf.append(", keyService=");
        buf.append(keyService);
        buf.append(", keyServiceVersion=");
        buf.append(keyServiceVersion);
        buf.append(')');
        return buf.toString();
    }

    /**
     * Encodes the value of this object using the provided MALEncoder.
     * 
     * @param encoder 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.encodeUShort(keyArea);
        encoder.encodeUShort(keyService);
        encoder.encodeUOctet(keyServiceVersion);
    }

    /**
     * Decodes the value of this object using the provided MALDecoder.
     * 
     * @param decoder 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();
        keyServiceVersion = 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 AREA_SHORT_FORM;
    }

    /**
     * Returns the area version of this type.
     * 
     * @return The area number of this type.
     */
    public org.ccsds.moims.mo.mal.structures.UOctet getAreaVersion() {
        return 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 SERVICE_SHORT_FORM;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy