public class ProgramExecutionResult extends ArrayList<Message> implements HasDescription, CommonAttributes, Serializable, XMCDARootElement
getStatus() status,messages.addDebug(String), addInfo(String), addWarning(String)
and addError(String), the status code never "goes back". More formally, status codes are ordered like
this: OK < WARNING < ERROR < TERMINATED; its value always goes up, e.g. from OK to ERROR but never fall
back to a smaller value.forceStatus(Status). It is intended to signal that the program has been terminated by an external
mean, when possible (for example after receiving a signal from the operating system, or terminated by the user,
etc.).
xmcda:type:executionResult| Modifier and Type | Class and Description |
|---|---|
static class |
ProgramExecutionResult.Status
This enumerates the statuses that a program execution result
can have. |
| Modifier and Type | Field and Description |
|---|---|
static String |
TAG |
modCount| Constructor and Description |
|---|
ProgramExecutionResult()
Builds a new object with no messages and a status equal to OK.
|
| Modifier and Type | Method and Description |
|---|---|
Message |
addDebug(String text) |
Message |
addError(String text) |
Message |
addInfo(String text) |
protected Message |
addMessage(Message.Level level,
String text)
Adds a message to this object, along with its the degree of seriousness
|
Message |
addWarning(String text) |
void |
forceStatus(ProgramExecutionResult.Status newStatus)
Do not make any checks and force the object's
status to the one supplied.WARNING! Unless you have very good reason, you probably want to use updateStatus(Status). |
Description |
getDescription() |
ProgramExecutionResult.Status |
getStatus()
Return the status of this execution result
|
String |
id() |
boolean |
isError()
Equivalent to
getStatus().equals(Status.ERROR) |
boolean |
isOk()
Equivalent to
getStatus().equals(Status.OK) |
boolean |
isTerminated()
Equivalent to
getStatus().equals(Status.TERMINATED) |
boolean |
isWarning()
Equivalent to
getStatus().equals(Status.WARNING) |
String |
mcdaConcept() |
String |
name() |
ProgramExecutionResult.Status |
refreshStatus()
Examine all messages and set the appropriate status, except when the status is already set to TERMINATED, in
which case it is left unchanged.
|
void |
setDescription(Description description) |
void |
setId(String id) |
void |
setMcdaConcept(String mcdaConcept) |
void |
setName(String name) |
void |
updateStatus(ProgramExecutionResult.Status status)
Updates the status of this execution results.
|
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeequals, hashCodecontainsAll, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitcontainsAll, equals, hashCodeparallelStream, streampublic static final String TAG
public ProgramExecutionResult()
public ProgramExecutionResult.Status getStatus()
public void updateStatus(ProgramExecutionResult.Status status) throws NullPointerException
status - the proposed status. It must not be null.NullPointerException - if status is null.public ProgramExecutionResult.Status refreshStatus()
ProgramExecutionResult.Status.TERMINATED when it already has this value.public void forceStatus(ProgramExecutionResult.Status newStatus) throws NullPointerException
status to the one supplied.updateStatus(Status).newStatus - the new (non null) statusNullPointerException - if status is null.protected Message addMessage(Message.Level level, String text)
level - the degree of seriouness of the supplied messagetext - the message itselfpublic boolean isOk()
getStatus().equals(Status.OK)ProgramExecutionResult.Status.OK, false otherwise.public boolean isWarning()
getStatus().equals(Status.WARNING)ProgramExecutionResult.Status.WARNING, false otherwise.public boolean isError()
getStatus().equals(Status.ERROR)ProgramExecutionResult.Status.ERROR, false otherwise.public boolean isTerminated()
getStatus().equals(Status.TERMINATED)ProgramExecutionResult.Status.TERMINATED, false otherwise.public String id()
id in interface CommonAttributespublic void setId(String id)
setId in interface CommonAttributespublic String name()
name in interface CommonAttributespublic String mcdaConcept()
mcdaConcept in interface CommonAttributespublic void setName(String name)
setName in interface CommonAttributespublic void setMcdaConcept(String mcdaConcept)
setMcdaConcept in interface CommonAttributespublic void setDescription(Description description)
setDescription in interface HasDescriptionpublic Description getDescription()
getDescription in interface HasDescriptionCopyright © 2013–2021 Sébastien Bigaret, Patrick Meyer. All rights reserved.