org.ccsds.moims.mo.mpd.structures.ValueSet Maven / Gradle / Ivy
The newest version!
package org.ccsds.moims.mo.mpd.structures;
/**
* A ValueSet is a concrete subtype of ParameterFilter that allows the specification
* of a set of allowed (or disallowed) values for a metadata parameter.
*/
public final class ValueSet extends org.ccsds.moims.mo.mpd.structures.ParameterFilter {
private static final long serialVersionUID = 2533274807173124L;
/**
* The TypeId of this Element as a long.
*/
public static final Long SHORT_FORM = 2533274807173124L;
/**
* 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);
/**
* Set of allowed (or disallowed) values for the metadata parameter.
*/
private org.ccsds.moims.mo.mal.structures.AttributeList values;
/**
* Default constructor for ValueSet.
*
*/
public ValueSet() {
}
/**
* Constructor that initialises the values of the structure.
*
* @param name References the name of a defined metadata parameter.
* @param include Indicates whether the filter is to include [TRUE] or exclude
* [FALSE] parameter values that match the filter.
* @param values Set of allowed (or disallowed) values for the metadata parameter.
*/
public ValueSet(org.ccsds.moims.mo.mal.structures.Identifier name,
Boolean include,
org.ccsds.moims.mo.mal.structures.AttributeList values) {
super(name,
include);
this.values = values;
}
/**
* 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.ValueSet();
}
/**
* Returns the field values.
*
* @return The field values.
*/
public org.ccsds.moims.mo.mal.structures.AttributeList getValues() {
return values;
}
/**
* Sets the field values.
*
* @param __newValue The new value.
*/
@Deprecated
public void setValues(org.ccsds.moims.mo.mal.structures.AttributeList __newValue) {
values = __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 ValueSet) {
if (! super.equals(obj)) {
return false;
}
ValueSet other = (ValueSet) obj;
if (values == null) {
if (other.values != null) {
return false;
}
} else {
if (! values.equals(other.values)) {
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 = super.hashCode();
hash = 83 * hash + (values != null ? values.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("(ValueSet: ");
buf.append(super.toString());
buf.append(", values=");
buf.append(values);
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 {
super.encode(encoder);
if (values == null) {
throw new org.ccsds.moims.mo.mal.MALException("The field 'values' cannot be null!");
}
encoder.encodeElement(values);
}
/**
* 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 {
super.decode(decoder);
values = (org.ccsds.moims.mo.mal.structures.AttributeList) decoder.decodeElement(new org.ccsds.moims.mo.mal.structures.AttributeList());
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;
}
}