【问题标题】:Checking for Out Links with DOORS DXL使用 DOORS DXL 检查外链
【发布时间】:2018-03-06 18:57:47
【问题描述】:

我正在尝试编写一个简单的 DXL 来检查链接。更具体地说,我想查看正式模块中的每个需求并返回缺少链接的项目数:

Module m = current  
Object o = null

string objType = ""
Link outLink

int noOutLinkCount = 0

for o in m do {

    objType = o."Object Type"

    for outLink in o -> "*" do {
        if objType == "Req" or objType = "Obj" and outLink == null then noOutLinkCount++
        }
    }

print "No Out Link Count = " noOutLinkCount""

对于我的一生,我无法弄清楚如何做到这一点。条件

outLink == null  

似乎不起作用。

注意:检查以确保对象是“Req”(要求)或“Obj”(目标要求)类型是必要的,因为我不关心标题、图像、文本对象等上缺少链接。

【问题讨论】:

    标签: ibm-doors


    【解决方案1】:

    这个循环:

    for outLink in o -> "*" do {
    }
    

    将为每个外链执行。如果外链为 0,则根本不会执行。

    我会像这样构造代码:

    Module m = current  
    Object o = null
    
    string objType = ""
    Link outLink
    
    int noOutLinkCount = 0
    
    for o in m do {
    
        objType = o."Object Type" ""
    
        // Check if the type is right
        if ( ( objType == "Req" ) || ( objType == "Obj" ) ) {
            // Check for any outlinks at all
            bool no_outlink_flag = true
            for outLink in o -> "*" do {
                // If this executes, at least 1 outlink- flag and break
                no_outlink_flag = false
                break
            }
            // If we didn't flag any outlinks, increment
            if ( no_outlink_flag ) {
                noOutLinkCount++
            }
        }
    }
    
    print "No Out Link Count = " noOutLinkCount""
    

    应该可以。如果有,请告诉我!

    【讨论】:

    • 完美运行!非常聪明的解决方案。感谢您的帮助!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多