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)
           
protected  void append(java.lang.String string)
           
 void appendElement(Element element)
           
 void appendMultiplicity(int lower, int 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

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

reservedNameList

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

restrictedNameList

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,
                              PrettyPrinter.Factory factory)

createNamePrinter

public static PrettyPrinter createNamePrinter(Element element,
                                              PrettyPrintOptions options)

createPrinter

public static PrettyPrinter createPrinter(Element element,
                                          PrettyPrintOptions options)

createOptions

public static PrettyPrintOptions.Global createOptions(Namespace scope)

print

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

print

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

print

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

printName

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

printName

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

printName

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

printType

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

printType

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

printType

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

append

public void append(java.lang.Number number)

append

protected void append(java.lang.String string)

appendElement

public void appendElement(Element element)

appendMultiplicity

public void appendMultiplicity(int lower,
                               int 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(Element element)

appendTemplateBindings

public void appendTemplateBindings(TemplateableElement typeRef)

appendTemplateParameters

public void appendTemplateParameters(TemplateableElement templateableElement)

appendTypedMultiplicity

public void appendTypedMultiplicity(TypedMultiplicityElement object)

getCurrentPrecedence

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(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(java.lang.String prefix,
                   java.lang.String text,
                   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(NamedElement object,
                                java.util.Set<java.lang.String> keywords)

getName

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

next

public void next(java.lang.String prefix,
                 java.lang.String text,
                 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(org.eclipse.ocl.examples.pivot.prettyprint.PrettyPrinter.Mode oldMode)

popScope

public void popScope(Namespace oldScope)

precedenceVisit

public void precedenceVisit(OCLExpression expression,
                            Precedence newPrecedence)

pushMode

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

pushScope

public Namespace pushScope(Namespace newScope)

showNames

public boolean showNames()

toString

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

toString

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