The Dictionary class

 

Overview

class Dictionary extends DictionaryElement;

 

A Dictionary can contain Terms and other Dictionaries. Its purpose can be described in the Text attribute.

 

A Dictionary belongs to its parent Dictionary, except for the root Dictionary, which belongs to the RequirementProject.

 

A Dictionary can be typed. In this case, all owned dictionaries and terms must have the same type. It then also has a default PropertyValueSet, which stores all PropertySet property default values (see PropertyValue). This default PropertyValueSet is then used to initialize new Term property values and Dictionary default values.

 

Detailed class diagram for Dictionary

 

Note:       RequirementProject, DictionaryElement, PropertySet, PropertyValueSet

 

 

Dictionary properties

The class has the following associations:

·         Owned:DictionaryElement: owned Dictionaries and Terms.

·         DefaultSet:PropertyValueSet: default property values for typed dictionaries

·         Type:PropertySet: Type of the dictionary

 

The class owns the following attribute:

·         Text:string: Description of the dictionary.

 

 

Dictionary consistency rules

Composition:

·         A Dictionary belongs to a Dictionary or to a RequirementProject.

 

Type:

·         If the owner Dictionary has a type, the Dictionary must have the same type.

 

Default set:

·         If the Dictionary has a type, it must have a default set (PropertyValueSet) of the same type.

·         If the Dictionary has no type, it must have NO default set (PropertyValueSet).

 

 

Dictionary methods

PropertyValue getPropertyDefaultValue(in string key)

This returns the default PropertyValue for the key named Property (see PropertyValue).

 

 

 

boolean setPropertyDefaultValue(in string key, in string value)

This changes a property default value. The corresponding PropertyValue must already exist in the default PropertyValueSet. In this case, the method returns true, otherwise it returns false.

 

 

updatePropertyValues()

This updates, creates or destroys the PropertyValueSet, in order to make it consistent with the type. All missing PropertyValue are created and defined using the container’s default values.

 

Owned dictionaries and terms are not updated.

 

 

forceTypeConsistency()

This updates the Dictionary’s type, in order to make it consistent with the owner container type. If any change is made, this propagates it to the owned Dictionaries and Terms, updates all DictionaryElements property values by calling the updatePropertyValues method.

 

This returns true if any change has been made, otherwise it returns false.

 

This method is automatically called if needed at the end of the J session (when calling the sessionEnd() J method), but you must call it manually if you need to access the property values after having changed the Dictionary type, or when removing the Dictionary type.