Class ASTCNode

java.lang.Object
de.monticore.ast.ASTCNode
All Implemented Interfaces:
ASTNode, Cloneable

public abstract class ASTCNode extends Object implements ASTNode, Cloneable
Foundation class of all AST-classes Shouldn't be used in an implementation, all AST-classes also share the interface ASTNode
  • Field Details

    • start

      protected Optional<de.se_rwth.commons.SourcePosition> start
    • end

      protected Optional<de.se_rwth.commons.SourcePosition> end
    • precomments

      protected List<Comment> precomments
    • postcomments

      protected List<Comment> postcomments
  • Constructor Details

    • ASTCNode

      public ASTCNode()
  • Method Details

    • deepClone

      public abstract ASTNode deepClone()
      Description copied from interface: ASTNode
      Performs a deep clone of this ASTNode and all of its successors
      Specified by:
      deepClone in interface ASTNode
      Returns:
      Clone of current ASTNode with a parent which is equal to null
    • get_SourcePositionEnd

      public de.se_rwth.commons.SourcePosition get_SourcePositionEnd()
      Description copied from interface: ASTNode
      Returns the end position of this ASTNode
      Specified by:
      get_SourcePositionEnd in interface ASTNode
      Returns:
      end position of this ASTNode
    • set_SourcePositionEnd

      public void set_SourcePositionEnd(de.se_rwth.commons.SourcePosition end)
      Description copied from interface: ASTNode
      Sets the end position of this ASTNode
      Specified by:
      set_SourcePositionEnd in interface ASTNode
      Parameters:
      end - end position of this ASTNode
    • isPresent_SourcePositionEnd

      public boolean isPresent_SourcePositionEnd()
      Specified by:
      isPresent_SourcePositionEnd in interface ASTNode
      Returns:
      true if the optional source position end of this ASTNode is present
    • set_SourcePositionEndAbsent

      public void set_SourcePositionEndAbsent()
      Description copied from interface: ASTNode
      Sets the optional end position of this ASTNode absent
      Specified by:
      set_SourcePositionEndAbsent in interface ASTNode
    • get_SourcePositionStart

      public de.se_rwth.commons.SourcePosition get_SourcePositionStart()
      Description copied from interface: ASTNode
      Returns the start source position of this ASTNode
      Specified by:
      get_SourcePositionStart in interface ASTNode
      Returns:
      start position of this ASTNode
    • set_SourcePositionStart

      public void set_SourcePositionStart(de.se_rwth.commons.SourcePosition start)
      Description copied from interface: ASTNode
      Sets the start position of this ASTNode
      Specified by:
      set_SourcePositionStart in interface ASTNode
      Parameters:
      start - start position of this ASTNode
    • isPresent_SourcePositionStart

      public boolean isPresent_SourcePositionStart()
      Specified by:
      isPresent_SourcePositionStart in interface ASTNode
      Returns:
      true if the optional source position start of this ASTNode is present
    • set_SourcePositionStartAbsent

      public void set_SourcePositionStartAbsent()
      Description copied from interface: ASTNode
      Sets the optional start position of this ASTNode absent
      Specified by:
      set_SourcePositionStartAbsent in interface ASTNode
    • clear_PreComments

      public void clear_PreComments()
      Description copied from interface: ASTNode
      Clears the list of preComments, that only an empty list stays
      Specified by:
      clear_PreComments in interface ASTNode
    • add_PreComment

      public boolean add_PreComment(Comment precomment)
      Description copied from interface: ASTNode
      Adds one new comment to the list of preComments
      Specified by:
      add_PreComment in interface ASTNode
      Parameters:
      precomment - one comment
      Returns:
      boolean
    • addAll_PreComments

      public boolean addAll_PreComments(Collection<Comment> precomments)
      Description copied from interface: ASTNode
      Adds a list of comments to the already existing preComment list
      Specified by:
      addAll_PreComments in interface ASTNode
      Parameters:
      precomments - a list of comments
      Returns:
      boolean
    • contains_PreComment

      public boolean contains_PreComment(Object element)
      Description copied from interface: ASTNode
      Checks if the list contains the given Object Returns true if the Object is contained in the list of comments and false if it is not
      Specified by:
      contains_PreComment in interface ASTNode
      Parameters:
      element - which should be contained in the comments
      Returns:
      boolean true if the list contains the Object
    • containsAll_PreComments

      public boolean containsAll_PreComments(Collection<?> element)
      Description copied from interface: ASTNode
      Checks if the list contains the given Collection of elements Returns true if the Collection is contained in the list of comments and false if it is not
      Specified by:
      containsAll_PreComments in interface ASTNode
      Parameters:
      element - collection which should be contained in the comment list
      Returns:
      boolean true if the list contains the Object
    • isEmpty_PreComments

      public boolean isEmpty_PreComments()
      Description copied from interface: ASTNode
      Checks if the list is empty, has no elements Returns true if the list is empty and false if it has elements
      Specified by:
      isEmpty_PreComments in interface ASTNode
      Returns:
      boolean true if the list is empty
    • iterator_PreComments

      public Iterator<Comment> iterator_PreComments()
      Description copied from interface: ASTNode
      Returns the Iterator for the preComment list
      Specified by:
      iterator_PreComments in interface ASTNode
      Returns:
      Iterator of comments to iterate over the preComment list
    • remove_PreComment

      public boolean remove_PreComment(Object element)
      Description copied from interface: ASTNode
      Removes one given element from the list if this element is contained
      Specified by:
      remove_PreComment in interface ASTNode
      Parameters:
      element - which should be removed if it is present
      Returns:
      boolean
    • removeAll_PreComments

      public boolean removeAll_PreComments(Collection<?> element)
      Description copied from interface: ASTNode
      Removes a collection of elements from the list if the elements are contained
      Specified by:
      removeAll_PreComments in interface ASTNode
      Parameters:
      element - collection which should be removed if they are present
      Returns:
      boolean
    • retainAll_PreComments

      public boolean retainAll_PreComments(Collection<?> element)
      Description copied from interface: ASTNode
      Retrains a collection of elements from the list if the elements are contained
      Specified by:
      retainAll_PreComments in interface ASTNode
      Parameters:
      element - collection which should be retrained if they are present
      Returns:
      boolean
    • size_PreComments

      public int size_PreComments()
      Description copied from interface: ASTNode
      counts the number of preComments in the preComment list and returns that number as an Int
      Specified by:
      size_PreComments in interface ASTNode
      Returns:
      int the number of comments is returned
    • toArray_PreComments

      public Comment[] toArray_PreComments(Comment[] array)
      Description copied from interface: ASTNode
      Converts the list of preComments into an array of comments and returns that array
      Specified by:
      toArray_PreComments in interface ASTNode
      Parameters:
      array - into which the comments should be added
      Returns:
      Comment[] array which contains all the comments
    • removeIf_PreComment

      public boolean removeIf_PreComment(Predicate<? super Comment> filter)
      Description copied from interface: ASTNode
      removes if the comment if the predicate is fulfilled
      Specified by:
      removeIf_PreComment in interface ASTNode
      Parameters:
      filter - which selects different comments
      Returns:
      boolean
    • spliterator_PreComments

      public Spliterator<Comment> spliterator_PreComments()
      Description copied from interface: ASTNode
      Returns the Spliterator of the preComment list
      Specified by:
      spliterator_PreComments in interface ASTNode
      Returns:
      Spliterator of the preComment list
    • stream_PreComments

      public Stream<Comment> stream_PreComments()
      Description copied from interface: ASTNode
      Returns the Steam of the preComment list
      Specified by:
      stream_PreComments in interface ASTNode
      Returns:
      Steam of the preComment list
    • parallelStream_PreComments

      public Stream<Comment> parallelStream_PreComments()
      Description copied from interface: ASTNode
      Returns the parallel Steam of the preComment list
      Specified by:
      parallelStream_PreComments in interface ASTNode
      Returns:
      parallel Stream of the preComment list
    • forEach_PreComments

      public void forEach_PreComments(Consumer<? super Comment> action)
      Description copied from interface: ASTNode
      Consumer is given that performs an action but does not return a value
      Specified by:
      forEach_PreComments in interface ASTNode
      Parameters:
      action - that does something but has no return value
    • add_PreComment

      public void add_PreComment(int index, Comment precomment)
      Description copied from interface: ASTNode
      adds one comment to the preComment list at the position of the given index
      Specified by:
      add_PreComment in interface ASTNode
      Parameters:
      index - of the existing list where it should be added
      precomment - the comment that is added to the existing list
    • addAll_PreComments

      public boolean addAll_PreComments(int index, Collection<Comment> precomments)
      Description copied from interface: ASTNode
      adds a list of comments to the preComment list at the position of the given index
      Specified by:
      addAll_PreComments in interface ASTNode
      Parameters:
      index - of the existing list where the new list should be added
      precomments - list that is added to the existing list
    • get_PreComment

      public Comment get_PreComment(int index)
      Description copied from interface: ASTNode
      Returns one comment of the list from the position of the given index
      Specified by:
      get_PreComment in interface ASTNode
      Parameters:
      index - in the existing list where the comment should be returned
      Returns:
      Comment at the given index is returned
    • indexOf_PreComment

      public int indexOf_PreComment(Object element)
      Description copied from interface: ASTNode
      Returns the index of the given element if it exists in the list
      Specified by:
      indexOf_PreComment in interface ASTNode
      Parameters:
      element - of which the index in the comment list should be returned
      Returns:
      int index where the Object is found
    • lastIndexOf_PreComment

      public int lastIndexOf_PreComment(Object element)
      Description copied from interface: ASTNode
      Returns the last index of the given element if it exists in the list
      Specified by:
      lastIndexOf_PreComment in interface ASTNode
      Parameters:
      element - of which the last index in the comment list should be returned
      Returns:
      int index where the Object is found latest
    • equals_PreComments

      public boolean equals_PreComments(Object element)
      Description copied from interface: ASTNode
      Returns true if the object equals the preComment list Returns false if the object and the preComment list are not equal
      Specified by:
      equals_PreComments in interface ASTNode
      Parameters:
      element - which should be equal to the preComment list
      Returns:
      boolean if the object an preComment list are equal or not
    • hashCode_PreComments

      public int hashCode_PreComments()
      Description copied from interface: ASTNode
      Returns the hashCode of the preComment as an int
      Specified by:
      hashCode_PreComments in interface ASTNode
      Returns:
      int the hashCode of the preComment
    • listIterator_PreComments

      public ListIterator<Comment> listIterator_PreComments()
      Description copied from interface: ASTNode
      Returns the ListIterator of the preComment list
      Specified by:
      listIterator_PreComments in interface ASTNode
      Returns:
      ListIterator which iterates over the list of preComments
    • remove_PreComment

      public Comment remove_PreComment(int index)
      Description copied from interface: ASTNode
      Returns the new preComment list without the removed element at the given index
      Specified by:
      remove_PreComment in interface ASTNode
      Parameters:
      index - where the element should be removed
      Returns:
      the Comment previously at the specified position
    • subList_PreComments

      public List<Comment> subList_PreComments(int start, int end)
      Description copied from interface: ASTNode
      Returns the sub list form the preComment list form the start to the end index which are given
      Specified by:
      subList_PreComments in interface ASTNode
      Parameters:
      start - index of the sublist
      end - index of the sublist
      Returns:
      ListIterator which iterates over the list of preComments
    • replaceAll_PreComments

      public void replaceAll_PreComments(UnaryOperator<Comment> operator)
      Description copied from interface: ASTNode
      replaces all preComments that fit to the given unaryOperator
      Specified by:
      replaceAll_PreComments in interface ASTNode
      Parameters:
      operator - that defines which preComments should be replaced
    • sort_PreComments

      public void sort_PreComments(Comparator<? super Comment> comparator)
      Description copied from interface: ASTNode
      sorts the preComment list through a given way of comparing through the comparator
      Specified by:
      sort_PreComments in interface ASTNode
      Parameters:
      comparator - that defines in which way the preComments should be sorted
    • set_PreCommentList

      public void set_PreCommentList(List<Comment> preComments)
      Description copied from interface: ASTNode
      sets the complete list of preComments to the given preComment list
      Specified by:
      set_PreCommentList in interface ASTNode
      Parameters:
      preComments - list that should be set
    • get_PreCommentList

      public List<Comment> get_PreCommentList()
      Description copied from interface: ASTNode
      returns the complete preComments list
      Specified by:
      get_PreCommentList in interface ASTNode
      Returns:
      List that is contained in the preComment list at the moment
    • listIterator_PreComments

      public ListIterator<Comment> listIterator_PreComments(int index)
      Description copied from interface: ASTNode
      returns a ListIterator of the type Comment for the preComment list
      Specified by:
      listIterator_PreComments in interface ASTNode
      Parameters:
      index - of the iterator
      Returns:
      ListIterator of a special index
    • set_PreComment

      public Comment set_PreComment(int index, Comment precomment)
      Description copied from interface: ASTNode
      sets the comment at the given index and returns that comment
      Specified by:
      set_PreComment in interface ASTNode
      Parameters:
      index - where the comment should be added to the list
      precomment - that should be added at the index
      Returns:
      Comment at a special index
    • toArray_PreComments

      public Object[] toArray_PreComments()
      Description copied from interface: ASTNode
      converts the commentlist into an array of the type Object and returns thar array
      Specified by:
      toArray_PreComments in interface ASTNode
      Returns:
      an array of the type Object
    • clear_PostComments

      public void clear_PostComments()
      Description copied from interface: ASTNode
      Clears the list of postComments, that only an empty list stays
      Specified by:
      clear_PostComments in interface ASTNode
    • add_PostComment

      public boolean add_PostComment(Comment postcomment)
      Description copied from interface: ASTNode
      Adds one new comment to the list of postComments
      Specified by:
      add_PostComment in interface ASTNode
      Parameters:
      postcomment - one comment
      Returns:
      boolean
    • addAll_PostComments

      public boolean addAll_PostComments(Collection<Comment> postcomments)
      Description copied from interface: ASTNode
      Adds a list of comments to the already existing postComment list
      Specified by:
      addAll_PostComments in interface ASTNode
      Parameters:
      postcomments - a list of comments
      Returns:
      boolean
    • contains_PostComment

      public boolean contains_PostComment(Object element)
      Description copied from interface: ASTNode
      Checks if the list contains the given Object Returns true if the Object is contained in the list of comments and false if it is not
      Specified by:
      contains_PostComment in interface ASTNode
      Parameters:
      element - which should be contained in the comments
      Returns:
      boolean true if the list contains the Object
    • containsAll_PostComments

      public boolean containsAll_PostComments(Collection<?> element)
      Description copied from interface: ASTNode
      Checks if the list contains the given Collection of elements Returns true if the Collection is contained in the list of comments and false if it is not
      Specified by:
      containsAll_PostComments in interface ASTNode
      Parameters:
      element - collection of elements which should be contained in the comment list
      Returns:
      boolean true if the list contains the Object
    • isEmpty_PostComments

      public boolean isEmpty_PostComments()
      Description copied from interface: ASTNode
      Checks if the list is empty, has no elements Returns true if the list is empty and false if it has elements
      Specified by:
      isEmpty_PostComments in interface ASTNode
      Returns:
      boolean true if the list is empty
    • iterator_PostComments

      public Iterator<Comment> iterator_PostComments()
      Description copied from interface: ASTNode
      Returns the Iterator for the postComment list
      Specified by:
      iterator_PostComments in interface ASTNode
      Returns:
      Iterator to iterate over the postComment list
    • remove_PostComment

      public boolean remove_PostComment(Object element)
      Description copied from interface: ASTNode
      removes one given element from the list if this element is contained
      Specified by:
      remove_PostComment in interface ASTNode
      Parameters:
      element - which should be removed if it is postsent
      Returns:
      boolean
    • removeAll_PostComments

      public boolean removeAll_PostComments(Collection<?> element)
      Description copied from interface: ASTNode
      removes a collection of elements from the list if the elements are contained
      Specified by:
      removeAll_PostComments in interface ASTNode
      Parameters:
      element - collection which should be removed if they are postsent
      Returns:
      boolean true if the elements were postsent and are now removed
    • retainAll_PostComments

      public boolean retainAll_PostComments(Collection<?> element)
      Description copied from interface: ASTNode
      Retrains a collection of elements from the list if the elements are contained
      Specified by:
      retainAll_PostComments in interface ASTNode
      Parameters:
      element - collection which should be retrained if they are present
      Returns:
      boolean
    • size_PostComments

      public int size_PostComments()
      Description copied from interface: ASTNode
      counts the number of postComments in the postComment list and returns that number as an Int
      Specified by:
      size_PostComments in interface ASTNode
      Returns:
      int the number of comments is returned
    • toArray_PostComments

      public Comment[] toArray_PostComments(Comment[] array)
      Description copied from interface: ASTNode
      Converts the list of postComments into an array of comments and returns that array
      Specified by:
      toArray_PostComments in interface ASTNode
      Parameters:
      array - into which the comments should be added
      Returns:
      Comment[] array which contains all the comments
    • removeIf_PostComment

      public boolean removeIf_PostComment(Predicate<? super Comment> filter)
      Description copied from interface: ASTNode
      removes if the comment if the postdicate is fulfilled
      Specified by:
      removeIf_PostComment in interface ASTNode
      Parameters:
      filter - which selects different comments
      Returns:
      boolean
    • spliterator_PostComments

      public Spliterator<Comment> spliterator_PostComments()
      Description copied from interface: ASTNode
      Returns the Spliterator of the postComment list
      Specified by:
      spliterator_PostComments in interface ASTNode
      Returns:
      Spliterator of the postComment list
    • stream_PostComments

      public Stream<Comment> stream_PostComments()
      Description copied from interface: ASTNode
      Returns the Steam of the postComment list
      Specified by:
      stream_PostComments in interface ASTNode
      Returns:
      Steam of the postComment list
    • parallelStream_PostComments

      public Stream<Comment> parallelStream_PostComments()
      Description copied from interface: ASTNode
      Returns the parallel Steam of the postComment list
      Specified by:
      parallelStream_PostComments in interface ASTNode
      Returns:
      Steam parallel Stream of the postComment list
    • forEach_PostComments

      public void forEach_PostComments(Consumer<? super Comment> action)
      Description copied from interface: ASTNode
      Consumer is given that performs an action but does not return a value
      Specified by:
      forEach_PostComments in interface ASTNode
      Parameters:
      action - that does something but has no return value
    • add_PostComment

      public void add_PostComment(int index, Comment postcomment)
      Description copied from interface: ASTNode
      adds one comment to the postComment list at the position of the given index
      Specified by:
      add_PostComment in interface ASTNode
      Parameters:
      index - of the existing list where it should be added
      postcomment - the comment that is added to the existing list
    • addAll_PostComments

      public boolean addAll_PostComments(int index, Collection<Comment> postcomments)
      Description copied from interface: ASTNode
      adds a list of comments to the postComment list at the position of the given index
      Specified by:
      addAll_PostComments in interface ASTNode
      Parameters:
      index - of the existing list where the new list should be added
      postcomments - the comment list that is added to the existing list
    • get_PostComment

      public Comment get_PostComment(int index)
      Description copied from interface: ASTNode
      Returns one comment of the list from the position of the given index
      Specified by:
      get_PostComment in interface ASTNode
      Parameters:
      index - of the existing list where the comment should be returned
      Returns:
      Comment at the given index is returned
    • indexOf_PostComment

      public int indexOf_PostComment(Object element)
      Description copied from interface: ASTNode
      Returns the index of the given element if this exists in the list
      Specified by:
      indexOf_PostComment in interface ASTNode
      Parameters:
      element - of which the index in the comment list should be returned
      Returns:
      int index where the Object is found
    • lastIndexOf_PostComment

      public int lastIndexOf_PostComment(Object element)
      Description copied from interface: ASTNode
      Returns the last index of the given element if this exists in the list
      Specified by:
      lastIndexOf_PostComment in interface ASTNode
      Parameters:
      element - of which the last index in the comment list should be returned
      Returns:
      int index where the Object is found latest
    • equals_PostComments

      public boolean equals_PostComments(Object element)
      Description copied from interface: ASTNode
      Returns true if the object equals the postComment list Returns false if the object and the postComment list are not equal
      Specified by:
      equals_PostComments in interface ASTNode
      Parameters:
      element - which should be equal to the postComment list
      Returns:
      boolean if the object an postComment list are equal or not
    • hashCode_PostComments

      public int hashCode_PostComments()
      Description copied from interface: ASTNode
      Returns the hashCode of the postComment as an int
      Specified by:
      hashCode_PostComments in interface ASTNode
      Returns:
      int the hashCode of the postComment
    • listIterator_PostComments

      public ListIterator<Comment> listIterator_PostComments()
      Description copied from interface: ASTNode
      Returns the ListIterator of the postComment list
      Specified by:
      listIterator_PostComments in interface ASTNode
      Returns:
      ListIterator which iterates over the list of postComments
    • remove_PostComment

      public Comment remove_PostComment(int index)
      Description copied from interface: ASTNode
      Returns the new postComment list without the removed element at the given index
      Specified by:
      remove_PostComment in interface ASTNode
      Parameters:
      index - where the element should be removed
      Returns:
      List where the comment at the index is removed
    • subList_PostComments

      public List<Comment> subList_PostComments(int start, int end)
      Description copied from interface: ASTNode
      Returns the sub list form the postComment list form the start to the end index which are given
      Specified by:
      subList_PostComments in interface ASTNode
      Parameters:
      start - index of the sublist
      end - index of the sublist
      Returns:
      ListIterator which iterates over the list of postComments
    • replaceAll_PostComments

      public void replaceAll_PostComments(UnaryOperator<Comment> operator)
      Description copied from interface: ASTNode
      replaces all postComments that fit to the given unaryOperator
      Specified by:
      replaceAll_PostComments in interface ASTNode
      Parameters:
      operator - that defines which postComments should be replaced
    • sort_PostComments

      public void sort_PostComments(Comparator<? super Comment> comparator)
      Description copied from interface: ASTNode
      sorts the postComment list through a given way of comparing through the comparator
      Specified by:
      sort_PostComments in interface ASTNode
      Parameters:
      comparator - that defines in which way the postComments should be sorted
    • set_PostCommentList

      public void set_PostCommentList(List<Comment> postComments)
      Description copied from interface: ASTNode
      sets the complete list of postComments to the given postComment list
      Specified by:
      set_PostCommentList in interface ASTNode
      Parameters:
      postComments - list that should be set
    • get_PostCommentList

      public List<Comment> get_PostCommentList()
      Description copied from interface: ASTNode
      returns the complete postComments list
      Specified by:
      get_PostCommentList in interface ASTNode
      Returns:
      List that is contained in the postComment list at the moment
    • listIterator_PostComments

      public ListIterator<Comment> listIterator_PostComments(int index)
      Description copied from interface: ASTNode
      returns a ListIterator of the type Comment for the postComment list
      Specified by:
      listIterator_PostComments in interface ASTNode
      Parameters:
      index - of the iterator
      Returns:
      ListIterator of a special index
    • set_PostComment

      public Comment set_PostComment(int index, Comment precomment)
      Description copied from interface: ASTNode
      sets the comment at the given index and returns that comment
      Specified by:
      set_PostComment in interface ASTNode
      Parameters:
      index - where the comment should be added to the list
      precomment - that should be added at the index
      Returns:
      Comment at a special index
    • toArray_PostComments

      public Object[] toArray_PostComments()
      Description copied from interface: ASTNode
      converts the commentlist into an array of the type Object and returns thar array
      Specified by:
      toArray_PostComments in interface ASTNode
      Returns:
      an array of the type Object