org.eclipse.ocl.examples.pivot.prettyprint
Class PrettyPrinter

java.lang.Object
  extended by org.eclipse.ocl.examples.pivot.prettyprint.PrettyPrinter

public class PrettyPrinter
extends java.lang.Object

The PrettyPrinter supports pretty printing. PrettyPrintOptions may be used to configure the printing.


Nested Class Summary
static interface PrettyPrinter.Factory
           
 
Field Summary
protected  org.eclipse.ocl.examples.pivot.prettyprint.PrettyPrinter.Fragment fragment
           
static java.lang.String NULL_PLACEHOLDER
           
static java.util.List<java.lang.String> reservedNameList
           
static java.util.List<java.lang.String> restrictedNameList
           
 
Method Summary
static void addFactory(org.eclipse.emf.ecore.EPackage ePackage, PrettyPrinter.Factory factory)
           
 void append(java.lang.Number number)
           
 void append(java.lang.String string)
           
 void appendElement(Element element)
           
 void appendMultiplicity(java.lang.Number lower, java.lang.Number upper)
           
 void appendName(NamedElement object)
           
 void appendName(NamedElement object, java.util.Set<java.lang.String> keywords)
           
 void appendParameters(Operation operation, boolean withNames)
           
 void appendParent(org.eclipse.emf.ecore.EObject scope, Element element, java.lang.String parentSeparator)
           
 void appendQualifiedType(Element element)
           
 void appendTemplateBindings(TemplateableElement typeRef)
           
 void appendTemplateParameters(TemplateableElement templateableElement)
           
 void appendTypedMultiplicity(TypedMultiplicityElement object)
           
static PrettyPrinter createNamePrinter(Element element, PrettyPrintOptions options)
           
static PrettyPrintOptions.Global createOptions(Namespace scope)
           
static PrettyPrinter createPrinter(Element element, PrettyPrintOptions options)
           
 void exdent(java.lang.String prefix, java.lang.String text, java.lang.String suffix)
          Flush the current indented region.
 Precedence getCurrentPrecedence()
           
 java.lang.String getName(NamedElement object, java.util.Set<java.lang.String> keywords)
           
 java.lang.String getName(java.lang.String name, java.util.Set<java.lang.String> keywords)
           
 java.util.Set<java.lang.String> getReservedNames()
           
 java.util.Set<java.lang.String> getRestrictedNames()
           
 Namespace getScope()
           
 void next(java.lang.String prefix, java.lang.String text, java.lang.String suffix)
          Flush the current indented region.
 void pop()
          Flush the current indented region.
 void popMode(org.eclipse.ocl.examples.pivot.prettyprint.PrettyPrinter.Mode oldMode)
           
 void popScope(Namespace oldScope)
           
 void precedenceVisit(OCLExpression expression, Precedence newPrecedence)
           
static java.lang.String print(Element element)
           
static java.lang.String print(Element element, Namespace namespace)
           
static java.lang.String print(Element element, PrettyPrintOptions options)
           
static java.lang.String printName(Element element)
           
static java.lang.String printName(Element element, Namespace namespace)
           
static java.lang.String printName(Element element, PrettyPrintOptions options)
           
static java.lang.String printType(Element element)
           
static java.lang.String printType(Element element, Namespace namespace)
           
static java.lang.String printType(Element element, PrettyPrintOptions options)
           
 void push(java.lang.String text, java.lang.String suffix)
          Emit text to the current indented region.
 org.eclipse.ocl.examples.pivot.prettyprint.PrettyPrinter.Mode pushMode(org.eclipse.ocl.examples.pivot.prettyprint.PrettyPrinter.Mode newMode)
           
 Namespace pushScope(Namespace newScope)
           
 boolean showNames()
           
 java.lang.String toString()
           
 java.lang.String toString(java.lang.String indent, int lineLength)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL_PLACEHOLDER

@NonNull
public static final java.lang.String NULL_PLACEHOLDER
See Also:
Constant Field Values

reservedNameList

@NonNull
public static java.util.List<java.lang.String> reservedNameList

restrictedNameList

@NonNull
public static java.util.List<java.lang.String> restrictedNameList

fragment

protected org.eclipse.ocl.examples.pivot.prettyprint.PrettyPrinter.Fragment fragment
Method Detail

addFactory

public static void addFactory(org.eclipse.emf.ecore.EPackage ePackage,
                              @NonNull
                              PrettyPrinter.Factory factory)

createNamePrinter

@NonNull
public static PrettyPrinter createNamePrinter(@NonNull
                                                      Element element,
                                                      @NonNull
                                                      PrettyPrintOptions options)

createPrinter

@NonNull
public static PrettyPrinter createPrinter(@NonNull
                                                  Element element,
                                                  @NonNull
                                                  PrettyPrintOptions options)

createOptions

@NonNull
public static PrettyPrintOptions.Global createOptions(@Nullable
                                                              Namespace scope)

print

@NonNull
public static java.lang.String print(@NonNull
                                             Element element)

print

@NonNull
public static java.lang.String print(@NonNull
                                             Element element,
                                             @NonNull
                                             Namespace namespace)

print

@NonNull
public static java.lang.String print(@NonNull
                                             Element element,
                                             @NonNull
                                             PrettyPrintOptions options)

printName

@NonNull
public static java.lang.String printName(@NonNull
                                                 Element element)

printName

@NonNull
public static java.lang.String printName(@NonNull
                                                 Element element,
                                                 @NonNull
                                                 Namespace namespace)

printName

@NonNull
public static java.lang.String printName(@NonNull
                                                 Element element,
                                                 @NonNull
                                                 PrettyPrintOptions options)

printType

@NonNull
public static java.lang.String printType(@NonNull
                                                 Element element)

printType

@NonNull
public static java.lang.String printType(@NonNull
                                                 Element element,
                                                 @NonNull
                                                 Namespace namespace)

printType

@NonNull
public static java.lang.String printType(@NonNull
                                                 Element element,
                                                 @NonNull
                                                 PrettyPrintOptions options)

append

public void append(java.lang.Number number)

append

public void append(java.lang.String string)

appendElement

public void appendElement(@Nullable
                          Element element)

appendMultiplicity

public void appendMultiplicity(@NonNull
                               java.lang.Number lower,
                               @NonNull
                               java.lang.Number upper)

appendName

public void appendName(NamedElement object)

appendName

public void appendName(NamedElement object,
                       java.util.Set<java.lang.String> keywords)

appendParameters

public void appendParameters(Operation operation,
                             boolean withNames)

appendParent

public void appendParent(org.eclipse.emf.ecore.EObject scope,
                         Element element,
                         java.lang.String parentSeparator)

appendQualifiedType

public void appendQualifiedType(@NonNull
                                Element element)

appendTemplateBindings

public void appendTemplateBindings(TemplateableElement typeRef)

appendTemplateParameters

public void appendTemplateParameters(TemplateableElement templateableElement)

appendTypedMultiplicity

public void appendTypedMultiplicity(TypedMultiplicityElement object)

getCurrentPrecedence

@Nullable
public Precedence getCurrentPrecedence()

getReservedNames

public java.util.Set<java.lang.String> getReservedNames()

getRestrictedNames

public java.util.Set<java.lang.String> getRestrictedNames()

getScope

public Namespace getScope()

push

public void push(@NonNull
                 java.lang.String text,
                 java.lang.String suffix)
Emit text to the current indented region. Start a new indented region. If it is not necessary to start a new-line after text, emit suffix instead of the new-line.


exdent

public void exdent(@NonNull
                   java.lang.String prefix,
                   @NonNull
                   java.lang.String text,
                   @NonNull
                   java.lang.String suffix)
Flush the current indented region. Emit text exdented with respect to the current indented region. Start a new indented region. If it is not necessary to start a new-line before text, emit prefix instead of the new-line. If it is not necessary to start a new-line after text, emit suffix instead of the new-line.


getName

public java.lang.String getName(@Nullable
                                NamedElement object,
                                @Nullable
                                java.util.Set<java.lang.String> keywords)

getName

public java.lang.String getName(@Nullable
                                java.lang.String name,
                                @Nullable
                                java.util.Set<java.lang.String> keywords)

next

public void next(@Nullable
                 java.lang.String prefix,
                 @NonNull
                 java.lang.String text,
                 @NonNull
                 java.lang.String suffix)
Flush the current indented region. Emit text indented with respect to the current indented region. Start a new indented region. If it is not necessary to start a new-line before text, emit prefix instead of the new-line. If it is not necessary to start a new-line after text, emit suffix instead of the new-line.


pop

public void pop()
Flush the current indented region. Resume output with one less indentation depth.


popMode

public void popMode(@NonNull
                    org.eclipse.ocl.examples.pivot.prettyprint.PrettyPrinter.Mode oldMode)

popScope

public void popScope(@Nullable
                     Namespace oldScope)

precedenceVisit

public void precedenceVisit(@Nullable
                            OCLExpression expression,
                            @Nullable
                            Precedence newPrecedence)

pushMode

@NonNull
public org.eclipse.ocl.examples.pivot.prettyprint.PrettyPrinter.Mode pushMode(@NonNull
                                                                                      org.eclipse.ocl.examples.pivot.prettyprint.PrettyPrinter.Mode newMode)

pushScope

@Nullable
public Namespace pushScope(@Nullable
                                    Namespace newScope)

showNames

public boolean showNames()

toString

@NonNull
public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

@NonNull
public java.lang.String toString(@NonNull
                                         java.lang.String indent,
                                         int lineLength)