public abstract class Sentence extends Object
| Modifier and Type | Field and Description |
|---|---|
protected int |
checksum
The Checksum.
|
protected CommentBlock |
commentBlock
The Comment block.
|
protected String |
delimiter
The Delimiter.
|
protected LinkedList<String> |
encodedFields
The Encoded fields.
|
protected String |
formatter
The Formatter.
|
protected String |
msgChecksum
The Msg checksum.
|
protected Date |
mssisTimestamp
The Mssis timestamp.
|
protected List<String> |
orgLines
The Org lines.
|
protected List<String> |
rawSentences
The Raw sentences.
|
protected String |
sentenceStr
The Sentence str.
|
protected LinkedList<IProprietaryTag> |
tags
The Tags.
|
protected String |
talker
The Talker.
|
| Constructor and Description |
|---|
Sentence() |
| Modifier and Type | Method and Description |
|---|---|
void |
addSingleCommentBlock(String line)
Add single comment block.
|
protected void |
baseParse(SentenceLine sl)
Basic parse of line into sentence parts
|
static String |
convert(String sentence,
String talker,
String formatter)
Convert any sentence to new sentence with !
|
protected void |
encode()
The top most encode method
|
protected String |
finalEncode()
Method to finalize the encoding and return sentence
|
static Date |
findMssisTimestamp(SentenceLine sentenceLine)
Try to get the proprietary MSSIS timestamp appended to the NMEA sentence
|
static int |
getChecksum(String sentence)
Calculate checksum of sentence
|
CommentBlock |
getCommentBlock()
Get possible comment block
|
abstract String |
getEncoded()
Get an encoded sentence
|
Date |
getMssisTimestamp()
Get found MSSIS timestamp
|
List<String> |
getOrgLines()
Get original lines for this sentence
|
String |
getOrgLinesJoined()
Get original lines joined by carriage return line feed
|
List<String> |
getRawSentences()
Get original raw sentences without any prefix
|
String |
getRawSentencesJoined()
Get original raw sentences without any prefix joined by carriage return line feed
|
IProprietarySourceTag |
getSourceTag()
Return the LAST source tag (closest to AIS sentence)
|
static String |
getStringChecksum(int checksum)
Get checksum string representation
|
LinkedList<IProprietaryTag> |
getTags()
Get all tags
|
Date |
getTimestamp()
Try to get timestamp in this order: Comment block timestamp, proprietary tag timestamp and MSSIS timestamp
|
static boolean |
hasSentence(String line)
Determine if a line seems to contain a sentence There should be a !
|
abstract int |
parse(SentenceLine sl)
Abstract method that all sentence classes must implement
The method handles assembly and extraction of the 6-bit data from sentences.
|
static int |
parseInt(String str)
Parse int int.
|
void |
setDelimiter(String delimiter)
Set delimiter
|
void |
setFormatter(String formatter)
Set formatter
|
void |
setTag(IProprietaryTag tag)
Add tag (to front)
|
void |
setTags(LinkedList<IProprietaryTag> tags)
Sets tags.
|
void |
setTalker(String talker)
Set talker
|
protected String delimiter
protected String talker
protected String formatter
protected int checksum
protected String msgChecksum
protected String sentenceStr
protected LinkedList<String> encodedFields
protected CommentBlock commentBlock
protected LinkedList<IProprietaryTag> tags
protected Date mssisTimestamp
public abstract int parse(SentenceLine sl) throws SentenceException, SixbitException
The method handles assembly and extraction of the 6-bit data from sentences. The sentence is expected to be in order.
It will return an error if received line is out of order or from a new sequence before the previous one is finished.
sl - the slSentenceException - the sentence exceptionSixbitException - the sixbit exceptionpublic abstract String getEncoded()
protected void baseParse(SentenceLine sl) throws SentenceException
sl - the slSentenceException - the sentence exceptionpublic void addSingleCommentBlock(String line) throws SentenceException
line - the lineSentenceException - the sentence exceptionprotected void encode()
protected String finalEncode()
public static int getChecksum(String sentence) throws SentenceException
sentence - the sentenceSentenceException - the sentence exceptionpublic static String getStringChecksum(int checksum)
checksum - the checksumpublic static Date findMssisTimestamp(SentenceLine sentenceLine)
sentenceLine - the sentence linepublic Date getMssisTimestamp()
public Date getTimestamp()
public static int parseInt(String str) throws SentenceException
str - the strSentenceException - the sentence exceptionpublic static boolean hasSentence(String line)
line - the linepublic List<String> getOrgLines()
public String getOrgLinesJoined()
public List<String> getRawSentences()
public String getRawSentencesJoined()
public void setTalker(String talker)
talker - the talkerpublic void setDelimiter(String delimiter)
delimiter - the delimiterpublic void setFormatter(String formatter)
formatter - the formatterpublic CommentBlock getCommentBlock()
public LinkedList<IProprietaryTag> getTags()
public void setTags(LinkedList<IProprietaryTag> tags)
tags - the tagspublic IProprietarySourceTag getSourceTag()
public void setTag(IProprietaryTag tag)
tag - the tagpublic static String convert(String sentence, String talker, String formatter) throws SentenceException
<talker><formatter>,...., sentence - the sentencetalker - the talkerformatter - the formatterSentenceException - the sentence exceptionCopyright © 2011–2019 Danish Maritime Authority. All rights reserved.