org.eclipse.xtext.xtend2.richstring
Class InitialTemplateIndentationComputer

java.lang.Object
  extended by org.eclipse.xtext.xtend2.xtend2.util.Xtend2Switch<java.lang.String>
      extended by org.eclipse.xtext.xtend2.richstring.InitialTemplateIndentationComputer

public class InitialTemplateIndentationComputer
extends Xtend2Switch<java.lang.String>

Computes the initial indentation of a rich string according to the semantics in the Xtend2 language specification. That is, especially the first and the last line have to be ignored if they only consist whitespace.

Author:
Sebastian Zarnekow - Initial contribution and API

Field Summary
 
Fields inherited from class org.eclipse.xtext.xtend2.xtend2.util.Xtend2Switch
modelPackage
 
Constructor Summary
InitialTemplateIndentationComputer(java.lang.CharSequence initial)
           
 
Method Summary
 java.lang.String caseRichString(RichString object)
          Returns the result of interpreting the object as an instance of 'Rich String'
 java.lang.String caseRichStringLiteral(RichStringLiteral object)
          Returns the result of interpreting the object as an instance of 'Rich String Literal'
protected  java.lang.String getBetterString(java.lang.String current, java.lang.String candidate)
           
 
Methods inherited from class org.eclipse.xtext.xtend2.xtend2.util.Xtend2Switch
caseCreateExtensionInfo, caseJvmIdentifiableElement, caseJvmTypeParameterDeclarator, caseRichStringElseIf, caseRichStringForLoop, caseRichStringIf, caseXBlockExpression, caseXExpression, caseXForLoopExpression, caseXStringLiteral, caseXtendAnnotationTarget, caseXtendClass, caseXtendClassSuperCallReferable, caseXtendField, caseXtendFile, caseXtendFunction, caseXtendImport, caseXtendMember, caseXtendParameter, defaultCase, doSwitch, doSwitch, doSwitch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InitialTemplateIndentationComputer

public InitialTemplateIndentationComputer(java.lang.CharSequence initial)
Parameters:
initial - the assumed indentation if the first line contains text. May not be null.
Method Detail

caseRichString

public java.lang.String caseRichString(RichString object)
Description copied from class: Xtend2Switch
Returns the result of interpreting the object as an instance of 'Rich String'. This implementation returns null; returning a non-null result will terminate the switch.

Overrides:
caseRichString in class Xtend2Switch<java.lang.String>
Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'Rich String'.
See Also:
doSwitch(EObject)

getBetterString

protected java.lang.String getBetterString(java.lang.String current,
                                           java.lang.String candidate)

caseRichStringLiteral

public java.lang.String caseRichStringLiteral(RichStringLiteral object)
Description copied from class: Xtend2Switch
Returns the result of interpreting the object as an instance of 'Rich String Literal'. This implementation returns null; returning a non-null result will terminate the switch.

Overrides:
caseRichStringLiteral in class Xtend2Switch<java.lang.String>
Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'Rich String Literal'.
See Also:
doSwitch(EObject)