org.eclipse.xtext.util.formallang
Class ProductionFormatter<ELEMENT,TOKEN>

java.lang.Object
  extended by org.eclipse.xtext.util.formallang.ProductionFormatter<ELEMENT,TOKEN>
All Implemented Interfaces:
com.google.common.base.Function<Production<ELEMENT,TOKEN>,java.lang.String>

public class ProductionFormatter<ELEMENT,TOKEN>
extends java.lang.Object
implements com.google.common.base.Function<Production<ELEMENT,TOKEN>,java.lang.String>

Author:
Moritz Eysholdt - Initial contribution and API

Nested Class Summary
protected static class ProductionFormatter.ObjToStrFunction<TOKEN>
           
 
Field Summary
protected  int autoWrapChars
           
protected  java.lang.String indent
           
protected  com.google.common.base.Function<TOKEN,java.lang.String> tokenToString
           
 
Constructor Summary
ProductionFormatter()
           
 
Method Summary
 java.lang.String apply(Production<ELEMENT,TOKEN> from)
           
 java.lang.String format(Production<ELEMENT,TOKEN> adapter)
           
 java.lang.String format(Production<ELEMENT,TOKEN> adapter, ELEMENT grammarElement)
           
 java.lang.String format(Production<ELEMENT,TOKEN> adapter, ELEMENT grammarElement, boolean needParenthesis)
           
protected  java.lang.String format(Production<ELEMENT,TOKEN> adapter, ELEMENT element, java.lang.Iterable<ELEMENT> children, java.lang.String separator, boolean needWrap, boolean needParenthesis, int maxChildren)
           
protected  java.lang.String getCardinality(Production<ELEMENT,TOKEN> adapter, ELEMENT ele)
           
 ProductionFormatter<ELEMENT,TOKEN> setAutoWrapChars(int autoWrapChars)
           
 ProductionFormatter<ELEMENT,TOKEN> setIndent(java.lang.String indent)
           
 ProductionFormatter<ELEMENT,TOKEN> setTokenToString(com.google.common.base.Function<TOKEN,java.lang.String> tokenToString)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.google.common.base.Function
equals
 

Field Detail

autoWrapChars

protected int autoWrapChars

indent

protected java.lang.String indent

tokenToString

protected com.google.common.base.Function<TOKEN,java.lang.String> tokenToString
Constructor Detail

ProductionFormatter

public ProductionFormatter()
Method Detail

apply

public java.lang.String apply(Production<ELEMENT,TOKEN> from)
Specified by:
apply in interface com.google.common.base.Function<Production<ELEMENT,TOKEN>,java.lang.String>

format

public java.lang.String format(Production<ELEMENT,TOKEN> adapter)

format

public java.lang.String format(Production<ELEMENT,TOKEN> adapter,
                               ELEMENT grammarElement)

format

public java.lang.String format(Production<ELEMENT,TOKEN> adapter,
                               ELEMENT grammarElement,
                               boolean needParenthesis)

format

protected java.lang.String format(Production<ELEMENT,TOKEN> adapter,
                                  ELEMENT element,
                                  java.lang.Iterable<ELEMENT> children,
                                  java.lang.String separator,
                                  boolean needWrap,
                                  boolean needParenthesis,
                                  int maxChildren)

getCardinality

protected java.lang.String getCardinality(Production<ELEMENT,TOKEN> adapter,
                                          ELEMENT ele)

setAutoWrapChars

public ProductionFormatter<ELEMENT,TOKEN> setAutoWrapChars(int autoWrapChars)

setIndent

public ProductionFormatter<ELEMENT,TOKEN> setIndent(java.lang.String indent)

setTokenToString

public ProductionFormatter<ELEMENT,TOKEN> setTokenToString(com.google.common.base.Function<TOKEN,java.lang.String> tokenToString)