Pepper  3.6.0
A highly extensible plattform for conversion and manipulationoflinguisticdata.
org.corpus_tools.pepper.common.PepperUtil Class Referenceabstract

Classes

class  PepperJobReporter
 Prints the status of the passed PepperJob object, until setStop(Boolean#TRUE) was called.
 

Static Public Member Functions

static String getHello ()
 Returns a formatted String, a kind of a welcome screen of Pepper. More...
 
static String getHello (int width, String eMail, String hp)
 Returns a formatted String, a kind of a welcome screen of Pepper. More...
 
static String breakString (String theString)
 Breaks the String theString at position CONSOLE_WIDTH and adds a linebreak. More...
 
static String breakString (String theString, int length)
 Breaks the String theString at position length and adds a linebreak. More...
 
static String breakString (String linePrefix, String theString)
 Breaks the String theString at position CONSOLE_WIDTH and adds a linebreak. More...
 
static String breakString (String linePrefix, String theString, int length)
 Breaks the String theString at position length and adds a linebreak. More...
 
static String breakString2 (StringBuilder output, final String theString, final int length)
 Returns rest.
 
static String createTable (Integer[] length, String[][] map, boolean hasHeader, boolean hasBlanks, boolean drawInnerVerticalLine)
 Returns a table created from the passed Strings. More...
 
static synchronized File getTempTestFile (String segments)
 Returns a temporary folder, where all tests can store temporary files. More...
 
static synchronized File getTempTestFile ()
 Returns a temporary folder, where all tests can store temporary files. More...
 
static synchronized File getTempFile ()
 Returns a temporary folder, where Pepper and all modules can store temp files. More...
 
static synchronized File getTempFile (String segments)
 Returns a temporary folder, where Pepper and all modules can store temp files. More...
 
static synchronized File getTempFile (String segments, String prefix)
 Returns a temporary folder, where Pepper and all modules can store temp files. More...
 
static String reportConfiguration (PepperConfiguration conf)
 Returns a report as String containing the configuration for Pepper. More...
 
static String reportModuleList (final int width, final Collection< PepperModuleDesc > moduleDescs, Map< Integer, PepperModuleDesc > number2module)
 Creates a table containing all passed Pepper modules corresponding to their description and their fingerprint. More...
 
static String reportModuleList (int width, Collection< PepperModuleDesc > moduleDescs)
 Creates a table containing all passed Pepper modules corresponding to their description and their fingerprint. More...
 
static void readXMLResource (DefaultHandler2 contentHandler, URI documentLocation)
 Helper method to read an xml file with a DefaultHandler2 implementation given as contentHandler. More...
 
static CorpusDesc.Builder createCorpusDesc ()
 
static< T > boolean isNullOrEmpty (final Collection< T > collection)
 Checks whether a collection is null or empty. More...
 
static< T > boolean isNotNullOrEmpty (final Collection< T > collection)
 Checks whether a collection is not null nor empty. More...
 

Static Public Attributes

static final String FILE_ENDING_PEPPER = "pepper"
 This is the default ending of a Pepper workflow description file.
 
static final int CONSOLE_WIDTH = 120
 The standard width of the output console of Pepper.
 
static final int CONSOLE_WIDTH_120 = 120
 The width of the output console of Pepper.
 
static final int CONSOLE_WIDTH_80 = 80
 The width of the output console of Pepper, when os is windows.
 

Member Function Documentation

◆ breakString() [1/4]

static String org.corpus_tools.pepper.common.PepperUtil.breakString ( String  linePrefix,
String  theString 
)
static

Breaks the String theString at position CONSOLE_WIDTH and adds a linebreak.

The next line than is prefixed bylinePrefix. The manipulated String is returned.

Parameters
theStringString to be break
lengthposition where to break String
linePrefixa prefix for all lines
Returns
the breaked String

◆ breakString() [2/4]

static String org.corpus_tools.pepper.common.PepperUtil.breakString ( String  linePrefix,
String  theString,
int  length 
)
static

Breaks the String theString at position length and adds a linebreak.

The next line than is prefixed by linePrefix. The manipulated String is returned.

Parameters
theStringString to be break
lengthposition where to break String
linePrefixa prefix for all lines
Returns
the breaked String

◆ breakString() [3/4]

static String org.corpus_tools.pepper.common.PepperUtil.breakString ( String  theString)
static

Breaks the String theString at position CONSOLE_WIDTH and adds a linebreak.

The manipulated String is returned.

Parameters
theStringString to be break
Returns
the breaked String

◆ breakString() [4/4]

static String org.corpus_tools.pepper.common.PepperUtil.breakString ( String  theString,
int  length 
)
static

Breaks the String theString at position length and adds a linebreak.

The manipulated String is returned.

Parameters
theStringString to be break
lengthposition where to break String
Returns
the breaked String

◆ createTable()

static String org.corpus_tools.pepper.common.PepperUtil.createTable ( Integer[]  length,
String  map[][],
boolean  hasHeader,
boolean  hasBlanks,
boolean  drawInnerVerticalLine 
)
static

Returns a table created from the passed Strings.

Parameters
lengthan array of lengths for the columns
mapa map containing the Strings to be printed out sorted as [line, column]
hasHeaderdetermines, if the first line of map contains a header for the table
hasBlanksdetermines if vertical lines has to be followed by a blank e.g. with blanks "| cell1 |" or without blanks "|cell1|"
drawInnerVerticalLinedetermines whether an inner vertical line between two cells has to be drawn e.g. "|cell1 | cell2|" or "|cell1 cell2|"
Returns

◆ getHello() [1/2]

static String org.corpus_tools.pepper.common.PepperUtil.getHello ( )
static

Returns a formatted String, a kind of a welcome screen of Pepper.

Returns
welcome screen

◆ getHello() [2/2]

static String org.corpus_tools.pepper.common.PepperUtil.getHello ( int  width,
String  eMail,
String  hp 
)
static

Returns a formatted String, a kind of a welcome screen of Pepper.

Returns
welcome screen

◆ getTempFile() [1/3]

static synchronized File org.corpus_tools.pepper.common.PepperUtil.getTempFile ( )
static

Returns a temporary folder, where Pepper and all modules can store temp files.

The returned temporary folder is a combination of the systems standard temp folder, the prefix 'pepper' and the users name or a randomized unique sequence of characters, if the user name is not available.

Returns
path, where to store temporary files

◆ getTempFile() [2/3]

static synchronized File org.corpus_tools.pepper.common.PepperUtil.getTempFile ( String  segments)
static

Returns a temporary folder, where Pepper and all modules can store temp files.

The returned temporary folder is a combination of the systems standard temp folder, the prefix 'pepper', and the users name or a randomized unique sequence of characters, if the user name is not available and suffixed by the passed segments.

Returns
path, where to store temporary files
Parameters
segmentssegments or subfolders to be attached to the created temp folder, subfolders are separated by '/'
Returns

◆ getTempFile() [3/3]

static synchronized File org.corpus_tools.pepper.common.PepperUtil.getTempFile ( String  segments,
String  prefix 
)
static

Returns a temporary folder, where Pepper and all modules can store temp files.

The returned temporary folder is a combination of the systems standard temp folder, the prefix 'pepper', and the users name or a randomized unique sequence of characters, if the user name is not available and suffixed by the passed segments.

Returns
path, where to store temporary files
Parameters
segmentssegments or subfolders to be attached to the created temp folder, subfolders are separated by '/'
prefixthe prefix to be used like 'pepper' or pepper-test etc.
Returns

◆ getTempTestFile() [1/2]

static synchronized File org.corpus_tools.pepper.common.PepperUtil.getTempTestFile ( )
static

Returns a temporary folder, where all tests can store temporary files.

The returned temporary folder is a combination of the systems standard temp folder, the prefix 'pepper', and the users name or a randomized unique sequence of characters, if the user name is not available and suffixed by the passed segments.

Returns
path, where to store temporary files

◆ getTempTestFile() [2/2]

static synchronized File org.corpus_tools.pepper.common.PepperUtil.getTempTestFile ( String  segments)
static

Returns a temporary folder, where all tests can store temporary files.

The returned temporary folder is a combination of the systems standard temp folder, the prefix 'pepper', and the users name or a randomized unique sequence of characters, if the user name is not available and suffixed by the passed segments.

Returns
path, where to store temporary files
Parameters
segmentssegments or subfolders to be attached to the created temp folder, subfolders are separated by '/'

◆ isNotNullOrEmpty()

static <T> boolean org.corpus_tools.pepper.common.PepperUtil.isNotNullOrEmpty ( final Collection< T >  collection)
static

Checks whether a collection is not null nor empty.

Parameters
list
Returns

◆ isNullOrEmpty()

static <T> boolean org.corpus_tools.pepper.common.PepperUtil.isNullOrEmpty ( final Collection< T >  collection)
static

Checks whether a collection is null or empty.

Parameters
list
Returns

◆ readXMLResource()

static void org.corpus_tools.pepper.common.PepperUtil.readXMLResource ( DefaultHandler2  contentHandler,
URI  documentLocation 
)
static

Helper method to read an xml file with a DefaultHandler2 implementation given as contentHandler.

It is assumed, that the file encoding is set to UTF-8.

Parameters
contentHandlerDefaultHandler2 implementation
documentLocationlocation of the xml-file

◆ reportConfiguration()

static String org.corpus_tools.pepper.common.PepperUtil.reportConfiguration ( PepperConfiguration  conf)
static

Returns a report as String containing the configuration for Pepper.

Returns

◆ reportModuleList() [1/2]

static String org.corpus_tools.pepper.common.PepperUtil.reportModuleList ( final int  width,
final Collection< PepperModuleDesc moduleDescs,
Map< Integer, PepperModuleDesc number2module 
)
static

Creates a table containing all passed Pepper modules corresponding to their description and their fingerprint.

Parameters
maximalwidth of the returned string
moduleDescsall modules to be listed
number2modulea map containing a module description and a corresponding number for identification
Returns
a table displaying all passed modules and a corresponding description

◆ reportModuleList() [2/2]

static String org.corpus_tools.pepper.common.PepperUtil.reportModuleList ( int  width,
Collection< PepperModuleDesc moduleDescs 
)
static

Creates a table containing all passed Pepper modules corresponding to their description and their fingerprint.

Parameters
maximalwidth of the returned string
moduleDescsall modules to be listed
number2modulea map containing a module description and a corresponding number for identification
Returns
a table displaying all passed modules and a corresponding description