Package hydra.ast

Class BlockStyle

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<BlockStyle>

    public class BlockStyle
    extends java.lang.Object
    implements java.io.Serializable, java.lang.Comparable<BlockStyle>
    Formatting option for code blocks
    See Also:
    Serialized Form
    • Field Detail

      • TYPE_

        public static final Name TYPE_
        Name of the hydra.ast.BlockStyle type.
      • INDENT

        public static final Name INDENT
        Name of the hydra.ast.BlockStyle.indent field.
      • NEWLINE_BEFORE_CONTENT

        public static final Name NEWLINE_BEFORE_CONTENT
        Name of the hydra.ast.BlockStyle.newlineBeforeContent field.
      • NEWLINE_AFTER_CONTENT

        public static final Name NEWLINE_AFTER_CONTENT
        Name of the hydra.ast.BlockStyle.newlineAfterContent field.
      • indent

        public final Optional<java.lang.String> indent
        An optional indentation string
      • newlineBeforeContent

        public final java.lang.Boolean newlineBeforeContent
        Whether to place a newline before the content
      • newlineAfterContent

        public final java.lang.Boolean newlineAfterContent
        Whether to place a newline after the content
    • Constructor Detail

      • BlockStyle

        public BlockStyle​(Optional<java.lang.String> indent,
                          java.lang.Boolean newlineBeforeContent,
                          java.lang.Boolean newlineAfterContent)
        Constructs an immutable BlockStyle.
        Parameters:
        indent - An optional indentation string
        newlineBeforeContent - Whether to place a newline before the content
        newlineAfterContent - Whether to place a newline after the content
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • compareTo

        public int compareTo​(BlockStyle other)
        Specified by:
        compareTo in interface java.lang.Comparable<BlockStyle>
      • withNewlineBeforeContent

        public BlockStyle withNewlineBeforeContent​(java.lang.Boolean newlineBeforeContent)
        Returns a copy of this BlockStyle with newlineBeforeContent replaced.
      • withNewlineAfterContent

        public BlockStyle withNewlineAfterContent​(java.lang.Boolean newlineAfterContent)
        Returns a copy of this BlockStyle with newlineAfterContent replaced.