public class Progress extends Object
Progress.getInstance().setStatus("Loading input data");
Progress.getInstance().setPhase("Creating variables ...", nrVariables);
for (int i=0;i<nrVariables;i++) {
//load variable here
Progress.getInstance().incProgress();
}
Progress.getInstance().setPhase("Creating constraints ...", nrConstraints);
for (int i=0;i<nrConstraints;i++) {
//load constraint here
Progress.getInstance().incProgress();
}
Progress.getInstance().setStatus("Solving problem");
...
Modifier and Type | Class and Description |
---|---|
static class |
Progress.Message
Log nessage
|
Modifier and Type | Field and Description |
---|---|
static int |
MSGLEVEL_DEBUG |
static int |
MSGLEVEL_ERROR |
static int |
MSGLEVEL_FATAL |
static int |
MSGLEVEL_INFO |
static int |
MSGLEVEL_PROGRESS |
static int |
MSGLEVEL_STAGE |
static int |
MSGLEVEL_TRACE |
static int |
MSGLEVEL_WARN |
static SimpleDateFormat |
sDF |
static boolean |
sTraceEnabled |
Modifier and Type | Method and Description |
---|---|
void |
addProgressListener(ProgressListener listener)
Adds progress listener
|
static void |
changeInstance(Object oldKey,
Object newKey)
Change progress instance for the given key
|
void |
clear()
Clear the log
|
void |
clearProgressListeners()
Remove all progress listeners
|
void |
debug(String message)
Prints a debug message
|
void |
debug(String message,
Throwable e)
Prints a debug message
|
void |
error(String message)
Prints an error message
|
void |
error(String message,
Throwable e)
Prints an error message
|
void |
fatal(String message)
Prints a fatal message
|
void |
fatal(String message,
Throwable e)
Prints a fatal message
|
String |
getHtmlLog(int level,
boolean includeDate)
Returns log in HTML format
|
String |
getHtmlLog(int level,
boolean includeDate,
String fromStage)
Returns log in HTML format (only messages with the given level or higher
are included)
|
static Progress |
getInstance()
Progress default instance
|
static Progress |
getInstance(Object key)
Progress instance
|
List<Progress.Message> |
getLog()
Returns log (list of messages)
|
String |
getLog(int level)
Returns log (list of messages).
|
String |
getPhase()
Current phase
|
long |
getProgress()
Current progress
|
long |
getProgressMax()
Maximum of current progress
|
String |
getStatus()
Current status
|
void |
incProgress()
Increment current progress
|
void |
info(String message)
Prints an info message
|
void |
info(String message,
Throwable e)
Prints an info message
|
void |
load(org.dom4j.Element root,
boolean clear)
Restores the message log from the given XML element
|
void |
message(int level,
String message)
Prints a message
|
void |
message(int level,
String message,
Throwable t)
Prints a message
|
static void |
removeInstance(Object key)
Remove progress instance for the given key
|
void |
removeProgressListener(ProgressListener listener)
Remove progress listener
|
void |
restore()
Resore the progress from the heap memory
|
void |
save()
Save current progress to the heap memory
|
void |
save(org.dom4j.Element root)
Saves the message log into the given XML element
|
void |
setPhase(String phase)
Sets current phase.
|
void |
setPhase(String phase,
long progressMax)
Sets current phase
|
void |
setProgress(long progress)
Update progress bar.
|
void |
setStatus(String status)
Sets current status
|
void |
trace(String message)
Prints a trace message
|
void |
trace(String message,
Throwable e)
Prints a trace message
|
void |
warn(String message)
Prints a warning message
|
void |
warn(String message,
Throwable e)
Prints a warning message
|
public static boolean sTraceEnabled
public static SimpleDateFormat sDF
public static final int MSGLEVEL_TRACE
public static final int MSGLEVEL_DEBUG
public static final int MSGLEVEL_PROGRESS
public static final int MSGLEVEL_INFO
public static final int MSGLEVEL_STAGE
public static final int MSGLEVEL_WARN
public static final int MSGLEVEL_ERROR
public static final int MSGLEVEL_FATAL
public static Progress getInstance()
public static Progress getInstance(Object key)
public static void changeInstance(Object oldKey, Object newKey)
public static void removeInstance(Object key)
public void setPhase(String phase, long progressMax)
phase
- phase nameprogressMax
- maximum of progress barpublic void setPhase(String phase)
phase
- phase namepublic void setProgress(long progress)
progress
- progress between 0 and progressMaxpublic long getProgress()
public long getProgressMax()
public void incProgress()
public void addProgressListener(ProgressListener listener)
public void removeProgressListener(ProgressListener listener)
public void clearProgressListeners()
public void save()
public void restore()
public List<Progress.Message> getLog()
public String getLog(int level)
public String getHtmlLog(int level, boolean includeDate)
public String getHtmlLog(int level, boolean includeDate, String fromStage)
public void clear()
public void save(org.dom4j.Element root)
public void load(org.dom4j.Element root, boolean clear)
Copyright © 2014 UniTime LLC. All Rights Reserved.