【问题标题】:Show whether a module has or not at least 1 baseline显示一个模块是否至少有 1 个基线
【发布时间】:2018-03-15 04:08:46
【问题描述】:

我有一个包含一堆正式模块的文件夹,我想知道哪些模块至少有 1 个基线。我开始尝试这样的事情:

Item icurr
Folder scr = current Folder
Baseline b = baseline(1, 0, null)

for icurr in scr do
{
   if( baselineExists(icurr, b) )
   {
      print name(icurr)
   }
}

此代码的问题在于,baselineExists() 仅接受 Module 对象作为第一个参数,当我将 icurr 声明为 Module 而不是 Item 时,for 循环无法识别任何模块。

【问题讨论】:

    标签: module ibm-doors baseline


    【解决方案1】:

    我认为使用for baseline in module 循环最简单。 循环遍历所有项目,使用for item in folder(不包括子文件夹中的项目,您将需要一个循环遍历所有找到的文件夹的递归函数)或使用for item in project(它将自动递归遍历所有包含的文件夹和项目)。 对于每个项目,使用if 'Formal' == type i then {} 检查它是否是(正式)模块。如果是这样,请从项目中获取模块变量。通常,我使用Module m = read (fullName i, false, true); if !null m then... 执行此操作。 然后,当你打开模块时,使用类似的代码

    Baseline b = null
    for b in m do {break} // stop loop at first found baseline
    if (!null b) { 
       print "found a baseline in module " fullName(m) ": " major(b) "." minor(b)  " ("suffix(b)")\n"
    }
    

    不要忘记在评估后关闭每个模块,否则脚本会占用大量内存

    【讨论】:

      猜你喜欢
      • 2022-01-13
      • 2012-03-13
      • 2012-08-05
      • 2022-06-13
      • 2018-01-02
      • 1970-01-01
      • 2014-07-14
      • 1970-01-01
      相关资源
      最近更新 更多