Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## gnu.java
Class JSFormatter

    java.lang.Object
      gnu.java.JSFormatter

    public class JSFormatter

extends java.lang.Object

Field Summary
`JSBeautifier` | `beautifier`

Constructor Summary
`JSFormatter()` Constructor for JSFormatter

Method Summary
`void` | `format(java.io.BufferedReader inReader, java.io.PrintWriter outWriter)` Format source code that is read from inReader, and print the formatted result to outWriter.
`java.lang.String` | `format(java.lang.String line)`
`void` | `formatLine(java.lang.String line)` format a line of source code. formatLine should NOT be called if there are still formatted lines ready to be collected.
`boolean` | `hasMoreFormattedLines()` Check if the formatter has more formatted lines to return.
`void` | `init()` Initialize the formatter so that it is ready for the formation of a new file of source code.
`static void` | `main(java.lang.String[] args)`
`java.lang.String` | `nextFormattedLine()` Get the next formatted line.
`void` | `setBracketBreak(boolean br)`
`void` | `setBracketIndent(boolean state)`
`void` | `setLineLengthDeviation(int dev)`
`void` | `setNestedConnection(boolean nest)`
`void` | `setPreferredLineLength(int length)`
`void` | `setSwitchIndent(boolean state)`
`void` | `summarize()` summarize() is to be called when there are no more lines of unformatted source code to be passed to the formatter.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### beautifier

    public JSBeautifier beautifier

Constructor Detail

### JSFormatter

    public JSFormatter()

  Constructor for JSFormatter

Method Detail

### main

    public static void main(java.lang.String[] args)

### init

    public void init()

  Initialize the formatter so that it is ready for the formation of a new file of source code.

### format

    public void format(java.io.BufferedReader inReader,
                       java.io.PrintWriter outWriter)
                throws java.io.IOException

  Format source code that is read from inReader, and print the formatted result to outWriter.

  Parameters:
    `inReader` - a BufferedReader from which to input original source code
    `outWriter` - a PrintWriter to output beutified source code to
  Throws:
    `java.io.IOException`

### hasMoreFormattedLines

    public boolean hasMoreFormattedLines()

  Check if the formatter has more formatted lines to return. As long as there are more formatted lines to return, the caller should NOT call the method formatLine() with a new line of source code, but rather collect the current available formatted lines with the method nextFormattedLine(), i.e: while (formatter.hasMoreFormattedLines()) System.out.println(formatter.nextFormattedLine()

### formatLine

    public void formatLine(java.lang.String line)

  format a line of source code. formatLine should NOT be called if there are still formatted lines ready to be collected. This can be checked with the method hasMoreFormattedLines()

  Parameters:
    `line` - a line of source code to be formatted.

### nextFormattedLine

    public java.lang.String nextFormattedLine()

  Get the next formatted line. This should be called ONLY after checking with the method hasMoreFormattedLines() that there actualy is a formatted line ready to be collected.

### summarize

    public void summarize()

  summarize() is to be called when there are no more lines of unformatted source code to be passed to the formatter.

### setBracketBreak

    public void setBracketBreak(boolean br)

### setBracketIndent

    public void setBracketIndent(boolean state)

### setSwitchIndent

    public void setSwitchIndent(boolean state)

### setPreferredLineLength

    public void setPreferredLineLength(int length)

### setLineLengthDeviation

    public void setLineLengthDeviation(int dev)

### setNestedConnection

    public void setNestedConnection(boolean nest)

### format

    public java.lang.String format(java.lang.String line)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © Madkit Team (O. Gutknecht, J. Ferber, F. Michel et al.) All Rights Reserved.