Extending the existing one is what we usually prefer.
Is it possible to switch .text in PatternBuilder?
private static final Pattern PATTERN = new PatternBuilder()
.text("!AIVDM,")
.number("(d+),")
.number("(d+),")
.number("(d+)?,")
.expression(".,")
.expression("([^,]+),")
.any()
.compile();
No, you need an expression.
What this expression should look like?
I thought that if I pass to Parser "!ABVDM,|!AIVDM,...." it would work, but it doesn't.
Would it be possible to get some help?
I would probably do something like this:
.text("!")
.expression("A[DI]VDM,")
private static final Pattern PATTERN = new PatternBuilder()
.text("!")
.expression("A[BI]VDM,")
.number("(d+),") // count
.number("(d+),") // index
.number("(d+)?,") // id
.expression(".,") // radio channel
.expression("([^,]+),") // payload
.any()
.compile();
It works like a charm.
All tests passed successfully.
Thank you very much
Hello,
I need some advice, which is the better approach to add !ABVDM to the AisProtocolDecoder.
To extend the current one or to implement a new protocol, the only difference is the initial sentence - !ABVDM instead of !AIVDM