public class Utilities
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
punctuationsSub |
Constructor and Description |
---|
Utilities() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
cleanBody(java.lang.String text)
Cleaninig of the body of text prior to term extraction.
|
static BiblioItem |
cleanZFNMetadata(BiblioItem item)
Special cleaning for ZFN extracted data in a BiblioItem
|
static java.util.List<OffsetPosition> |
convertStringOffsetToTokenOffset(java.util.List<OffsetPosition> stringPosition,
java.util.List<LayoutToken> tokens) |
static java.lang.String |
dateToString(java.util.Date pDate,
java.lang.String pFormat)
Format a date in string using pFormat.
|
static boolean |
deleteDir(java.io.File dir)
Deletes all files and subdirectories under dir.
|
static boolean |
deleteOldies(java.io.File dir,
int maxLifeInSeconds)
Deletes all files and subdirectories under dir if they are older than a given
amount of seconds.
|
static boolean |
deleteOldies(java.io.File dir,
int maxLifeInSeconds,
boolean root) |
static boolean |
doubleEquals(double d1,
double d2) |
static boolean |
doubleEquals(double d1,
double d2,
double epsilon) |
static java.lang.reflect.Method |
getMethod(java.lang.Object obj,
java.lang.Class[] paramTypes,
java.lang.String methodName)
Get the method given in string in input corresponding to the given
arguments.
|
static java.lang.String |
getOsNameAndArch()
Return the name of directory to use given the os and the architecture.
Possibles returned values should match one of the following: win-32 lin-32 lin-64 mac-64 |
static java.lang.Object |
launchMethod(java.lang.Object obj,
java.lang.Object[] args,
java.lang.Class[] paramTypes,
java.lang.String methodName)
Call a java method using the method name given in string.
|
static java.lang.Object |
launchMethod(java.lang.Object obj,
java.lang.Object[] args,
java.lang.String methodName)
Call a java method using the method name given in string.
|
static java.util.List<OffsetPosition> |
mergePositions(java.util.List<OffsetPosition> positions1,
java.util.List<OffsetPosition> positions2)
Merge the offset positions of two lists, merging overlapping positions
into a spanning one.
|
static boolean |
stringToBoolean(java.lang.String value)
Convert a string to boolean.
|
static java.lang.String |
uploadFile(java.lang.String urlmsg,
java.lang.String path,
java.lang.String name) |
public static boolean deleteDir(java.io.File dir)
public static boolean deleteOldies(java.io.File dir, int maxLifeInSeconds)
public static boolean deleteOldies(java.io.File dir, int maxLifeInSeconds, boolean root)
public static java.lang.String cleanBody(java.lang.String text)
public static java.lang.String uploadFile(java.lang.String urlmsg, java.lang.String path, java.lang.String name)
public static BiblioItem cleanZFNMetadata(BiblioItem item)
public static java.lang.String getOsNameAndArch()
public static boolean stringToBoolean(java.lang.String value)
value
- the value to convertpublic static java.lang.Object launchMethod(java.lang.Object obj, java.lang.Object[] args, java.lang.String methodName) throws java.lang.Exception
obj
- Class in which the method is.args
- the arguments of the method.methodName
- the name of the method.java.lang.Exception
public static java.lang.Object launchMethod(java.lang.Object obj, java.lang.Object[] args, java.lang.Class[] paramTypes, java.lang.String methodName) throws java.lang.Exception
obj
- Class in which the method is.args
- the arguments of the method.paramTypes
- types of the arguments.methodName
- the name of the method.java.lang.Exception
public static java.lang.reflect.Method getMethod(java.lang.Object obj, java.lang.Class[] paramTypes, java.lang.String methodName) throws java.lang.NoSuchMethodException
obj
- Class in which the method is.paramTypes
- types of the arguments.methodName
- the name of the method.java.lang.NoSuchMethodException
public static java.lang.String dateToString(java.util.Date pDate, java.lang.String pFormat)
pDate
- the date to parse.pFormat
- the format to use following SimpleDateFormat patterns.public static boolean doubleEquals(double d1, double d2)
public static boolean doubleEquals(double d1, double d2, double epsilon)
public static java.util.List<OffsetPosition> mergePositions(java.util.List<OffsetPosition> positions1, java.util.List<OffsetPosition> positions2)
positions1
- the first offset position list to be mergedpositions2
- the second offset position list to be mergedpublic static java.util.List<OffsetPosition> convertStringOffsetToTokenOffset(java.util.List<OffsetPosition> stringPosition, java.util.List<LayoutToken> tokens)