Main Content

move

Class: slreq.Justification
Namespace: slreq

Move justification in hierarchy

Since R2020b

Syntax

tf = move(jt1,location,jt2)

Description

tf = move(jt1,location,jt2) moves justification jt1 under, before, or after justification jt2 depending on the location specified by location. The function returns 1 if the move is executed without error.

Input Arguments

expand all

Justification to move, specified as an slreq.Justification object.

Justification move location, specified as 'under', 'before', or 'after'.

Justification, specified as an slreq.Justification object.

Output Arguments

expand all

Paste success status, returned as a 0 or 1 of data type logical.

Examples

expand all

This example shows how to move a justification under, before, or after another justification.

Load the crs_req_justsrequirement file, which describes a cruise control system, and assign it to a variable. Find two justifications by index. The first justification will be moved in relation to the second justification.

rs = slreq.load('crs_req_justs');
jt1 = find(rs,'Type','Justification','Index','5.1');
jt2 = find(rs,'Type','Justification','Index','5.2');

Move Under a Justification

Move the first justification, jt1, under the second justification, jt2. The first justification becomes the last child justification of justification jt2, and jt2 moves up one in the hierarchy, which you can verify by checking the index of jt1 and jt2. The old indices of jt1 and jt2 were 5.1 and 5.2, respectively.

tf = move(jt1,'under',jt2);
jt1.Index
ans = 
'5.1.3'
jt2.Index
ans = 
'5.1'

Move Before a Justification

Move the first justification, jt1, before the second justification, jt2. Confirm that the justification was moved correctly by checking the indices of jt1 and jt2. The indices of jt1 and jt2 are now the same as they were originally: 5.1 and 5.2, respectively.

tf = move(jt1,'before',jt2);
jt1.Index
ans = 
'5.1'
jt2.Index
ans = 
'5.2'

Move After a Justification

Move the first justification, jt1, after the second justification, jt2. When you move justification jt1 down in the hierarchy, justification jt2 also moves up, which you can verify by checking the indices of jt1 and jt2.

tf = move(jt1,'after',jt2);
jt1.Index
ans = 
'5.2'
jt2.Index
ans = 
'5.1'

Version History

Introduced in R2020b