当前位置: 首页>>代码示例>>Java>>正文


Java IProprietaryTag类代码示例

本文整理汇总了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;
}
 
开发者ID:videgro,项目名称:Ships,代码行数:20,代码来源:AisMessage.java

示例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;
}
 
开发者ID:videgro,项目名称:Ships,代码行数:29,代码来源:Sentence.java

示例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);
}
 
开发者ID:videgro,项目名称:Ships,代码行数:13,代码来源:AisMessage.java

示例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();
}
 
开发者ID:videgro,项目名称:Ships,代码行数:19,代码来源:AisMessage.java

示例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;
}
 
开发者ID:videgro,项目名称:Ships,代码行数:19,代码来源:Sentence.java

示例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);
}
 
开发者ID:videgro,项目名称:Ships,代码行数:12,代码来源:Sentence.java

示例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;
}
 
开发者ID:videgro,项目名称:Ships,代码行数:42,代码来源:AisPacketTags.java

示例8: setTags

import dk.dma.ais.proprietary.IProprietaryTag; //导入依赖的package包/类
public void setTags(LinkedList<IProprietaryTag> tags) {
    vdm.setTags(tags);
}
 
开发者ID:videgro,项目名称:Ships,代码行数:4,代码来源:AisMessage.java

示例9: setTags

import dk.dma.ais.proprietary.IProprietaryTag; //导入依赖的package包/类
public void setTags(LinkedList<IProprietaryTag> tags) {
    this.tags = tags;
}
 
开发者ID:videgro,项目名称:Ships,代码行数:4,代码来源:Sentence.java

示例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);
    }

}
 
开发者ID:dma-ais,项目名称:AisView,代码行数:46,代码来源:TargetSourceData.java

示例11: getTags

import dk.dma.ais.proprietary.IProprietaryTag; //导入依赖的package包/类
/**
 * Get all tags
 * 
 * @return
 */
public LinkedList<IProprietaryTag> getTags() {
    return vdm.getTags();
}
 
开发者ID:videgro,项目名称:Ships,代码行数:9,代码来源:AisMessage.java

示例12: getTags

import dk.dma.ais.proprietary.IProprietaryTag; //导入依赖的package包/类
/**
 * Get all tags
 * 
 * @return
 */
public LinkedList<IProprietaryTag> getTags() {
    return tags;
}
 
开发者ID:videgro,项目名称:Ships,代码行数:9,代码来源:Sentence.java


注:本文中的dk.dma.ais.proprietary.IProprietaryTag类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。