net.sf.jaxme.js
Class IndentationEngineImpl

java.lang.Object
  extended bynet.sf.jaxme.js.IndentationEngineImpl
All Implemented Interfaces:
IndentationEngine
Direct Known Subclasses:
JavaSource, JavaSourceObject, TextFileImpl

public abstract class IndentationEngineImpl
extends java.lang.Object
implements IndentationEngine

Version:
$Id: IndentationEngineImpl.java,v 1.4 2003/08/11 10:26:25 joe Exp $
Author:
Jochen Wiedmann

Field Summary
 
Fields inherited from interface net.sf.jaxme.js.IndentationEngine
NOTHING
 
Constructor Summary
protected IndentationEngineImpl()
           
 
Method Summary
 void addLine()
          Adds an empty line, shortcut for addLine(getIndentationLevel, new Object[0]).
 void addLine(int pLevel, java.lang.Object[] pTokens)
          Adds the given tokens as a complete line, using the given level of indentation.
 void addLine(java.lang.Object pLine)
          Shortcut for addLine(getIndentationLevel(), new Object[]{pLine}).
 void addLine(java.lang.Object[] pTokens)
          Shortcut for addLine(getIndentationLevel(), pTokens).
 void addLine(java.lang.Object pToken1, java.lang.Object pToken2)
          Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2}).
 void addLine(java.lang.Object pToken1, java.lang.Object pToken2, java.lang.Object pToken3)
          Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3}).
 void addLine(java.lang.Object pToken1, java.lang.Object pToken2, java.lang.Object pToken3, java.lang.Object pToken4)
          Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4}).
 void addLine(java.lang.Object pToken1, java.lang.Object pToken2, java.lang.Object pToken3, java.lang.Object pToken4, java.lang.Object pToken5)
          Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5}).
 void addLine(java.lang.Object pToken1, java.lang.Object pToken2, java.lang.Object pToken3, java.lang.Object pToken4, java.lang.Object pToken5, java.lang.Object pToken6)
          Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6}) .
 void addLine(java.lang.Object pToken1, java.lang.Object pToken2, java.lang.Object pToken3, java.lang.Object pToken4, java.lang.Object pToken5, java.lang.Object pToken6, java.lang.Object pToken7)
          Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7}) .
 void addLine(java.lang.Object pToken1, java.lang.Object pToken2, java.lang.Object pToken3, java.lang.Object pToken4, java.lang.Object pToken5, java.lang.Object pToken6, java.lang.Object pToken7, java.lang.Object pToken8)
          Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7, pToken8}) .
 void addLine(java.lang.Object pToken1, java.lang.Object pToken2, java.lang.Object pToken3, java.lang.Object pToken4, java.lang.Object pToken5, java.lang.Object pToken6, java.lang.Object pToken7, java.lang.Object pToken8, java.lang.Object pToken9)
          Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7, pToken8, pToken9}) .
 void addLine(java.lang.Object pToken1, java.lang.Object pToken2, java.lang.Object pToken3, java.lang.Object pToken4, java.lang.Object pToken5, java.lang.Object pToken6, java.lang.Object pToken7, java.lang.Object pToken8, java.lang.Object pToken9, java.lang.Object pToken10)
          Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10}) .
 void addLine(java.lang.Object pToken1, java.lang.Object pToken2, java.lang.Object pToken3, java.lang.Object pToken4, java.lang.Object pToken5, java.lang.Object pToken6, java.lang.Object pToken7, java.lang.Object pToken8, java.lang.Object pToken9, java.lang.Object pToken10, java.lang.Object pToken11)
          Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10, pToken11}) .
 void addLine(java.lang.Object pToken1, java.lang.Object pToken2, java.lang.Object pToken3, java.lang.Object pToken4, java.lang.Object pToken5, java.lang.Object pToken6, java.lang.Object pToken7, java.lang.Object pToken8, java.lang.Object pToken9, java.lang.Object pToken10, java.lang.Object pToken11, java.lang.Object pToken12)
          Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10, pToken11, pToken12}) .
 void addLine(java.lang.Object pToken1, java.lang.Object pToken2, java.lang.Object pToken3, java.lang.Object pToken4, java.lang.Object pToken5, java.lang.Object pToken6, java.lang.Object pToken7, java.lang.Object pToken8, java.lang.Object pToken9, java.lang.Object pToken10, java.lang.Object pToken11, java.lang.Object pToken12, java.lang.Object pToken13)
          Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, pToken13}) .
 void addLine(java.lang.Object pToken1, java.lang.Object pToken2, java.lang.Object pToken3, java.lang.Object pToken4, java.lang.Object pToken5, java.lang.Object pToken6, java.lang.Object pToken7, java.lang.Object pToken8, java.lang.Object pToken9, java.lang.Object pToken10, java.lang.Object pToken11, java.lang.Object pToken12, java.lang.Object pToken13, java.lang.Object pToken14)
          Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, pToken13, pToken14}) .
 void addLine(java.lang.Object pToken1, java.lang.Object pToken2, java.lang.Object pToken3, java.lang.Object pToken4, java.lang.Object pToken5, java.lang.Object pToken6, java.lang.Object pToken7, java.lang.Object pToken8, java.lang.Object pToken9, java.lang.Object pToken10, java.lang.Object pToken11, java.lang.Object pToken12, java.lang.Object pToken13, java.lang.Object pToken14, java.lang.Object pToken15)
          Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, pToken13, pToken15}) .
 java.lang.String asString()
           
protected  void checkNulls(java.lang.Object pTokens)
           
 void clear()
          Clears the IndentationEngine's contents.
 int getLevel()
          Returns the current level of indentation.
protected  java.util.Iterator getLines()
           
 java.lang.String[] getLines(int pLevel)
           
 PlaceHolder getPlaceHolder(java.lang.String pName)
          Searches for the placeholder with the given name.
 void indent()
          Increases the current level of indentation.
 boolean isEmpty()
           
 void moveToBottom()
          Moves the cursor to the bottom of the method.
 void moveToTop()
          Moves the cursor to the top of the method.
 PlaceHolder newPlaceHolder(java.lang.String pName, boolean pAutoRemovable)
          Sets a placeholder with the given name.
protected  void removePlaceHolder(PlaceHolder pPlaceHolder)
           
 void setLevel(int pLevel)
          Sets the current level of indentation.
 void unindent()
          Decreases the current level of indentation.
 void write(IndentationTarget pTarget)
          Adds the IndentationEngine's contents to the given IndentationTarget.
 void write(IndentationTarget pTarget, java.lang.Object pObject)
          Adds the given objects contents to the given IndentationTarget.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndentationEngineImpl

protected IndentationEngineImpl()
Method Detail

isEmpty

public boolean isEmpty()

clear

public void clear()
Description copied from interface: IndentationEngine

Clears the IndentationEngine's contents.

Specified by:
clear in interface IndentationEngine

indent

public void indent()
Description copied from interface: IndentationEngine

Increases the current level of indentation.

Specified by:
indent in interface IndentationEngine

unindent

public void unindent()
Description copied from interface: IndentationEngine

Decreases the current level of indentation.

Specified by:
unindent in interface IndentationEngine

setLevel

public void setLevel(int pLevel)
Description copied from interface: IndentationEngine

Sets the current level of indentation.

Specified by:
setLevel in interface IndentationEngine

getLevel

public int getLevel()
Description copied from interface: IndentationEngine

Returns the current level of indentation.

Specified by:
getLevel in interface IndentationEngine

addLine

public void addLine(int pLevel,
                    java.lang.Object[] pTokens)
Description copied from interface: IndentationEngine

Adds the given tokens as a complete line, using the given level of indentation.

Specified by:
addLine in interface IndentationEngine

moveToTop

public void moveToTop()
Description copied from interface: IndentationEngine

Moves the cursor to the top of the method.

Specified by:
moveToTop in interface IndentationEngine

moveToBottom

public void moveToBottom()
Description copied from interface: IndentationEngine

Moves the cursor to the bottom of the method.

Specified by:
moveToBottom in interface IndentationEngine

newPlaceHolder

public PlaceHolder newPlaceHolder(java.lang.String pName,
                                  boolean pAutoRemovable)
Description copied from interface: IndentationEngine

Sets a placeholder with the given name.

Specified by:
newPlaceHolder in interface IndentationEngine
Parameters:
pName - The placeholders name
pAutoRemovable - Whether the placeholder must be removed by invoking PlaceHolder.remove() (false) or not (true).

getPlaceHolder

public PlaceHolder getPlaceHolder(java.lang.String pName)
Description copied from interface: IndentationEngine

Searches for the placeholder with the given name. The cursor will be set to the line after the placeholder, if it is found. In that case subsequent invocations of IndentationEngine.addLine() will add code to the lines following the placeholder. Otherwise the cursor is unchanged.

Specified by:
getPlaceHolder in interface IndentationEngine
Parameters:
pName - The placeholders name
Returns:
The placeholder or null, if it wasn't found.

removePlaceHolder

protected void removePlaceHolder(PlaceHolder pPlaceHolder)

checkNulls

protected void checkNulls(java.lang.Object pTokens)

addLine

public void addLine(java.lang.Object[] pTokens)
Description copied from interface: IndentationEngine

Shortcut for addLine(getIndentationLevel(), pTokens).

Specified by:
addLine in interface IndentationEngine

addLine

public void addLine()
Description copied from interface: IndentationEngine

Adds an empty line, shortcut for addLine(getIndentationLevel, new Object[0]).

Specified by:
addLine in interface IndentationEngine

addLine

public void addLine(java.lang.Object pLine)
Description copied from interface: IndentationEngine

Shortcut for addLine(getIndentationLevel(), new Object[]{pLine}).

Specified by:
addLine in interface IndentationEngine

addLine

public void addLine(java.lang.Object pToken1,
                    java.lang.Object pToken2)
Description copied from interface: IndentationEngine

Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2}).

Specified by:
addLine in interface IndentationEngine

addLine

public void addLine(java.lang.Object pToken1,
                    java.lang.Object pToken2,
                    java.lang.Object pToken3)
Description copied from interface: IndentationEngine

Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3}).

Specified by:
addLine in interface IndentationEngine

addLine

public void addLine(java.lang.Object pToken1,
                    java.lang.Object pToken2,
                    java.lang.Object pToken3,
                    java.lang.Object pToken4)
Description copied from interface: IndentationEngine

Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4}).

Specified by:
addLine in interface IndentationEngine

addLine

public void addLine(java.lang.Object pToken1,
                    java.lang.Object pToken2,
                    java.lang.Object pToken3,
                    java.lang.Object pToken4,
                    java.lang.Object pToken5)
Description copied from interface: IndentationEngine

Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5}).

Specified by:
addLine in interface IndentationEngine

addLine

public void addLine(java.lang.Object pToken1,
                    java.lang.Object pToken2,
                    java.lang.Object pToken3,
                    java.lang.Object pToken4,
                    java.lang.Object pToken5,
                    java.lang.Object pToken6)
Description copied from interface: IndentationEngine

Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6}) .

Specified by:
addLine in interface IndentationEngine

addLine

public void addLine(java.lang.Object pToken1,
                    java.lang.Object pToken2,
                    java.lang.Object pToken3,
                    java.lang.Object pToken4,
                    java.lang.Object pToken5,
                    java.lang.Object pToken6,
                    java.lang.Object pToken7)
Description copied from interface: IndentationEngine

Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7}) .

Specified by:
addLine in interface IndentationEngine

addLine

public void addLine(java.lang.Object pToken1,
                    java.lang.Object pToken2,
                    java.lang.Object pToken3,
                    java.lang.Object pToken4,
                    java.lang.Object pToken5,
                    java.lang.Object pToken6,
                    java.lang.Object pToken7,
                    java.lang.Object pToken8)
Description copied from interface: IndentationEngine

Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7, pToken8}) .

Specified by:
addLine in interface IndentationEngine

addLine

public void addLine(java.lang.Object pToken1,
                    java.lang.Object pToken2,
                    java.lang.Object pToken3,
                    java.lang.Object pToken4,
                    java.lang.Object pToken5,
                    java.lang.Object pToken6,
                    java.lang.Object pToken7,
                    java.lang.Object pToken8,
                    java.lang.Object pToken9)
Description copied from interface: IndentationEngine

Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7, pToken8, pToken9}) .

Specified by:
addLine in interface IndentationEngine

addLine

public void addLine(java.lang.Object pToken1,
                    java.lang.Object pToken2,
                    java.lang.Object pToken3,
                    java.lang.Object pToken4,
                    java.lang.Object pToken5,
                    java.lang.Object pToken6,
                    java.lang.Object pToken7,
                    java.lang.Object pToken8,
                    java.lang.Object pToken9,
                    java.lang.Object pToken10)
Description copied from interface: IndentationEngine

Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10}) .

Specified by:
addLine in interface IndentationEngine

addLine

public void addLine(java.lang.Object pToken1,
                    java.lang.Object pToken2,
                    java.lang.Object pToken3,
                    java.lang.Object pToken4,
                    java.lang.Object pToken5,
                    java.lang.Object pToken6,
                    java.lang.Object pToken7,
                    java.lang.Object pToken8,
                    java.lang.Object pToken9,
                    java.lang.Object pToken10,
                    java.lang.Object pToken11)
Description copied from interface: IndentationEngine

Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10, pToken11}) .

Specified by:
addLine in interface IndentationEngine

addLine

public void addLine(java.lang.Object pToken1,
                    java.lang.Object pToken2,
                    java.lang.Object pToken3,
                    java.lang.Object pToken4,
                    java.lang.Object pToken5,
                    java.lang.Object pToken6,
                    java.lang.Object pToken7,
                    java.lang.Object pToken8,
                    java.lang.Object pToken9,
                    java.lang.Object pToken10,
                    java.lang.Object pToken11,
                    java.lang.Object pToken12)
Description copied from interface: IndentationEngine

Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10, pToken11, pToken12}) .

Specified by:
addLine in interface IndentationEngine

addLine

public void addLine(java.lang.Object pToken1,
                    java.lang.Object pToken2,
                    java.lang.Object pToken3,
                    java.lang.Object pToken4,
                    java.lang.Object pToken5,
                    java.lang.Object pToken6,
                    java.lang.Object pToken7,
                    java.lang.Object pToken8,
                    java.lang.Object pToken9,
                    java.lang.Object pToken10,
                    java.lang.Object pToken11,
                    java.lang.Object pToken12,
                    java.lang.Object pToken13)
Description copied from interface: IndentationEngine

Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, pToken13}) .

Specified by:
addLine in interface IndentationEngine

addLine

public void addLine(java.lang.Object pToken1,
                    java.lang.Object pToken2,
                    java.lang.Object pToken3,
                    java.lang.Object pToken4,
                    java.lang.Object pToken5,
                    java.lang.Object pToken6,
                    java.lang.Object pToken7,
                    java.lang.Object pToken8,
                    java.lang.Object pToken9,
                    java.lang.Object pToken10,
                    java.lang.Object pToken11,
                    java.lang.Object pToken12,
                    java.lang.Object pToken13,
                    java.lang.Object pToken14)
Description copied from interface: IndentationEngine

Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, pToken13, pToken14}) .

Specified by:
addLine in interface IndentationEngine

addLine

public void addLine(java.lang.Object pToken1,
                    java.lang.Object pToken2,
                    java.lang.Object pToken3,
                    java.lang.Object pToken4,
                    java.lang.Object pToken5,
                    java.lang.Object pToken6,
                    java.lang.Object pToken7,
                    java.lang.Object pToken8,
                    java.lang.Object pToken9,
                    java.lang.Object pToken10,
                    java.lang.Object pToken11,
                    java.lang.Object pToken12,
                    java.lang.Object pToken13,
                    java.lang.Object pToken14,
                    java.lang.Object pToken15)
Description copied from interface: IndentationEngine

Shortcut for addLine(getIndentationLevel(), new Object[]{pToken1, pToken2, pToken3, pToken4, pToken5, pToken6, pToken7, pToken8, pToken9, pToken10, pToken11, pToken12, pToken13, pToken15}) .

Specified by:
addLine in interface IndentationEngine

getLines

public java.lang.String[] getLines(int pLevel)

getLines

protected java.util.Iterator getLines()

write

public void write(IndentationTarget pTarget,
                  java.lang.Object pObject)
           throws java.io.IOException
Description copied from interface: IndentationEngine

Adds the given objects contents to the given IndentationTarget.

Specified by:
write in interface IndentationEngine
Throws:
java.io.IOException

write

public void write(IndentationTarget pTarget)
           throws java.io.IOException
Description copied from interface: IndentationEngine

Adds the IndentationEngine's contents to the given IndentationTarget.

Specified by:
write in interface IndentationEngine
Throws:
java.io.IOException

asString

public java.lang.String asString()