Class GraphDotTokenWriter

java.lang.Object
de.xima.fc.common.graphdot.GraphDotTokenWriter
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
GraphDotProductionWriter

public class GraphDotTokenWriter extends Object implements AutoCloseable
Writer for creating content conforming to the graphviz dot language syntax specification, see DOT Language.

This writer offers low-level methods for writing tokens as defined by the graph dot language.

See GraphDotProductionWriter, for writing individual grammar productions.

See GraphDotModelWriter, for writing POJO models directly.

Since:
8.2.0
Author:
XIMA MEDIA GmbH
See Also:
  • Field Details

    • writer

      protected final Writer writer
  • Method Details

    • close

      public final void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException
    • decreaseIndent

      public final void decreaseIndent()
      Decreases the indent by one.
    • increaseIndent

      public final void increaseIndent()
      Increases the indent by one.
    • writerTokenComma

      public final void writerTokenComma() throws IOException
      Writes a comma token.
      Throws:
      IOException - When content could not be written to the writer.
    • writeTokenAttributeStatementType

      public final void writeTokenAttributeStatementType(EAttributeStatementType attributeStatementType) throws IOException
      Writes the token for the given attribute statement type.
      Parameters:
      attributeStatementType - Type to write.
      Throws:
      IOException - When content could not be written to the writer.
    • writeTokenClosingAngleBracket

      public final void writeTokenClosingAngleBracket() throws IOException
      Writes a closing angle bracket token.
      Throws:
      IOException - When content could not be written to the writer.
    • writeTokenClosingBrace

      public final void writeTokenClosingBrace() throws IOException
      Writes a closing brace token.
      Throws:
      IOException - When content could not be written to the writer.
    • writeTokenClosingBracket

      public final void writeTokenClosingBracket() throws IOException
      Writes a closing bracket token.
      Throws:
      IOException - When content could not be written to the writer.
    • writeTokenColon

      public final void writeTokenColon() throws IOException
      Writes a colon token.
      Throws:
      IOException - When content could not be written to the writer.
    • writeTokenCompassPointValue

      public final void writeTokenCompassPointValue(ECompassPointType compassPoint) throws IOException
      Writes a compass point token.
      Parameters:
      compassPoint - Compass point to write.
      Throws:
      IOException - When content could not be written to the writer.
    • writeTokenDoubleQuote

      public final void writeTokenDoubleQuote() throws IOException
      Writes a double quote token.
      Throws:
      IOException - When content could not be written to the writer.
    • writeTokenEdgeOperation

      public final void writeTokenEdgeOperation(EEdgeType edgeOp) throws IOException
      Writes an edge operation token.
      Parameters:
      edgeOp - Edge operation to write.
      Throws:
      IOException - When content could not be written to the writer.
    • writeTokenEqualSign

      public final void writeTokenEqualSign() throws IOException
      Writes am equal sign token.
      Throws:
      IOException - When content could not be written to the writer.
    • writeTokenGraphType

      public final void writeTokenGraphType(EGraphType graphType) throws IOException
      Writes a graph type token.
      Parameters:
      graphType - Graph type to write.
      Throws:
      IOException - When content could not be written to the writer.
    • writeTokenIdHtml

      public final void writeTokenIdHtml(CharSequence html) throws IOException
      Writes an ID with the given HTML content.

      An ID is one of the following:

      • Any string of alphabetic ([a-zA-Z\200-\377]) characters, underscores ('_') or digits([0-9]), not beginning with a digit;
      • a numeral [-]?(.[0-9]⁺ | [0-9]⁺(.[0-9]*)? );
      • any double-quoted string ("...") possibly containing escaped quotes (\");
      • an HTML string (<...>)
      This method uses the fourth form. The given HTML must be a valid HTML string.
      Parameters:
      html - An html string.
      Throws:
      IOException - When content could not be written to the writer.
    • writeTokenIdLiteral

      public final void writeTokenIdLiteral(CharSequence id) throws IOException
      Writes an ID with the given literal content.

      An ID is one of the following:

      • Any string of alphabetic ([a-zA-Z\200-\377]) characters, underscores ('_') or digits([0-9]), not beginning with a digit;
      • a numeral [-]?(.[0-9]⁺ | [0-9]⁺(.[0-9]*)? );
      • any double-quoted string ("...") possibly containing escaped quotes (\");
      • an HTML string (<...>)
      This method uses the first or second form, if possible; or third form otherwise, applying the required escaping.
      Parameters:
      id - A literal ID to write.
      Throws:
      IOException - When content could not be written to the writer.
    • writeTokenIndent

      public final void writeTokenIndent() throws IOException
      Writes one or more indent tokens, depending on the current indent level.
      Throws:
      IOException - When content could not be written to the writer.
      See Also:
    • writeTokenLineBeak

      public final void writeTokenLineBeak() throws IOException
      Writes a line break token.
      Throws:
      IOException - When content could not be written to the writer.
    • writeTokenOpeningAngleBracket

      public final void writeTokenOpeningAngleBracket() throws IOException
      Writes an opening angle bracket token.
      Throws:
      IOException - When content could not be written to the writer.
    • writeTokenOpeningBrace

      public final void writeTokenOpeningBrace() throws IOException
      Writes an opening brace token.
      Throws:
      IOException - When content could not be written to the writer.
    • writeTokenOpeningBracket

      public final void writeTokenOpeningBracket() throws IOException
      Writes an opening bracket token.
      Throws:
      IOException - When content could not be written to the writer.
    • writeTokenSemiColon

      public final void writeTokenSemiColon() throws IOException
      Writes a semicolon token.
      Throws:
      IOException - When content could not be written to the writer.
    • writeTokenSpace

      public final void writeTokenSpace() throws IOException
      Writes a white space token.
      Throws:
      IOException - When content could not be written to the writer.
    • writeTokenStrict

      public final void writeTokenStrict() throws IOException
      Writes the strict token.
      Throws:
      IOException - When content could not be written to the writer.
    • writeTokenSubGraph

      public final void writeTokenSubGraph() throws IOException
      Writes the subgraph token.
      Throws:
      IOException - When content could not be written to the writer.
    • forWriter

      public static GraphDotTokenWriter forWriter(Writer writer)
      Creates a new dot graph token writer. The content is written to the given writer.
      Parameters:
      writer - Writer to which to write the output.
      Returns:
      A new graph dot token writer.
    • forWriter

      public static GraphDotTokenWriter forWriter(Writer writer, CharSequence indentChar)
      Creates a new dot graph token writer. The content is written to the given writer.
      Parameters:
      writer - Writer to which to write the output.
      indentChar - Char sequence to use for indenting.
      Returns:
      A new graph dot token writer.