ALox  V. 2402 R. 0
Home ALox for C++ ALox for C# ALox for Java Download
Public Methods | Protected Fields | Protected Methods | List of all members
FormatterJavaStyle Class Reference
Inheritance diagram for FormatterJavaStyle:
[legend]
Collaboration diagram for FormatterJavaStyle:
[legend]

Class Description


Implements a Formatter according to the formatting standards of the Java language.

Note
Inherited, public fields of parent class FormatterStdImpl provide important possibilities for changing the formatting behavior of instances of this class. Therefore, do not forget to consult the parent classes documentation.

In general, the original specification is covered quite well. The differences and specialties are:

Public Methods

 FormatterJavaStyle ()
 
- Public Methods inherited from FormatterStdImpl
 FormatterStdImpl (String formatterClassName)
 
void cloneSettings (FormatterStdImpl reference)
 
- Public Methods inherited from Formatter
void format (AString target, ArrayList< Object > args)
 
void format (AString target, Object[] args)
 
void reset ()
 

Protected Fields

boolean phaAlternateForm
 
boolean phaExtConversionUpper
 
char phaExtDateTime
 
int phaExtDefaultPrecision
 
int phaExtPrecision
 
- Protected Fields inherited from FormatterStdImpl
int argsConsumed
 
AString fieldBuffer = new AString()
 
String formatterName
 
int nextAutoIdx
 
int pargOffset
 
ArrayList< Object > parguments
 
Substring parser = new Substring()
 
Substring pformatString = new Substring()
 
Alignment phaAlignment
 
boolean phaAlignmentSpecified
 
Object phaArgument
 
int phaArgumentIdx
 
int phaCutContent
 
char phaFillChar
 
Substring phaFormatSpec = new Substring()
 
boolean phaIsPercentage
 
NumberFormat phaNF = new NumberFormat()
 
int phaPreviousArgumentIdx
 
boolean phaSignPaddingMode
 
PHType phaType
 
char phaTypeCode
 
int phaWidth
 
boolean phaWriteBinOctHexPrefix
 
AString ptargetString
 
int targetStringStartLength
 
- Protected Fields inherited from Formatter
ArrayList< Object > boxes
 
Substring lamFormatString = new Substring()
 

Protected Methods

boolean checkStdFieldAgainstArgument ()
 
void construct ()
 
int findPlaceholder ()
 
boolean parsePlaceholder ()
 
boolean parseStdFormatSpec ()
 
boolean preAndPostProcess (int startIdx, AString target)
 
void replaceEscapeSequences (int startIdx)
 
void resetPHAs ()
 
- Protected Methods inherited from FormatterStdImpl
void errorFormatString (String msg)
 
int format (AString targetString, Substring formatString, ArrayList< Object > arguments, int argOffset)
 
boolean setArgument (int pos, boolean countStartsWith_1)
 
boolean writeCustomFormat ()
 
void writeStdArgument ()
 
- Protected Methods inherited from Formatter
void initializeFormat ()
 

Additional Inherited Members

- Public Fields inherited from FormatterStdImpl
NumberFormat alternativeNumberFormat = new NumberFormat()
 
SimpleDateFormat dateTimeFormat = new SimpleDateFormat("", Locale.ROOT)
 
NumberFormat defaultNumberFormat = new NumberFormat()
 
boolean writeALibErrorReports = true
 
boolean writeErrorsToTargetString = true
 
- Public Fields inherited from Formatter
Formatter next
 
- Public Static Methods inherited from Formatter
static Formatter acquireDefault ()
 
static void releaseDefault ()
 
- Protected Static Fields inherited from Formatter
static Formatter defaultFormatter = null
 
static ThreadLock defaultFormatterLock = new ThreadLock()
 
- Package Access Fields inherited from FormatterStdImpl
Date tmpDate = new Date()
 
- Package Access Methods inherited from FormatterStdImpl
long getIntegral ()
 
boolean isIntegral ()
 

Constructor & Destructor Documentation

◆ FormatterJavaStyle()


Constructs this formatter. Inherited field defaultNumberFormat is initialized to meet the formatting defaults of Java.

Member Function Documentation

◆ checkStdFieldAgainstArgument()

boolean checkStdFieldAgainstArgument ( )
protected

Makes some attribute adjustments and invokes standard implementation

Returns
true if OK, false if replacement should be aborted.

Reimplemented from FormatterStdImpl.

◆ construct()

void construct ( )
protected

Constructor helper method.

◆ findPlaceholder()

int findPlaceholder ( )
protected

Searches for '%' which is not '%' or 'n'.

Returns
The index found, -1 if not found.

Reimplemented from FormatterStdImpl.

◆ parsePlaceholder()

boolean parsePlaceholder ( )
protected

Parses placeholder field in Java syntax. The portion format_spec is not set as this is not supported by the syntax.

Returns
true on success, false on errors.

Reimplemented from FormatterStdImpl.

◆ parseStdFormatSpec()

boolean parseStdFormatSpec ( )
protected

Does nothing. Java does not support custom format specifications.

Returns
true to indicate success.

Reimplemented from FormatterStdImpl.

◆ preAndPostProcess()

boolean preAndPostProcess ( int  startIdx,
AString  target 
)
protected

All that this formatter does with this overridden method is to convert strings to upper case.

Parameters
startIdxThe int of the start of the field written in ptargetString. -1 indicates pre-phase.
targetThe target string, only if different from field ptargetString, which indicates intermediate phase.
Returns
false, if the placeholder should be skipped (nothing is written for it). true otherwise.

Reimplemented from FormatterStdImpl.

◆ replaceEscapeSequences()

void replaceEscapeSequences ( int  startIdx)
protected

Replaces "%%" with '%' and "%n" with ascii 0x0a. In addition applies AString.escape on target which replaces standard codes like "\\n", "\\r" or "\\t" with corresponding ascii codes. (The latter is an extension to the standard behavior of Java formatter.)

Parameters
startIdxThe start of the region to replace

Reimplemented from FormatterStdImpl.

◆ resetPHAs()

void resetPHAs ( )
protected

Invokes parent implementation and then applies some changes to reflect what is defined as default in the Java string format specification.

Reimplemented from FormatterStdImpl.

Member Data Documentation

◆ phaAlternateForm

boolean phaAlternateForm
protected

Alternate form given ('#').

◆ phaExtConversionUpper

boolean phaExtConversionUpper
protected

Convert to upper case.

◆ phaExtDateTime

char phaExtDateTime
protected

The character after conversion type 't'/'T'.

◆ phaExtDefaultPrecision

int phaExtDefaultPrecision
protected

The default precision if not given. This is set to 6 in resetPHAs, but is changed when specific.

◆ phaExtPrecision

int phaExtPrecision
protected

The value read from the precision field. This is set to -1 in resetPHAs.


The documentation for this class was generated from the following file: