Alle Beiträge von Björn Karpenstein

Diplom Informatiker, Programmierer, Musikbegeisterter

IBM Doors DXL: get previous Baseline (not mostRecentBaseline) / vorherige Baseline ermitteln

Problem

Die Standardmethode gibt vom current die aktuelle Baseline zurück. Es soll aber die vorherige ermittelt warden.

Ansatz – Approach

Es wird durch die Baselines iteriert
Iterate through all baselines and get the previous (not the most recent) Baseline

Solution – Lösung

string getPreviousBaselineVersion(Module m)
{
	Baseline b;
	Module currentModule=current;
	int blCount=0;
	int minorVersion=0;
	int majorVersion=0;

	for b in currentModule do 
	{
		blCount++;
	}

	int bl2Count=0;
	for b in currentModule do 
	{
		if(bl2Count==blCount-2)
		{
		  minorVersion = (minor b);
		  majorVersion = (major b);
		}
		bl2Count++;
	}

	return majorVersion "." minorVersion "";	
}

print getPreviousBaselineVersion(current);

IBM Doors DXL: Remove all Triggers from a module

Problem

All triggers, that are on a module, shall be deleted.

Approach – Ansatz

  • Iterate trough all module triggers
  • Delete trigger by using trigger reference

Lösung – Solution

void removeAllTriggersOnModule(Module mod)
{
	Module oldCurrent = current;
	current=mod;
	
	  Trigger t;
	  for t in mod do 
	  {
		string triggerName=name(t) "";
		if( !matches("specific", triggerName) )
		{
			delete t;
		}
	  }
	
	current=oldCurrent;	
}

IBM Doors DXL: Check if Module/Object DataType or Attribute exists

Problem

The existence of DataTypes or Attributes shall be checked

Approach – Ansatz

  • The first function uses the find-function to check for attributes
  • The second uses a loop to check for datatypes

Solution – Lösung

bool attributeExists(Module tgt, string attributeName)
{
	AttrDef ad = find(tgt, attributeName) 
	
	if(null ad)
	{
		return false;
	}
	else
	{
		return true;
	}		
	return false;
}

// This example is done in a different way but works
// here for DataTypes (instead the find function can be used)
bool dataTypeExists(Module tgt, string dataTypeName)
{
	AttrType at;
	
	for at in tgt do 
	{
		if(at.name == dataTypeName)
		{
			return true;
		}
	}	
	
	return false;
}

IBM Doors DXL: Rename Module/Object DataType or Attribute

Problem

The name of a DataType or an attribute shall be changed.

Ansatz – Approach

The modify function can be used to rename the functions

Solution – Lösung

void renameDataType(Module mod, string oldString, string newString)
{
	AttrType at = find(mod, oldString);

	if(null at)
	{
		print(name(mod) ": RENAME-" oldString " existiert nicht";
	}
	string ErrMess = ""
	modify (at, newString, ErrMess)
}

void renameAttribute(Module mod, string oldString, string newString)
{
	AttrDef ad = find(mod, oldString);

	if(null ad)
	{
		print(name(mod) ": RENAME-" oldString " existiert nicht");
	}
	string ErrMess = "";
	AttrDef adNew = modify(ad, setName, newString) 
}

IBM Doors DXL: Rename/Replace Enumeration Value of a DataType – Enumerationswert ändern

Problem

An existing enumeration value should be renamed or replaced

Approach – Ansatz

We have to iterate through the Type-Array and repopulate new arrays, which will be used as parameters for the modify function

Solution – Lösung

//This program was intended to replace the values of an enumerated attribute
//The replace will not affect the current selected values, it will just change the value to the new one
 
pragma runLim, 0
 
void replaceAttributeTypeValue(Module m, string atName, string oldVal, string newVal){
    AttrType att = find(m, atName)
        //Declare Arrays Size
        int colores[att.size]
        int arrMap[att.size]
        string arr[att.size]
        int arrVal[att.size]
        
        int i
        //Populate Arrays
        for(i = 0; i < att.size; i++){ 
                arr[i] = att.strings[i]
                arrVal[i] = i
                colores[i] = -1
                arrMap[i] = i
        }
        //
        for(i = 0; i < sizeof(arr); i++){ 
                if(arr[i] == oldVal){
                        arr[i] = newVal
                }
        }
 
        string err = null
        AttrType at2 = modify(att, atName, arr, arrVal, colores, arrMap, err)
        if(!null err){
                print "Failed: " err"\n"
        }
        else{
                infoBox at2.name " - Modified Successfully"
        }
}

IBM Doors DXL: Folder- or Formal Module Browser/Picker (based on smartdxl.de)

Problem

The Mini Explorer Script from SmartDXL.de allows to create a Browse/Select Dialoges on a project and select Modules.
It can be customized dependend on the requested item type.

Approach

Customization of the script

Solution – Lösung

This Mini Explorer Version is only for Module selection.
MiniExplorerModuleSelection

This Mini Explorer Version is only for Folder selection.
MiniExplorerFolderSelection

IBM Doors DXL: Difference between LinkRef and Link Objects / Unterschied zwischen LinkRef und Link

Problem

Der Unterschied zwischen den Objekten LinkRef und Link soll anhand eines Beispiels verdeutlicht werden.
To show the difference between the LinkRef and Link Objects in DXL an example will be shown

Ansatz – Approach

LinkRef enthält weniger Informationen als Link, kann allerdings auch bei nicht geöffnetem Modul in einer Schleife durchlaufen werden. Es wird daher genutzt, um die Module zu öffnen um später mit dem Link-Objekt die vollständigen Informationen des Link-Objekts zu erhalten.
LinkRef contain less information than Link and can be iterated without opening the module. It is used often to open the modules and iterate them with the Link Objekt, which contains the full information

Lösung – Solution

Example: Layout-DXL which shows the In-Links
Beispiel für ein Layout DXL, was die In-Links ausgibt

// A Link can only be read when the source module is open
Link lnk;

// LinkRefs can be iterated on an object, although the
// object is closed
LinkRef lref;

string srcModuleName;

// Iterate the LinkRefs to open the modules – this
// should be done to get all Links back
for lref in obj<-"*" do { srcModuleName = fullName source (lref); if (!open module srcModuleName) { read(srcModuleName, false); } } // After the source Links have been opened, they can be // iterated with a Link Object for lnk in obj <- "*" do { Object src = source lnk; display(identifier(src) ""); } [/javascript]

IBM Doors DXL: Create Module with Attributes

Problem

A new module with attributes shall be created.

Ansatz – Approach

Uasage of createModule and AttrDef=create

Lösung – Solution

void createAttributes(Module mod)
{
	Module oldCurrent=current;
	current = mod;
	AttrDef attrObjIdentifier = create object type "Text" attribute "BB_Object_Identifier";
	AttrDef attrObjStatus = create object type "Text" attribute "BB_Object_Status";
	AttrDef attrLinks = create object type "Text" attribute "BB_Outgoing_Links";
	current=oldCurrent;
}

string creationPathOfTempModule="/VarCo/20 Sample Project/Administration/" tmpFileName;	
Module newModule = createModule(creationPathOfTempModule, tmpFileName);
createAttributes(newModule);	

IBM Doors DXL: Prüfen ob ein Objekt Attribute existiert / Check if object attribute exists

Problem

Es soll überprüft/abgefragt werden ob ein Attribute eines Objektes existiert.
Das Objekt muss nicht unbedingt im current Module sein (wie im zweiten Beispiel ganz unten).
A check if an object attribute exists shall be performed.
It is not sure if the object is in the current module (like in the second example in solution section).

Ansatz – Approach

Es wird nach Null beim Result bei der AttrDef find-Methode gefragt
By using the AttrDef=find method we can ask for null (not existing)

Lösung – Solution

string getObjectValueIfExist(Object nObject, string attributeName)
{
	AttrDef ad = find(module nObject, attributeName) 
	if(!null ad)
	{
	    return nObject.attributeName "";
	}
	return "n/a";
}

Im current Module kann auch

if (exists(attribute(string "BB_PlannedRelease"))) 
{	
 ...
}    

verwendet werden

Starcraft II: Reismades StarCraft II Zerg Strategie für Platin Rang 3

Baue Drohnen bis 10/10
Warte bis Du 70 Mineralien hast
Baue den ersten Extraktor und eine Drohne
Zwischenzeitlich wurden die restlichen 10 auch geernet: 30 extraktor + 50 drohne
Warte bis Du 70 Mineralien hast
Baue den zweiten Extraktor und eine Drohne
Reisse beide Extratoren ab -> 2 Drohnen erhalten
Lasse die 2 überschüssigen Drohnen ernten
Baue den Pool (11 Drohnen)
Warte bis 100 Mineralien
Baue einen Overlord (10 Drohnen)
Warte bis Overloard fertig
Zwischenzeitlich hat man 3 Larven
Baue 3 Drohnen, wenn die nächste nachkommt gleich noch eine (15/18 Drohnen)
Baue eine Queen (17/18 Drohnen)
Mit der nächsten Larve: Baue einen Overlord
Baue eine Drohne (18/18)
Bei 200 schicke Drohne zum Exenbau los
Baue Exe bei 300
Baue Schabenhöhle
Baue 2 Extraktoren
Baue 3 Drohnen