门计算所有链接
Doors count all inlinks
我想计算 IBM Doors 项目中所有模块中所有对象的所有链接。 (使用 DXL)
我就是这样做的(主要是调用函数 goThroughFolders(current Folder)):
遍历项目中的每个文件夹,检查是否有模块,如果有模块调用函数"checkLinks(Module m)"
void goThroughFolders(Folder f)
{
Item itm
if (null f) return
for itm in f do{
print("\nScanning folder...")
if (null itm) continue
if (isDeleted(itm)) continue
else if ((type (itm) == "Project") || (type (itm) == "Folder"))
{
goThroughFolders(folder(itm))
}
else if (type (itm) == "Formal") {
print("\nFound Module")
checkLinks(module(itm))
}
}
}
检查链接模块
void checkLinks(Module m)
{
string objType = ""
Object o = null
Link anyLink
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
for anyLink in o <- "*" do{
LinkCount++
}
}
}
}
所以我的问题是 goThroughFolders(Folder f)
中的函数调用 checkLinks(module(itm))
似乎交出了一个 null
对象。
Error:
-R-E- DXL: <Line:11> null Module do loop parameter was passed
Backtrace:
<Line:69>
<Line:78>
-I- DXL: execution halted
但我不知道为什么?你能帮帮我吗?
发现遗漏的步骤做得很好。您可能想要做的另一件事是在完成分析后关闭模块,否则,您可能会忘记并让它们保持打开状态,从而牺牲内存,直到您退出 DOORS。
我在下面进行了一些修改和添加以实现此目的 - 如果有任何不清楚的地方,请随时询问。
理查德
Module m
Skip skLinkSourceMods = create() // Create a skip list to hold references to all modules opened for link analysis
int linkCount = 0
void checkLinks(Item itm, Skip skOpenMods) // Function signature changed to pass in the skip list - not strictly necessary, but clean
{
m = read (fullName(itm), false, true)
put(skOpenMods, m, m) // Add the opened module to the skip list, so we can easily close it later
string objType = ""
Object o = null
Link anyLink
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
for anyLink in o <- "*" do {
linkCount++
}
}
}
}
void goThroughFolders(Folder f)
{
Item itm
if (null f) return
for itm in f do {
print("\nScanning folder...")
if (null itm) continue
if (isDeleted(itm)) continue
else if ((type (itm) == "Project") || (type (itm) == "Folder"))
{
goThroughFolders(folder(itm))
}
else if (type (itm) == "Formal") {
print("\nFound Module")
checkLinks(itm, skLinkSourceMods) // Function signature changed (see above) to pass in the skip list - not strictly necessary, but clean
}
}
}
void closeModules(Skip skOpenMods)
{
for m in skOpenMods do // Loop through each module in the skip list
{
close(m, false) // Close the module without saving changes (we shouldn't have any - they were opened read-only anyway!)
}
}
goThroughFolders(current Folder)
print "\n" linkCount " links."
closeModules(skLinkSourceMods)
delete(skLinkSourceMods)
我想计算 IBM Doors 项目中所有模块中所有对象的所有链接。 (使用 DXL)
我就是这样做的(主要是调用函数 goThroughFolders(current Folder)):
遍历项目中的每个文件夹,检查是否有模块,如果有模块调用函数"checkLinks(Module m)"
void goThroughFolders(Folder f) { Item itm if (null f) return for itm in f do{ print("\nScanning folder...") if (null itm) continue if (isDeleted(itm)) continue else if ((type (itm) == "Project") || (type (itm) == "Folder")) { goThroughFolders(folder(itm)) } else if (type (itm) == "Formal") { print("\nFound Module") checkLinks(module(itm)) } } }
检查链接模块
void checkLinks(Module m) { string objType = "" Object o = null Link anyLink 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 for anyLink in o <- "*" do{ LinkCount++ }
} } }
所以我的问题是 goThroughFolders(Folder f)
中的函数调用 checkLinks(module(itm))
似乎交出了一个 null
对象。
Error:
-R-E- DXL: <Line:11> null Module do loop parameter was passed
Backtrace:
<Line:69>
<Line:78>
-I- DXL: execution halted
但我不知道为什么?你能帮帮我吗?
发现遗漏的步骤做得很好。您可能想要做的另一件事是在完成分析后关闭模块,否则,您可能会忘记并让它们保持打开状态,从而牺牲内存,直到您退出 DOORS。
我在下面进行了一些修改和添加以实现此目的 - 如果有任何不清楚的地方,请随时询问。
理查德
Module m
Skip skLinkSourceMods = create() // Create a skip list to hold references to all modules opened for link analysis
int linkCount = 0
void checkLinks(Item itm, Skip skOpenMods) // Function signature changed to pass in the skip list - not strictly necessary, but clean
{
m = read (fullName(itm), false, true)
put(skOpenMods, m, m) // Add the opened module to the skip list, so we can easily close it later
string objType = ""
Object o = null
Link anyLink
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
for anyLink in o <- "*" do {
linkCount++
}
}
}
}
void goThroughFolders(Folder f)
{
Item itm
if (null f) return
for itm in f do {
print("\nScanning folder...")
if (null itm) continue
if (isDeleted(itm)) continue
else if ((type (itm) == "Project") || (type (itm) == "Folder"))
{
goThroughFolders(folder(itm))
}
else if (type (itm) == "Formal") {
print("\nFound Module")
checkLinks(itm, skLinkSourceMods) // Function signature changed (see above) to pass in the skip list - not strictly necessary, but clean
}
}
}
void closeModules(Skip skOpenMods)
{
for m in skOpenMods do // Loop through each module in the skip list
{
close(m, false) // Close the module without saving changes (we shouldn't have any - they were opened read-only anyway!)
}
}
goThroughFolders(current Folder)
print "\n" linkCount " links."
closeModules(skLinkSourceMods)
delete(skLinkSourceMods)