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

nl.esi.metis.aisparser.UtilsSpecialManoeuvreIndicator2 Maven / Gradle / Ivy

Go to download

This package supports the parsing of AIS messages in Java. AIS, the Automatic Identification System, is a system aiming at improving maritime safety by exchanging messages between ships, other vehicles in particular aircraft involved in search-and-rescue (SAR), and (fixed) base stations. To be precise, this package support the ITU-R M.1371-4 AIS standard. See our extensive javadoc and in particular the class AISParser for more information on how to use this package. The parser was used in the Poseidon project, and is improved in the Metis project to better handle uncertain information. Both projects were led by the Embedded Systems Institute. In both projects Thales Nederlands was the carrying industrial partner, and multiple Dutch universities participated.

The newest version!
package nl.esi.metis.aisparser;

/** This class provides functions to analyze the (2-bit signed integer) Special Manoeuvre Indicator value that is returned by 
 * {@link AISMessagePositionReport#getSpecialManoeuvre()}.
 * @author Pierre van de Laar
 * @author Pierre America
 * @author Brian C. Lane
 */
public class UtilsSpecialManoeuvreIndicator2 {
	/** The special-manoeuvre-indicator value that is used to signal unavailability, according to the AIS standard. */
	private static final int DEFAULTVALUE = 0;

	/** The minimum valid special-manoeuvre-indicator value. */
	private static final int MINVALUE = 1 ;

	/** The maximum valid special-manoeuvre-indicator value. */
	private static final int MAXVALUE =  2;
	
	/** Checks if the special-manoeuvre-indicator value is semantically correct (according to the standard). 
	 * This means that it is either a valid measurement or the standard value indicating unavailability.
	 * @param value the special-manoeuvre-indicator value that is returned by {@link AISMessagePositionReport#getSpecialManoeuvre()}.
	 * @return true if the value is semantically correct
	 */
	public static boolean isSpecialManoeuvreIndicatorSemanticallyCorrect( int value )
	{
		return ( ( UtilsSpecialManoeuvreIndicator2.MINVALUE <= value ) && ( value <= UtilsSpecialManoeuvreIndicator2.MAXVALUE ) ) || (value == UtilsSpecialManoeuvreIndicator2.DEFAULTVALUE);
	}
	
	/** Checks if the special-manoeuvre-indicator value is available.
	 * @precondition isSpecialManoeuvreIndicatorSemanticallyCorrect (value)
	 * @param value the special-manoeuvre-indicator value that is returned by {@link AISMessagePositionReport#getSpecialManoeuvre()}.
	 * @return true if the special-manoeuvre-indicator is available
	 */
	public static boolean isAvailable( int value )
	{
		return !(value == UtilsSpecialManoeuvreIndicator2.DEFAULTVALUE);
	}
	
	/** semantically correct range of special-manoeuvre-indicator
	 * 
	 */
	public static final String range = "["+MINVALUE+","+MAXVALUE+"] + {"+ DEFAULTVALUE +"}";
	
	/** Generates a text string representing the special-manoeuvre-indicator.
	 * @param specialManoeuvreIndicator an integer value representing the special-manoeuvre-indicator, as returned by {@link AISMessagePositionReport#getSpecialManoeuvre()}
	 * @return a string representing the special-manoeuvre-indicator
	 */

	public static String toString(int specialManoeuvreIndicator) {
		switch (specialManoeuvreIndicator) {
			case 0:
				return "no special manoeuvre indicator";
			case 1:
				return "not in special manoeuvre";
			case 2:
				return "in special manoeuvre";
			default:
				return "invalid special manoeuvre indicator";
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy