|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.cpsolver.ifs.util.Progress
public class Progress
Progress bar.
Single instance class for recording the current state. It also allows recursive storing/restoring of the progress.
Use:
Progress.getInstance().setStatus("Loading input data");
Progress.getInstance().setPhase("Creating variables ...", nrVariables);
for (int i=0;i
//load variable here
Progress.getInstance().incProgress();
}
Progress.getInstance().setPhase("Creating constraints ...", nrConstraints);
for (int i=0;i
//load constraint here
Progress.getInstance().incProgress();
}
Progress.getInstance().setStatus("Solving problem");
...
Nested Class Summary | |
---|---|
static class |
Progress.Message
Log nessage |
Field Summary | |
---|---|
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
|
Method Summary | |
---|---|
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 |
Vector |
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Method Detail |
---|
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 String getStatus()
public void setStatus(String status)
public String getPhase()
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 void message(int level, String message, Throwable t)
public void message(int level, String message)
public void trace(String message)
public void debug(String message)
public void info(String message)
public void warn(String message)
public void error(String message)
public void fatal(String message)
public void trace(String message, Throwable e)
public void debug(String message, Throwable e)
public void info(String message, Throwable e)
public void warn(String message, Throwable e)
public void error(String message, Throwable e)
public void fatal(String message, Throwable e)
public Vector 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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |