Package org.orekit.files.iirv.terms
Class CheckSumTerm
- java.lang.Object
-
- org.orekit.files.iirv.terms.base.IIRVVectorTerm<Long>
-
- org.orekit.files.iirv.terms.base.LongValuedIIRVTerm
-
- org.orekit.files.iirv.terms.CheckSumTerm
-
- All Implemented Interfaces:
Comparable<IIRVVectorTerm<?>>
public class CheckSumTerm extends LongValuedIIRVTerm
Three-character checksum to validate message.Calculated by summing the decimal equivalent of the preceding characters in the line, counting spaces as 0 and negative signs as 1:
- 0 through 9 = face value
- Minus (-) = 1
- ASCII Space = 0
Valid Values: 000-999
- Since:
- 13.0
- Author:
- Nick LaFarge
-
-
Field Summary
Fields Modifier and Type Field Description static int
CHECK_SUM_TERM_LENGTH
The length of the IIRV term within the message.static String
CHECK_SUM_TERM_PATTERN
Regular expression that ensures the validity of string values for this term.
-
Constructor Summary
Constructors Constructor Description CheckSumTerm(long value)
Constructor.CheckSumTerm(String value)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static int
computeChecksum(String input)
Computes the sum of the decimal equivalent of characters in the line, counting spaces as 0 and negative signs as 1.static CheckSumTerm
fromIIRVTerms(IIRVVectorTerm<?>... terms)
Constructs an IIRV checksum from a series of IIRVTerm instances.boolean
validateAgainstLineString(String line)
Validate the checksum from a line based on the object's checksum integer value.static boolean
validateLineCheckSum(String line)
Validate a line's embedded checksum value.-
Methods inherited from class org.orekit.files.iirv.terms.base.LongValuedIIRVTerm
computeValueFromString, toEncodedString, toInt, validateNumericValue
-
Methods inherited from class org.orekit.files.iirv.terms.base.IIRVVectorTerm
compareTo, equals, hashCode, length, toEncodedString, validateString, value
-
-
-
-
Field Detail
-
CHECK_SUM_TERM_LENGTH
public static final int CHECK_SUM_TERM_LENGTH
The length of the IIRV term within the message.- See Also:
- Constant Field Values
-
CHECK_SUM_TERM_PATTERN
public static final String CHECK_SUM_TERM_PATTERN
Regular expression that ensures the validity of string values for this term.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CheckSumTerm
public CheckSumTerm(String value)
Constructor.- Parameters:
value
- value of the coordinate system term
-
CheckSumTerm
public CheckSumTerm(long value)
Constructor.- Parameters:
value
- value of the coordinate system term
-
-
Method Detail
-
fromIIRVTerms
public static CheckSumTerm fromIIRVTerms(IIRVVectorTerm<?>... terms)
Constructs an IIRV checksum from a series of IIRVTerm instances.- Parameters:
terms
- IIRVTerms to compute checksum- Returns:
- newly created CheckSum instance
-
computeChecksum
public static int computeChecksum(String input)
Computes the sum of the decimal equivalent of characters in the line, counting spaces as 0 and negative signs as 1.- Parameters:
input
- input string to compute checksum from- Returns:
- computed checksum integer value
-
validateLineCheckSum
public static boolean validateLineCheckSum(String line)
Validate a line's embedded checksum value.- Parameters:
line
- string line of an IIRV message (including checksum as the final three characters)- Returns:
- true if the derived and embedded checksum values are equal
-
validateAgainstLineString
public boolean validateAgainstLineString(String line)
Validate the checksum from a line based on the object's checksum integer value.- Parameters:
line
- string line of an IIRV message (including checksum as the final three characters)- Returns:
- true if the extracted checksum value matches this object's integer value
-
-