Class ManagementModel
java.lang.Object
net.simplace.client.sim.management.ManagementModel
Editable model of the actions of a DefaultManagement (Redmine #62): a list of actions, each with a rule (when the
action is done) and its management variables (
mgm: id, data type, mode, default, rule). It is read from
and written to the action elements of the simcomponent element; attributes and children
the editor does not know (e.g. unit, min) are kept. check(Predicate) lists the
problems for the editor.- Author:
- Andreas Enders, Claude (Anthropic), co-author
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classan action: rule and management variablesstatic enumlevel of a problemstatic final classa management variable of an actionstatic final classa problem found bycheck(Predicate) -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringchangedRule(String aRule, String aOriginal) Checks all actions.static net.simplace.sim.util.FWSimVariable.DATA_TYPEstatic ManagementModelfrom(org.jdom2.Element aSimComponent) Reads the actions of asimcomponentelement.static booleanstatic voidsetOrRemove(org.jdom2.Element aElement, String aAttribute, String aValue) Sets an attribute or removes it if the value is empty - unless it was already given empty in the original element (e.g.List<org.jdom2.Element>
-
Field Details
-
DATA_TYPES
data types offered for mgm variables (see the DTD) -
MODES
modes offered for mgm variables; empty = ITE (default)
-
-
Constructor Details
-
ManagementModel
public ManagementModel()
-
-
Method Details
-
from
Reads the actions of asimcomponentelement.- Parameters:
aSimComponent- the element, ornullfor an empty model- Returns:
- the model
-
getActions
- Returns:
- the actions (editable, in order of execution)
-
toActionElements
- Returns:
- the
actionelements
-
check
Checks all actions.- Parameters:
aKnownVariable- tells whether a variable name used in a rule is known, ornullto skip this check- Returns:
- the problems, ordered by action
-
changedRule
- Parameters:
aRule- the rule as editedaOriginal- the rule as read, ornullfor a new one- Returns:
- a new or changed rule with its texts in single quotes (see
RuleText.singleQuotes(String)), an unchanged rule as it was
-
dataType
- Parameters:
aName- name of a data type- Returns:
- the data type, or
nullif unknown
-
parsable
public static boolean parsable(String aValue, net.simplace.sim.util.FWSimVariable.DATA_TYPE aDataType) - Parameters:
aValue- a value as textaDataType- the data type- Returns:
trueif the text is a value of the data type
-
setOrRemove
Sets an attribute or removes it if the value is empty - unless it was already given empty in the original element (e.g.default="", an empty text as default, which differs from no default).- Parameters:
aElement- the elementaAttribute- name of the attributeaValue- the value, empty to remove
-