本文整理汇总了Java中dk.dma.ais.proprietary.IProprietaryTag类的典型用法代码示例。如果您正苦于以下问题:Java IProprietaryTag类的具体用法?Java IProprietaryTag怎么用?Java IProprietaryTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IProprietaryTag类属于dk.dma.ais.proprietary包,在下文中一共展示了IProprietaryTag类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSourceTag
import dk.dma.ais.proprietary.IProprietaryTag; //导入依赖的package包/类
/**
* Return the LAST source tag (closest to AIS sentence)
*
* @return
*/
public IProprietarySourceTag getSourceTag() {
LinkedList<IProprietaryTag> tags = vdm.getTags();
if (tags == null) {
return null;
}
// Iterate backwards
for (Iterator<IProprietaryTag> iterator = tags.descendingIterator(); iterator.hasNext();) {
IProprietaryTag tag = iterator.next();
if (tag instanceof IProprietarySourceTag) {
return (IProprietarySourceTag) tag;
}
}
return null;
}
示例2: getTimestamp
import dk.dma.ais.proprietary.IProprietaryTag; //导入依赖的package包/类
/**
* Try to get timestamp in this order: Comment block timestamp, proprietary tag timestamp and MSSIS timestamp
*
* @return
*/
public Date getTimestamp() {
// Try comment block first
CommentBlock cb = getCommentBlock();
if (cb != null) {
Long ts = cb.getTimestamp();
if (ts != null) {
return new Date(ts * 1000);
}
}
// Try from proprietary source tags
if (getTags() != null) {
for (IProprietaryTag tag : getTags()) {
if (tag instanceof IProprietarySourceTag) {
Date t = ((IProprietarySourceTag) tag).getTimestamp();
if (t != null) {
return t;
}
}
}
}
// Return MSSIS timestamp
return mssisTimestamp;
}
示例3: setTag
import dk.dma.ais.proprietary.IProprietaryTag; //导入依赖的package包/类
/**
* Add tag (to front)
*
* @param tag
*/
public void setTag(IProprietaryTag tag) {
LinkedList<IProprietaryTag> tags = vdm.getTags();
if (tags == null) {
tags = new LinkedList<IProprietaryTag>();
}
tags.addFirst(tag);
}
示例4: reassemble
import dk.dma.ais.proprietary.IProprietaryTag; //导入依赖的package包/类
/**
* Method for reassembling original message appending possible proprietary source tags
*
* @return
*/
public String reassemble() {
LinkedList<IProprietaryTag> tags = vdm.getTags();
StringBuilder buf = new StringBuilder();
if (tags != null) {
for (IProprietaryTag tag : tags) {
if (tag.getSentence() != null) {
buf.append(tag.getSentence() + "\r\n");
}
}
}
buf.append(getVdm().getOrgLinesJoined());
return buf.toString();
}
示例5: getSourceTag
import dk.dma.ais.proprietary.IProprietaryTag; //导入依赖的package包/类
/**
* Return the LAST source tag (closest to AIS sentence)
*
* @return
*/
public IProprietarySourceTag getSourceTag() {
if (tags == null) {
return null;
}
// Iterate backwards
for (Iterator<IProprietaryTag> iterator = tags.descendingIterator(); iterator.hasNext();) {
IProprietaryTag tag = iterator.next();
if (tag instanceof IProprietarySourceTag) {
return (IProprietarySourceTag) tag;
}
}
return null;
}
示例6: setTag
import dk.dma.ais.proprietary.IProprietaryTag; //导入依赖的package包/类
/**
* Add tag (to front)
*
* @param tag
*/
public void setTag(IProprietaryTag tag) {
if (this.tags == null) {
this.tags = new LinkedList<IProprietaryTag>();
}
this.tags.addFirst(tag);
}
示例7: parse
import dk.dma.ais.proprietary.IProprietaryTag; //导入依赖的package包/类
/**
* Parse tags from Vdm. Uses comment block with first priority and fall back to proprietary tags.
*
* @param vdm
* @return tagging instance
*/
static AisPacketTags parse(Vdm vdm) {
AisPacketTags tags = new AisPacketTags();
// Get timestamp
tags.setTimestamp(vdm != null ? vdm.getTimestamp() : null);
// Get comment block
CommentBlock cb = vdm != null ? vdm.getCommentBlock() : null;
// Get from comment block
if (cb != null) {
tags.setSourceId(cb.getString(SOURCE_ID_KEY));
tags.setSourceBs(cb.getInt(SOURCE_BS_KEY));
String cc = cb.getString(SOURCE_COUNTRY_KEY);
if (cc != null) {
tags.setSourceCountry(Country.getByCode(cc));
}
tags.setSourceType(SourceType.fromString(cb.getString(SOURCE_TYPE_KEY)));
}
// Go through proprietary tags to set missing fields
if (vdm == null || vdm.getTags() == null) {
return tags;
}
for (IProprietaryTag tag : vdm.getTags()) {
if (tag instanceof IProprietarySourceTag) {
IProprietarySourceTag sourceTag = (IProprietarySourceTag) tag;
if (tags.getSourceBs() == null) {
tags.setSourceBs(sourceTag.getBaseMmsi());
}
if (tags.getSourceCountry() == null) {
tags.setSourceCountry(sourceTag.getCountry());
}
}
}
return tags;
}
示例8: setTags
import dk.dma.ais.proprietary.IProprietaryTag; //导入依赖的package包/类
public void setTags(LinkedList<IProprietaryTag> tags) {
vdm.setTags(tags);
}
示例9: setTags
import dk.dma.ais.proprietary.IProprietaryTag; //导入依赖的package包/类
public void setTags(LinkedList<IProprietaryTag> tags) {
this.tags = tags;
}
示例10: update
import dk.dma.ais.proprietary.IProprietaryTag; //导入依赖的package包/类
public void update(AisPacket packet) {
AisMessage message = packet.tryGetAisMessage();
if (message == null) {
return;
}
this.lastSourceRegion = null;
// Get source region from Gatehouse tag
if (message.getTags() != null) {
for (IProprietaryTag tag : message.getTags()) {
if (tag instanceof GatehouseSourceTag) {
GatehouseSourceTag ghTag = (GatehouseSourceTag) tag;
this.lastSourceRegion = ghTag.getRegion();
}
}
}
this.lastTagging = packet.getTags();
// Update times of reception of time
Long now = System.currentTimeMillis();
SourceType sourceType = lastTagging.getSourceType();
if (sourceType == null) {
sourceType = SourceType.TERRESTRIAL;
}
sourceTypeTime.put(sourceType.encode(), now);
Country srcCnt = lastTagging.getSourceCountry();
if (srcCnt != null) {
sourceCountryTime.put(srcCnt.getThreeLetter(), now);
}
if (lastSourceRegion != null) {
sourceRegionTime.put(lastSourceRegion, now);
}
if (lastTagging.getSourceBs() != null) {
sourceBsTime.put(Integer.toString(lastTagging.getSourceBs()), now);
}
if (lastTagging.getSourceId() != null) {
sourceSystemTime.put(lastTagging.getSourceId(), now);
}
}
示例11: getTags
import dk.dma.ais.proprietary.IProprietaryTag; //导入依赖的package包/类
/**
* Get all tags
*
* @return
*/
public LinkedList<IProprietaryTag> getTags() {
return vdm.getTags();
}
示例12: getTags
import dk.dma.ais.proprietary.IProprietaryTag; //导入依赖的package包/类
/**
* Get all tags
*
* @return
*/
public LinkedList<IProprietaryTag> getTags() {
return tags;
}