|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.argouml.notation.NotationProvider
org.argouml.notation.providers.MessageNotation
org.argouml.notation.providers.uml.AbstractMessageNotationUml
public abstract class AbstractMessageNotationUml
This abstract class provides the common functionality for
the UML notation of messages.
It is extended by MessageNotationUml, with the
notation of messages as seen in collaboration diagrams,
and SDMessageNotationUml, with the notation of
messages as seen in sequence diagrams.
The Message notation syntax is a line of the following form, which we can generate and parse:
intno := integer|name
seq := intno ['.' intno]*
recurrence := '*'['//'] | '*'['//']'[' iteration ']' | '['
condition ']'
seqelem := {[intno] ['['recurrence']']}
seq_expr := seqelem ['.' seqelem]*
ret_list := lvalue [',' lvalue]*
arg_list := rvalue [',' rvalue]*
predecessor := seq [',' seq]* '/'
message := [predecessor] seq_expr ':' [ret_list :=] name ([arg_list])
Which is rather complex, so a few examples:Actually, only a subset of this syntax is currently supported, and some is not even planned to be supported. The exceptions are intno, which only allows a number possibly followed by a sequence of letters in the range 'a' - 'z', seqelem, which does not allow a recurrence, and message, which does allow one recurrence near seq_expr.
(formerly, the supported syntax was: name: action )
Generating a string from the model has some extra functionality: If obtaining the Script of the Action returns an empty string, then an alternative representation is given: If the action is a CallAction, use the name of its Operation, and if it is a SendAction, the name of its Signal. If also this returns no string, then we display the name of the Message.
Rationale: This allows ArgoUML to show something on the diagram with older projects, which only had the name of the Message filled in by the user. This also may improve the diagrams for imported XMI.
Parsing a text that is generated by one of the backup scenarios, causes it to be written back in the script of the Action. Hence, editing the text on the diagram only once causes the Action Script to be used from then on.
Supported operations for the parser:
MessageNotationUml,
SDMessageNotationUml| Nested Class Summary | |
|---|---|
protected static class |
AbstractMessageNotationUml.MsgPtr
An object containing an UML Message object. |
| Constructor Summary | |
|---|---|
AbstractMessageNotationUml(java.lang.Object umlMessage)
|
|
| Method Summary | |
|---|---|
protected void |
buildAction(java.lang.Object umlMessage)
Build a CallAction for the given UML Message if it did not have an Action yet. |
protected int |
countSuccessors(java.lang.Object message)
Count the number of successors of the given Message. |
protected java.lang.String |
fillBlankFunctionName(java.lang.Object umlMessage,
java.lang.String fname,
boolean mayDeleteExpr)
Fill in the function name if it is blank. |
protected java.lang.StringBuilder |
fillBlankVariableName(java.lang.Object umlMessage,
java.lang.StringBuilder varname,
boolean mayDeleteExpr)
Fill in the variable name if it is blank. |
protected java.lang.String |
generateMessageNumber(java.lang.Object umlMessage,
java.lang.Object umlPredecessor,
int position)
Generate the "intno" of the given Message. |
protected java.lang.String |
generateRecurrence(java.lang.Object expr)
Generates a textual description of an IterationExpression. |
protected java.lang.String |
getInitiatorOfAction(java.lang.Object umlAction)
|
java.lang.String |
getParsingHelp()
|
protected boolean |
handleArguments(java.lang.Object umlMessage,
java.util.List<java.lang.String> args,
boolean refindOperation)
|
protected boolean |
handleFunctionName(java.lang.Object umlMessage,
java.lang.String fname,
java.lang.StringBuilder varname,
boolean refindOperation)
Store the given function name and return variable name in the script of the action of the given message. |
protected void |
handleGuard(java.lang.Object umlMessage,
java.lang.StringBuilder guard,
boolean parallell,
boolean iterative)
Store the parsed guard in the UML objects related to the given Message. |
protected void |
handleOperation(java.lang.Object umlMessage,
java.lang.String fname,
boolean refindOperation)
Update the model with the operation name. |
protected void |
handlePredecessors(java.lang.Object umlMessage,
java.util.List<java.util.List> predecessors,
boolean hasPredecessors)
Set the predecessors of the given Message. |
protected boolean |
handleSequenceNumber(java.lang.Object umlMessage,
java.util.List<java.lang.Integer> seqno,
boolean refindOperation)
|
protected java.util.List<CustomSeparator> |
initParameterSeparators()
|
void |
parse(java.lang.Object umlMessage,
java.lang.String text)
Parses the given text, and adapts the modelElement and maybe related elements accordingly. |
protected java.util.List<java.lang.String> |
parseArguments(java.lang.String paramExpr,
boolean mayDeleteExpr)
|
protected void |
parseMessage(java.lang.Object umlMessage,
java.lang.String s)
Parse a Message textual description. |
protected int |
recCountPredecessors(java.lang.Object umlMessage,
AbstractMessageNotationUml.MsgPtr ptr)
Recursively count the number of predecessors of the given Message, and return (a pointer to) the first Message in the chain. |
protected java.lang.String |
toString(java.lang.Object umlMessage,
boolean showSequenceNumbers)
|
| Methods inherited from class org.argouml.notation.providers.MessageNotation |
|---|
initialiseListener |
| Methods inherited from class org.argouml.notation.NotationProvider |
|---|
addElementListener, addElementListener, addElementListener, cleanListener, formatNameList, formatNameList, removeAllElementListeners, removeElementListener, toString, updateListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractMessageNotationUml(java.lang.Object umlMessage)
umlMessage - the UML Message object| Method Detail |
|---|
protected java.lang.String toString(java.lang.Object umlMessage,
boolean showSequenceNumbers)
protected java.lang.String getInitiatorOfAction(java.lang.Object umlAction)
protected java.util.List<CustomSeparator> initParameterSeparators()
public void parse(java.lang.Object umlMessage,
java.lang.String text)
NotationProvider
parse in class NotationProviderumlMessage - the modelelement to adapttext - the string given by the user to be parsed
to adapt the modelpublic java.lang.String getParsingHelp()
getParsingHelp in class NotationProvider
protected java.lang.String generateMessageNumber(java.lang.Object umlMessage,
java.lang.Object umlPredecessor,
int position)
If the predecessor of the given message has only one successor, then we return the string representation of the given integer.
If the predecessor of the given message has more than one successor, then this is a case of parallel execution of messages, e.g. Message 3.1a and Message 3.1b are concurrent within activation 3.1. Hence In this case we use a syntax like: 1a, 1b, 1c. This means that the first successor in the ordered list of successors that has more than one entry will get the postfix a, the second b, etc. TODO: Document exceptional behaviour.
umlMessage - the UML message object to generate
the sequence number forumlPredecessor - the immediate predecessor message (UML object)
that has the given message as successorposition - the integer position of the given message
within its sequence
protected int countSuccessors(java.lang.Object message)
Successors have the same Activator as the given message. This Activator may be null.
message - the UML Message object
protected java.lang.String generateRecurrence(java.lang.Object expr)
expr - the given UML expression object or null
protected void parseMessage(java.lang.Object umlMessage,
java.lang.String s)
throws java.text.ParseException
TODO: - This method is too complex, lets break it up.
umlMessage - the UML Message object to apply any changes tos - the String to parse
java.text.ParseException - when it detects an error in the attribute string. See also
ParseError.getErrorOffset().
protected java.util.List<java.lang.String> parseArguments(java.lang.String paramExpr,
boolean mayDeleteExpr)
paramExpr - mayDeleteExpr -
protected void handlePredecessors(java.lang.Object umlMessage,
java.util.List<java.util.List> predecessors,
boolean hasPredecessors)
throws java.text.ParseException
umlMessage - the given UML Message object to be adaptedpredecessors - the given predecessors as parsedhasPredecessors - true if there are some, if false we do nothing
java.text.ParseException - if something is wrong with the predecessor text
protected void handleOperation(java.lang.Object umlMessage,
java.lang.String fname,
boolean refindOperation)
throws java.text.ParseException
The given operation name is located on the receiver of the given message. If an operation with the given name and a matching number of arguments is located, then the CallAction of the message is adapted accordingly.
umlMessage - the message of which the CallAction is to be adaptedfname - the name of the operation to be usedrefindOperation - true if we have to set the operation
of the CallAction
java.text.ParseException - if the operation syntax can not be parsed
protected boolean handleSequenceNumber(java.lang.Object umlMessage,
java.util.List<java.lang.Integer> seqno,
boolean refindOperation)
throws java.text.ParseException
umlMessage - seqno - refindOperation -
java.text.ParseException
protected boolean handleArguments(java.lang.Object umlMessage,
java.util.List<java.lang.String> args,
boolean refindOperation)
umlMessage - args - refindOperation -
protected boolean handleFunctionName(java.lang.Object umlMessage,
java.lang.String fname,
java.lang.StringBuilder varname,
boolean refindOperation)
Constraint: the given Message shall have an Action.
umlMessage - the given UML Message object to adaptfname - the name of the functionvarname - the return variable namerefindOperation - if false, then we may return true or false.
If true, we return true.
protected java.lang.StringBuilder fillBlankVariableName(java.lang.Object umlMessage,
java.lang.StringBuilder varname,
boolean mayDeleteExpr)
The variable name is the part in front of the assignment operator.
umlMessage - the given message to fill the variable name forvarname - if null, then we get the variable name from the model.mayDeleteExpr - if true, then we may delete the variable,
and hence we return an empty string
protected java.lang.String fillBlankFunctionName(java.lang.Object umlMessage,
java.lang.String fname,
boolean mayDeleteExpr)
The fname is the part of the script after the assignment operator.
umlMessage - the given message to fill the fname forfname - if null, then we get the fname from the model.mayDeleteExpr - if true, then we may delete the function,
and hence we return an empty string
protected void handleGuard(java.lang.Object umlMessage,
java.lang.StringBuilder guard,
boolean parallell,
boolean iterative)
umlMessage - the UML Message objectguard - the guard expression stringparallell - true if parallel execution was indicatediterative - true if this is an iterative expression,
as opposed to a conditionprotected void buildAction(java.lang.Object umlMessage)
umlMessage - the UML Message object to create an Action for
protected int recCountPredecessors(java.lang.Object umlMessage,
AbstractMessageNotationUml.MsgPtr ptr)
umlMessage - the UML Message to count the predecessors forptr - an object to contain the returned first Message
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
| ArgoUML © 1996-2006 | ArgoUML Homepage | ArgoUML Developers' page | ArgoUML Cookbook |