Class Comment

  • All Implemented Interfaces:
    IDatatypeVisitable, IModelElement
    Direct Known Subclasses:
    StructuredComment

    public class Comment
    extends ContainableModelElement
    Represents a comment in the source of an IVML file. Instances of this model element are required to properly restore the input IVML file (after modifications) by using output iterators. Each comment consists of its text (may be multiple successive comments and whitespaces without outer model element in between) and a position which indicates where in the following model element to attach this comment to (supported constant definitions are given in this class).
    Please note: Currently we realize a simplified model for the comments, i.e. only comments which describe language constructs but not inlined comments within individual language constructs are implemented by this class and by specialized subclasses.
    Author:
    Holger Eichelberger
    • Constructor Detail

      • Comment

        Comment()
        Constructor for serialization.
      • Comment

        public Comment​(java.lang.String comment,
                       IModelElement parent)
        Creates a new comment element.
        Parameters:
        comment - the comment (to be stored as the "name" of this model element)
        parent - the model element, in which this specific one is embedded
    • Method Detail

      • accept

        public void accept​(IModelVisitor visitor)
        Description copied from interface: IModelElement
        Accept method for the visitor.
        Parameters:
        visitor - The visitor, which should process this model element.
      • getComment

        public Comment getComment​(java.lang.Object element)
        Returns the comment assigned to the given model element.
        Parameters:
        element - the element to return the comment for
        Returns:
        the assigned comment (or null if none is assigned), null by default
      • assignComment

        public void assignComment​(java.lang.Object element,
                                  Comment comment)
        Assigns a comment to the given model element. This method is not implemented.
        Parameters:
        element - the element to assign the comment to
        comment - the comment to assign the element to