Skip to content

SimpleClassDiagrams diamond inheritance #147

@joeriexelmans

Description

@joeriexelmans

While multiple inheritance is supported in the SimpleClassDiagrams formalism, creating an instance that has diamond inheritance gives an error "500:constraint (post-create noInheritanceLoops) failed".

image

Is this intended behavior?

  • If so, we must make it explicit that diamond inheritance is not allowed.
  • Otherwise, the constraint checking function should be fixed to allow this.

The constraint checking function is currently as follows:

var mm      = '/Formalisms/__LanguageSyntax__/SimpleClassDiagram/SimpleClassDiagram/',
    nout    = getNeighbors('>',mm+'Class'),
    visited = [];
function dfs(to_visit)
{
    var curr = to_visit.pop();
    if( curr == undefined )
        return true;
    else if( visited.indexOf(curr) > -1 )
        return false;
    else
    {
        visited.push(curr);
        var ntype = (getAttr('$type',curr) == mm+'Class' ? 
                    mm+'Inheritance' : mm+'Class');
        return dfs( to_visit.concat(getNeighbors('>',ntype,curr)) );
    }
}
dfs(nout);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions