Class Layouter
java.lang.Object
de.monticore.generating.templateengine.reporting.commons.Layouter
This class provides Layout functionality for the templates. It is typically
provided under name "layouter" in the templates. Enables it:
op.setValue("layouter", new util.Layouter()); and is set once at the
beginning of the main template.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringunqualified class namestatic StringgetSpaceString(int length) static StringProvides the Name of the Nonterminal of the AST (no qualifier, no "AST" at the beginning)static StringPerforms a left padding (= fills up with spaces on right) If s is too long, it will not be shortened (no data missing)static StringPerforms a right padding (= fills up with spaces) If s is too long, it will not be shortened (no data missing)static StringsourcePos(de.se_rwth.commons.SourcePosition sp) Formats the source position of an ASTnodestatic StringProvides the Name of the Java File (no qualifier, last 2 compartments including file + extension)static StringunqualName(String s) Provides the Name of the Nonterminal of the AST (no qualifier, no "AST" at the beginning)static StringunqualNamePadleft(String s, int l) Provides the name of the Nonterminal of the AST (no qualifier, no "AST" at the beginning)static Stringderives a useful (compact) value for any object with special treatment for String, Integers, Boolean.
-
Constructor Details
-
Layouter
public Layouter()
-
-
Method Details
-
padright
Performs a right padding (= fills up with spaces) If s is too long, it will not be shortened (no data missing)- Parameters:
o- Object to be printed (String, Integer, etc.)l-- Returns:
-
padleft
Performs a left padding (= fills up with spaces on right) If s is too long, it will not be shortened (no data missing)- Parameters:
o- Object to be printed (String, Integer, etc.)l-- Returns:
-
sourcePos
Formats the source position of an ASTnode- Parameters:
sp-
-
nodeName
Provides the Name of the Nonterminal of the AST (no qualifier, no "AST" at the beginning)- Parameters:
ast-- Returns:
- Nonterminalname
-
unqualName
Provides the Name of the Nonterminal of the AST (no qualifier, no "AST" at the beginning)- Parameters:
s-- Returns:
- Nonterminalname
-
unqual2Name
Provides the Name of the Java File (no qualifier, last 2 compartments including file + extension)- Parameters:
s-- Returns:
- Nonterminalname
-
className
unqualified class name- Parameters:
value-- Returns:
- String
-
valueStr
derives a useful (compact) value for any object with special treatment for String, Integers, Boolean. We have a length cut at 78 characters, then we use dots + [length] at endto describe incompleteness- Parameters:
value-- Returns:
- String
-
unqualNamePadleft
Provides the name of the Nonterminal of the AST (no qualifier, no "AST" at the beginning)- Parameters:
s-l-- Returns:
- Nonterminalname
-
getSpaceString
-