|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectp3j.misc.Misc
public final class Misc
Miscellaneous (auxiliary) functions and constants. For simulation-related
constants, see Constants
.
Created on February 12, 2007
Field Summary | |
---|---|
static int |
BASE_NUM
Base of numerical system that is used. |
static String |
CONFIG_FILE
The name of the configuration file. |
static james.core.data.DBConnectionData |
DEFAULT_DB_CONN
Default setup for database connection. |
static String |
DEFAULT_DB_PWD
The default database password. |
static String |
DEFAULT_DB_URL
The default datbase URL. |
static String |
DEFAULT_DB_USER
The default database user name. |
static ExecutionMode |
DEFAULT_EXEC_MODE
The default execution mode. |
static String |
DEFAULT_HIBERNATE_CONFIG_FILE
The default location of the hibernate configuration file. |
static int |
DEFAULT_NUM_PARALLEL_THREADS
The default number of parallel threads. |
static int |
DEFAULT_NUM_TRIALS
The default number of trials. |
static double |
EPSILON
Minimal precision value (used to avoid rounding problems). |
static String |
GUI_LABEL_DESCENDANT_GENERATIONS
The number of descendant generations. |
static String |
GUI_LABEL_DESCRIPTION
The Constant GUI_LABEL_DESCRIPTION. |
static String |
GUI_LABEL_DEVIATION
The Constant GUI_LABEL_DEVIATION. |
static String |
GUI_LABEL_JUMP_OFF_YEAR
The label for the jump-off year in the GUI. |
static String |
GUI_LABEL_NAME
The Constant GUI_LABEL_NAME. |
static String |
GUI_LABEL_NUM_AGE_CLASSES
The number of age classes. |
static String |
GUI_LABEL_PROBABILITY
The Constant GUI_LABEL_PROBABILITY. |
static String |
GUI_LABEL_PROJECTION_HORIZON
The projection horizon. |
static DecimalFormat |
NUMBER_FORMAT
Number format to be used when editing matrices. |
static String |
PREF_DB_PWD
The key for the database password. |
static String |
PREF_DB_URL
The key for the database URL. |
static String |
PREF_DB_USER
The key for the database user name. |
static String |
PREF_EXECUTION_MODE
The key for the execution mode. |
static String |
PREF_NUM_PARALLEL_THREADS
The key for the number of parallel threads. |
static String |
PREF_NUM_TRIALS
The key for the number of trials. |
static String |
TEST_HIBERNATE_CONFIG_FILE
The default location of the hibernate configuration file for testing. |
Method Summary | ||
---|---|---|
static
|
autoCast(Object o)
Auto-casts any kind of object to the desired case. |
|
static boolean |
checkClassEquality(Class<?> class1,
Class<?> class2)
Checks whether two classes are the same. |
|
static String |
getCleanedClassName(Class<?> theClass)
Cleans up class name by removing everything after '_$$_', which is used by Hibernate to identify generated custom classes ('my.Class_$$_javassist...'). |
|
static String |
getFileEnding(File file)
Retrieves file ending. |
|
static
|
invertMap(Map<X,Y> src,
Map<Y,X> dest)
Inverts a map. |
|
static
|
mergeList(List<D>... listsToMerge)
Merges list of lists to a newly created ArrayList . |
|
static boolean |
numEqual(double x,
double y)
Two values are recognised as equal as long as their absolute differece does not exceed EPSILON. |
|
static double |
parseToDouble(Object value)
Parses string to double. |
|
static double |
parseToDoubleProb(String probString)
Converts a string into a probability (a double that has to be in [0,1]). |
|
static int |
parseToInt(String numString)
Parses string to integer. |
|
static double |
round(double value,
int digits)
Rounds a value to a certain number of digits after the comma. |
|
static void |
writeDocumentToFile(String fileName,
Document document)
Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BASE_NUM
public static final DecimalFormat NUMBER_FORMAT
public static final double EPSILON
public static final String CONFIG_FILE
public static final String DEFAULT_DB_URL
public static final String DEFAULT_DB_USER
public static final String DEFAULT_DB_PWD
public static final ExecutionMode DEFAULT_EXEC_MODE
public static final james.core.data.DBConnectionData DEFAULT_DB_CONN
public static final String DEFAULT_HIBERNATE_CONFIG_FILE
public static final String TEST_HIBERNATE_CONFIG_FILE
public static final int DEFAULT_NUM_TRIALS
public static final int DEFAULT_NUM_PARALLEL_THREADS
public static final String PREF_DB_URL
public static final String PREF_DB_USER
public static final String PREF_DB_PWD
public static final String PREF_NUM_TRIALS
public static final String PREF_NUM_PARALLEL_THREADS
public static final String PREF_EXECUTION_MODE
public static final String GUI_LABEL_PROBABILITY
public static final String GUI_LABEL_NAME
public static final String GUI_LABEL_DESCRIPTION
public static final String GUI_LABEL_DEVIATION
public static final String GUI_LABEL_JUMP_OFF_YEAR
public static final String GUI_LABEL_NUM_AGE_CLASSES
public static final String GUI_LABEL_DESCENDANT_GENERATIONS
public static final String GUI_LABEL_PROJECTION_HORIZON
Method Detail |
---|
public static String getFileEnding(File file)
file
- the file name
public static double parseToDouble(Object value)
value
- string to be parsed
public static double parseToDoubleProb(String probString)
probString
- string containing a probability
public static boolean numEqual(double x, double y)
x
- the first valuey
- the second value
public static int parseToInt(String numString)
numString
- the string containing the number
public static double round(double value, int digits)
value
- the valuedigits
- the desired maximum number of digits after the comma
@Deprecated public static void writeDocumentToFile(String fileName, Document document) throws FileNotFoundException, TransformerException
fileName
- the name of the filedocument
- the document to be written
FileNotFoundException
- if destination file could not be found/created
TransformerException
- if transformation of document to XML failedpublic static <X> X autoCast(Object o)
X
- the desired typeo
- the object
public static boolean checkClassEquality(Class<?> class1, Class<?> class2)
class1
- one classclass2
- the other class
public static String getCleanedClassName(Class<?> theClass)
theClass
- the class for which the name should be cleaned up
public static <D> List<D> mergeList(List<D>... listsToMerge)
ArrayList
.
D
- the type of the list elementslistsToMerge
- the lists to merge
public static <X,Y> void invertMap(Map<X,Y> src, Map<Y,X> dest)
X
- the type of the original keysY
- the type of the original valuessrc
- the contentdest
- the destination map to be filled (will be cleared at first)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |