Skip to content

Extend TreeNodeWithChangeSupport with Visitor pattern #262

@Schmoho

Description

@Schmoho

This is a suggestion: It seems to me that the current implementation does not support the idiomatic way to perform tree walks in Java, because the TreeNode interface that is used does not support the Visitor pattern.

That is, doing a tree walk now requires to explicitly handle type dispatch in the walking class, which is kind of painful to do when also accounting for Plugins and Version differences.

I am very uncertain whether my current understanding of JSBML is correct in that regard and also I am kind of shaky on Java patterns, so please feel free to correct me.

Since the TreeNodeWithChangeSupport interface is the central interface which allows to perform generic tree walks on SBMLDocuments, I would suggest to add at least one interfacesMutatingTreeNodeVisitor with signatures public void visit (Species s) etc. TreeNodeWithChangeSupport would then have void accept(MutatingTreeNodeVisitor v).

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