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

org.ccsds.moims.mo.mpd.structures.ParameterDef Maven / Gradle / Ivy

The newest version!
package org.ccsds.moims.mo.mpd.structures;

/**
 * A ParameterDef specifies a metadata parameter in terms of its name, attribute 
 * type and optionally units and a free text description. Note that as ParameterDef 
 * is only used in the context of ProductType, which is not contained in the 
 * service messages of any operation defined in this specification, it also 
 * is not contained in any currently defined service message.  A future service 
 * may support the distribution and access to mission product configuration 
 * data, including ProductTypes and their contained ParameterDefs. 
 */
public final class ParameterDef implements org.ccsds.moims.mo.mal.structures.Composite {

    private static final long serialVersionUID = 2533274807173122L;
    /**
     * The TypeId of this Element as a long.
     */
    public static final Long SHORT_FORM = 2533274807173122L;
    /**
     * The TypeId of this Element.
     */
    public static final org.ccsds.moims.mo.mal.TypeId TYPE_ID = new org.ccsds.moims.mo.mal.TypeId(SHORT_FORM);

    /**
     * Assigns a name to the metadata parameter.
     */
    private org.ccsds.moims.mo.mal.structures.Identifier name;

    /**
     * Specifies the MAL attribute type of the metadata parameter.
     */
    private org.ccsds.moims.mo.mal.structures.AttributeType parameterType;

    /**
     * Units associated with the metadata parameter (optional).
     */
    private String units;

    /**
     * Description of the metadata parameter (optional).
     */
    private String description;

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

    /**
     * Constructor that initialises the values of the structure.
     * 
     * @param name Assigns a name to the metadata parameter.
     * @param parameterType Specifies the MAL attribute type of the metadata parameter. 
     * @param units Units associated with the metadata parameter (optional).
     * @param description Description of the metadata parameter (optional).
     */
    public ParameterDef(org.ccsds.moims.mo.mal.structures.Identifier name,
            org.ccsds.moims.mo.mal.structures.AttributeType parameterType,
            String units,
            String description) {
        this.name = name;
        this.parameterType = parameterType;
        this.units = units;
        this.description = description;
    }

    /**
     * Constructor that initialises the non-nullable values of the structure. 
     * 
     * @param name Assigns a name to the metadata parameter.
     * @param parameterType Specifies the MAL attribute type of the metadata parameter. 
     */
    public ParameterDef(org.ccsds.moims.mo.mal.structures.Identifier name,
            org.ccsds.moims.mo.mal.structures.AttributeType parameterType) {
        this.name = name;
        this.parameterType = parameterType;
        this.units = null;
        this.description = null;
    }

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

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

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

    /**
     * Returns the field parameterType.
     * 
     * @return The field parameterType.
     */
    public org.ccsds.moims.mo.mal.structures.AttributeType getParameterType() {
        return parameterType;
    }

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

    /**
     * Returns the field units.
     * 
     * @return The field units.
     */
    public String getUnits() {
        return units;
    }

    /**
     * Sets the field units.
     * 
     * @param __newValue The new value.
     */
    @Deprecated
    public void setUnits(String __newValue) {
        units = __newValue;
    }

    /**
     * Returns the field description.
     * 
     * @return The field description.
     */
    public String getDescription() {
        return description;
    }

    /**
     * Sets the field description.
     * 
     * @param __newValue The new value.
     */
    @Deprecated
    public void setDescription(String __newValue) {
        description = __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 ParameterDef) {
            ParameterDef other = (ParameterDef) obj;
            if (name == null) {
                if (other.name != null) {
                    return false;
                }
            } else {
                if (! name.equals(other.name)) {
                    return false;
                }
            }
            if (parameterType == null) {
                if (other.parameterType != null) {
                    return false;
                }
            } else {
                if (! parameterType.equals(other.parameterType)) {
                    return false;
                }
            }
            if (units == null) {
                if (other.units != null) {
                    return false;
                }
            } else {
                if (! units.equals(other.units)) {
                    return false;
                }
            }
            if (description == null) {
                if (other.description != null) {
                    return false;
                }
            } else {
                if (! description.equals(other.description)) {
                    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 + (name != null ? name.hashCode() : 0);
        hash = 83 * hash + (parameterType != null ? parameterType.hashCode() : 0);
        hash = 83 * hash + (units != null ? units.hashCode() : 0);
        hash = 83 * hash + (description != null ? description.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("(ParameterDef: ");
        buf.append("name=");
        buf.append(name);
        buf.append(", parameterType=");
        buf.append(parameterType);
        buf.append(", units=");
        buf.append(units);
        buf.append(", description=");
        buf.append(description);
        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 (name == null) {
            throw new org.ccsds.moims.mo.mal.MALException("The field 'name' cannot be null!");
        }
        if (parameterType == null) {
            throw new org.ccsds.moims.mo.mal.MALException("The field 'parameterType' cannot be null!");
        }
        encoder.encodeIdentifier(name);
        encoder.encodeElement(parameterType);
        encoder.encodeNullableString(units);
        encoder.encodeNullableString(description);
    }

    /**
     * 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 {
        name = decoder.decodeIdentifier();
        parameterType = (org.ccsds.moims.mo.mal.structures.AttributeType) decoder.decodeElement(org.ccsds.moims.mo.mal.structures.AttributeType.BLOB);
        units = decoder.decodeNullableString();
        description = decoder.decodeNullableString();
        return this;
    }

    /**
     * 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