public abstract class PepperUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PepperUtil.PepperJobReporter
Prints the status of the passed
PepperJob object, until
#setStop(Boolean#TRUE) was called. |
Modifier and Type | Field and Description |
---|---|
static int |
CONSOLE_WIDTH
The standard width of the output console of Pepper.
|
static int |
CONSOLE_WIDTH_120
The width of the output console of Pepper.
|
static int |
CONSOLE_WIDTH_80
The width of the output console of Pepper, when os is windows.
|
static String |
FILE_ENDING_PEPPER
This is the default ending of a Pepper workflow description file.
|
Constructor and Description |
---|
PepperUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
breakString(String theString)
Breaks the String
theString at position
CONSOLE_WIDTH and adds a linebreak. |
static String |
breakString(String theString,
int length)
Breaks the String
theString at position length
and adds a linebreak. |
static String |
breakString(String linePrefix,
String theString)
Breaks the String
theString at position
CONSOLE_WIDTH and adds a linebreak. |
static String |
breakString(String linePrefix,
String theString,
int length)
Breaks the String
theString at position length
and adds a linebreak. |
static String |
breakString2(StringBuilder output,
String theString,
int length)
Returns rest
|
static CorpusDesc.Builder |
createCorpusDesc() |
static String |
createTable(Integer[] length,
String[][] map,
boolean hasHeader,
boolean hasBlanks,
boolean drawInnerVerticalLine)
Returns a table created from the passed Strings.
|
static String |
getHello()
Returns a formatted String, a kind of a welcome screen of Pepper.
|
static String |
getHello(int width,
String eMail,
String hp)
Returns a formatted String, a kind of a welcome screen of Pepper.
|
static File |
getTempFile()
Returns a temporary folder, where Pepper and all modules can store temp
files.
|
static File |
getTempFile(String segments)
Returns a temporary folder, where Pepper and all modules can store temp
files.
|
static File |
getTempFile(String segments,
String prefix)
Returns a temporary folder, where Pepper and all modules can store temp
files.
|
static File |
getTempTestFile()
Returns a temporary folder, where all tests can store temporary files.
|
static File |
getTempTestFile(String segments)
Returns a temporary folder, where all tests can store temporary files.
|
static <T> boolean |
isNotNullOrEmpty(Collection<T> collection)
Checks whether a collection is not null nor empty
|
static <T> boolean |
isNullOrEmpty(Collection<T> collection)
Checks whether a collection is null or empty
|
static void |
readXMLResource(DefaultHandler2 contentHandler,
org.eclipse.emf.common.util.URI documentLocation)
Helper method to read an xml file with a
DefaultHandler2
implementation given as contentHandler. |
static String |
reportConfiguration(PepperConfiguration conf)
Returns a report as String containing the configuration for Pepper.
|
static String |
reportModuleList(int width,
Collection<PepperModuleDesc> moduleDescs)
Creates a table containing all passed Pepper modules corresponding to
their description and their fingerprint
|
static String |
reportModuleList(int width,
Collection<PepperModuleDesc> moduleDescs,
Map<Integer,PepperModuleDesc> number2module)
Creates a table containing all passed Pepper modules corresponding to
their description and their fingerprint
|
public static final String FILE_ENDING_PEPPER
public static final int CONSOLE_WIDTH
public static final int CONSOLE_WIDTH_120
public static final int CONSOLE_WIDTH_80
public static String getHello()
public static String getHello(int width, String eMail, String hp)
public static String breakString(String theString)
theString
at position
CONSOLE_WIDTH
and adds a linebreak. The manipulated String is
returned.theString
- String to be breakpublic static String breakString(String theString, int length)
theString
at position length
and adds a linebreak. The manipulated String is returned.theString
- String to be breaklength
- position where to break Stringpublic static String breakString(String linePrefix, String theString)
theString
at position
CONSOLE_WIDTH
and adds a linebreak. The next line than is
prefixed bylinePrefix
. The manipulated String is returned.theString
- String to be breaklength
- position where to break StringlinePrefix
- a prefix for all linespublic static String breakString(String linePrefix, String theString, int length)
theString
at position length
and adds a linebreak. The next line than is prefixed by
linePrefix
. The manipulated String is returned.theString
- String to be breaklength
- position where to break StringlinePrefix
- a prefix for all linespublic static String breakString2(StringBuilder output, String theString, int length)
public static String createTable(Integer[] length, String[][] map, boolean hasHeader, boolean hasBlanks, boolean drawInnerVerticalLine)
length
- an array of lengths for the columnsmap
- a map containing the Strings to be printed out sorted as
[line, column]hasHeader
- determines, if the first line of map contains a header for the
tablehasBlanks
- determines if vertical lines has to be followed by a blank
e.g. with blanks "| cell1 |" or without blanks "|cell1|"drawInnerVerticalLine
- determines whether an inner vertical line between two cells
has to be drawn e.g. "|cell1 | cell2|" or "|cell1 cell2|"public static File getTempTestFile(String segments)
segments
- segments or subfolders to be attached to the created temp
folder, subfolders are separated by '/'public static File getTempTestFile()
public static File getTempFile()
public static File getTempFile(String segments)
segments
- segments or subfolders to be attached to the created temp
folder, subfolders are separated by '/'public static File getTempFile(String segments, String prefix)
segments
- segments or subfolders to be attached to the created temp
folder, subfolders are separated by '/'prefix
- the prefix to be used like 'pepper' or pepper-test etc.public static String reportConfiguration(PepperConfiguration conf)
public static String reportModuleList(int width, Collection<PepperModuleDesc> moduleDescs, Map<Integer,PepperModuleDesc> number2module)
maximal
- width of the returned stringmoduleDescs
- all modules to be listednumber2module
- a map containing a module description and a corresponding
number for identificationpublic static String reportModuleList(int width, Collection<PepperModuleDesc> moduleDescs)
maximal
- width of the returned stringmoduleDescs
- all modules to be listednumber2module
- a map containing a module description and a corresponding
number for identificationpublic static void readXMLResource(DefaultHandler2 contentHandler, org.eclipse.emf.common.util.URI documentLocation)
DefaultHandler2
implementation given as contentHandler. It is assumed, that the
file encoding is set to UTF-8.contentHandler
- DefaultHandler2
implementationdocumentLocation
- location of the xml-filepublic static CorpusDesc.Builder createCorpusDesc()
public static <T> boolean isNullOrEmpty(Collection<T> collection)
list
- public static <T> boolean isNotNullOrEmpty(Collection<T> collection)
list
- Copyright © 2009–2019 Humboldt-Universität zu Berlin, INRIA. All rights reserved.