Class CommentsContainer

    • Constructor Detail

      • CommentsContainer

        public CommentsContainer()
        Create a new meta-data.
    • Method Detail

      • checkNotNegative

        public void checkNotNegative​(int field,
                                     String key)
        Complain if a field is negative.
        Parameters:
        field - field to check
        key - key associated with the field
      • checkNotNaN

        public void checkNotNaN​(double field,
                                String key)
        Complain if a field is NaN.
        Parameters:
        field - field to check
        key - key associated with the field
      • checkNotNull

        public void checkNotNull​(Object field,
                                 String key)
        Complain if a field is null.
        Parameters:
        field - field to check
        key - key associated with the field
      • checkAllowed

        public void checkAllowed​(double version,
                                 Object field,
                                 String key,
                                 double minVersion,
                                 double maxVersion)
        Complain if a key is not allowed.
        Parameters:
        version - format version
        field - field to check
        key - key associated with the field
        minVersion - version at which key started to be allowed
        maxVersion - version at which key started to be forbidden
      • validate

        public void validate​(double version)
        Check is all mandatory entries have been initialized.

        This method should throw an exception if some mandatory entries are missing or not compatible with version number.

        Specified by:
        validate in interface Section
        Parameters:
        version - format version
      • getComments

        public List<String> getComments()
        Get the comments.
        Returns:
        comments
      • setComments

        public void setComments​(List<String> comments)
        Set the comments. This removes all previous comments and replaces them with the new ones.
        Parameters:
        comments - List with new comments
      • acceptComments

        public boolean acceptComments()
        Check if container is still accepting comments.

        A container that still accept comments does not contain any other data.

        Returns:
        true if container is still accepting comments
      • refuseFurtherComments

        public void refuseFurtherComments()
        Set flag to refuse further comments.
      • addComment

        public boolean addComment​(String comment)
        Add comment.

        Comments are accepted only at start. Once other content is stored in the same section, comments are refused.

        Parameters:
        comment - comment line
        Returns:
        true if comment was accepted