org.argouml.uml.generator
Class ParserDisplay

java.lang.Object
  |
  +--org.argouml.uml.generator.Parser
        |
        +--org.argouml.uml.generator.ParserDisplay

public class ParserDisplay
extends Parser


Field Summary
protected static Category _cat
          The standard error etc.
static ParserDisplay SINGLETON
           
 
Method Summary
 java.lang.Object parseAction(java.lang.String s)
           
 void parseAttribute(java.lang.String s, MAttribute attr)
          Parse a line on the form:
visibility name [: type-expression] [= initial-value] If only one of visibility and name is given, then it is assumed to be the name and the visibility is left unchanged.
 void parseAttributeFig(MClassifier cls, MAttribute at, java.lang.String text)
          Parse a string representing one ore more ';' separated attributes.
 void parseClassifierRole(MClassifierRole cls, java.lang.String s)
          Parses a line on the form:
baselist := [base] [, base]*
classifierRole := [name] [/ role] [: baselist]
 void parseComponentInstance(MComponentInstance coi, java.lang.String s)
          Parse a line of the form: "name : base-component"
 MEvent parseEvent(java.lang.String s)
           
 MExtensionPoint parseExtensionPoint(java.lang.String text)
          Parse a string representing an extension point and return a new extension point.
 void parseExtensionPointFig(MUseCase useCase, MExtensionPoint ep, java.lang.String text)
          Parse an extension point.
 MGuard parseGuard(java.lang.String s)
           
 void parseMessage(MMessage mes, java.lang.String s)
          Parses a message line on the form:
intno := integer|name
seq := intno ['.' intno]*
recurrance := '*'['//'] | '*'['//']'['iteration']' | '['condition']'
seqelem := {[intno] ['['recurrance']']}
seq2 := seqelem ['.' seqelem]*
ret_list := lvalue [',' lvalue]*
arg_list := rvalue [',' rvalue]*
message := [seq [',' seq]* '/'] seq2 ':' [ret_list :=] name ([arg_list])
 void parseModelElement(MModelElement me, java.lang.String text)
          Parses a model element, ie reads a string on the format:
[<< stereotype >>] [name]
and assigns the properties to the passed MModelElement.
 MMultiplicity parseMultiplicity(java.lang.String s)
          Parse a string of the form: "range, ...", where range is of the form "lower..upper", or "integer"
 void parseNodeInstance(MNodeInstance noi, java.lang.String s)
          Parse a line of the form: "name : base-node"
 void parseObject(MObject obj, java.lang.String s)
          Parse a line of the form: "name: base-class"
 void parseOperation(java.lang.String s, MOperation op)
          Parse a line of text and aligns the MOperation to the specification given.
 void parseOperationFig(MClassifier cls, MOperation op, java.lang.String text)
          Parse a string representing one ore more ';' separated operations.
protected  java.lang.String parseOutInitValue(MAttribute attr, java.lang.String s)
           
protected  java.lang.String parseOutMultiplicity(MAttribute f, java.lang.String s)
          Parses a string for multiplicity and sets the multiplicity with the given attribute.
 java.lang.String parseOutName(MModelElement me, java.lang.String s)
          Parses the name of modelelement me from some input string s.
 java.lang.String parseOutParams(MOperation op, java.lang.String s)
          Parses the parameters with an operation.
protected  java.lang.String parseOutProperties(MAttribute a, java.lang.String s)
          Parses the properties for some attribute a out of a string s.
protected  java.lang.String parseOutReturnType(MOperation op, java.lang.String s)
          Parses the return type for an operation.
 java.lang.String parseOutType(MAttribute attr, java.lang.String s)
          Parses the user given string s for the type of an attribute.
 java.lang.String parseOutVisibility(MFeature f, java.lang.String s)
          Parses a string for visibilitykind.
 MParameter parseParameter(java.lang.String s)
           
 MState parseState(java.lang.String s)
           
 void parseStateBody(MState st, java.lang.String s)
          parse user input for state bodies and assign the individual lines to according actions or transistions.
 void parseStateDoAction(MState st, java.lang.String s)
           
 void parseStateEntyAction(MState st, java.lang.String s)
           
 void parseStateExitAction(MState st, java.lang.String s)
           
 MStereotype parseStereotype(java.lang.String s)
           
 void parseStimulus(MStimulus sti, java.lang.String s)
          Parse a line of the form: "name: action"
 MTaggedValue parseTaggedValue(java.lang.String s)
           
 MTransition parseTransition(MTransition trans, java.lang.String s)
          Parse a line of the form: "name: trigger [guard] / actions"
 
Methods inherited from class org.argouml.uml.generator.Parser
parseExpression, parseName, parseUninterpreted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SINGLETON

public static ParserDisplay SINGLETON

_cat

protected static final Category _cat
The standard error etc. logger

Method Detail

parseExtensionPointFig

public void parseExtensionPointFig(MUseCase useCase,
                                   MExtensionPoint ep,
                                   java.lang.String text)

Parse an extension point.

The syntax is "name: location", "name:", "location" or "". The fields of the extension point are updated appropriately.

Parameters:
useCase - The use case that owns this extension point
ep - The extension point concerned
text - The text to parse

parseModelElement

public void parseModelElement(MModelElement me,
                              java.lang.String text)
                       throws java.text.ParseException
Parses a model element, ie reads a string on the format:
[<< stereotype >>] [name]
and assigns the properties to the passed MModelElement.

Parameters:
me - The MModelElement text describes.
text - A String on the above format.
Throws:
java.text.ParseException - when it detects an error in the attribute string. See also ParseError.getErrorOffset().

parseOperationFig

public void parseOperationFig(MClassifier cls,
                              MOperation op,
                              java.lang.String text)
                       throws java.text.ParseException
Parse a string representing one ore more ';' separated operations. The case that a String or char contains a ';' (e.g. in an initializer) is handled, but not other occurences of ';'.

Parameters:
text - The classifier the operation(s) belong to
java.text.ParseException

parseAttributeFig

public void parseAttributeFig(MClassifier cls,
                              MAttribute at,
                              java.lang.String text)
                       throws java.text.ParseException
Parse a string representing one ore more ';' separated attributes. The case that a String or char contains a ';' (e.g. in an initializer) is handled, but not other occurences of ';'.

Parameters:
text - The classifier the attribute(s) belong to
java.text.ParseException

parseExtensionPoint

public MExtensionPoint parseExtensionPoint(java.lang.String text)

Parse a string representing an extension point and return a new extension point.

The syntax is "name: location", "name:", "location" or "". Note. If either field is blank, it will be set to null in the extension point.

We break up the string into tokens at the ":". We must keep the ":" as a token, so we can distinguish between "name:" and "location". The number of tokens will distinguish our four cases.

Specified by:
parseExtensionPoint in class Parser
Parameters:
text - The string to parse
Returns:
A new extension point, with fields set appropriately, or null if we are given null or a blank string. Note. The string ":" can be used to set both name and location to null.

parseOperation

public void parseOperation(java.lang.String s,
                           MOperation op)
                    throws java.text.ParseException
Parse a line of text and aligns the MOperation to the specification given. The line should be on the following form:
visibility name (parameter list) : return-type-expression {property-string}

All elements are optional and, if left unspecified, will preserve their old values.
A stereotype can be given between any element in the line on the form: <<stereotype>>

The following properties are recognized to have special meaning: abstract, concurrency, concurrent, guarded, leaf, query, root and sequential.

This syntax is compatible with the UML 1.3 spec.

Specified by:
parseOperation in class Parser
Parameters:
s - The String to parse.
op - The MOperation to adjust to the spcification in s.
Throws:
java.text.ParseException - when it detects an error in the attribute string. See also ParseError.getErrorOffset().

parseOutMultiplicity

protected java.lang.String parseOutMultiplicity(MAttribute f,
                                                java.lang.String s)
Parses a string for multiplicity and sets the multiplicity with the given attribute.

Parameters:
f -
s -
Returns:
String

parseAttribute

public void parseAttribute(java.lang.String s,
                           MAttribute attr)
                    throws java.text.ParseException
Parse a line on the form:
visibility name [: type-expression] [= initial-value]

The following properties are recognized to have special meaning: frozen.

This syntax is compatible with the UML 1.3 spec.

Specified by:
parseAttribute in class Parser
Parameters:
s - The String to parse.
attr - The attribute to modify to comply with the instructions in s.
Throws:
java.text.ParseException - when it detects an error in the attribute string. See also ParseError.getErrorOffset().

parseOutProperties

protected java.lang.String parseOutProperties(MAttribute a,
                                              java.lang.String s)
Parses the properties for some attribute a out of a string s. The properties are all keywords between the braces at the end of a string notation of an attribute.

Parameters:
a -
s -
Returns:
String

parseOutVisibility

public java.lang.String parseOutVisibility(MFeature f,
                                           java.lang.String s)
Parses a string for visibilitykind. Visibilitykind can both be specified using the standard #, +, - and the keywords public, private, protected.

Parameters:
f - The feature the visibility is part of
s - The string that possibly identifies some visibility
Returns:
String The string s WITHOUT the visibility signs.

parseOutParams

public java.lang.String parseOutParams(MOperation op,
                                       java.lang.String s)
Parses the parameters with an operation. The string containing the parameters must be the first string within the given string s. It must start with ( and the end of the string containing the parameters is ).

Parameters:
op -
s -
Returns:
String

parseOutName

public java.lang.String parseOutName(MModelElement me,
                                     java.lang.String s)
Parses the name of modelelement me from some input string s. The name must be the first word of the string.

Parameters:
me -
s -
Returns:
String

parseOutType

public java.lang.String parseOutType(MAttribute attr,
                                     java.lang.String s)
Parses the user given string s for the type of an attribute. The string should start with :. The part between : and { (if there are properties) or the end of the string if there are no properties.

Parameters:
attr -
s -
Returns:
String

parseOutReturnType

protected java.lang.String parseOutReturnType(MOperation op,
                                              java.lang.String s)
Parses the return type for an operation.

Parameters:
op -
s -
Returns:
String

parseOutInitValue

protected java.lang.String parseOutInitValue(MAttribute attr,
                                             java.lang.String s)

parseParameter

public MParameter parseParameter(java.lang.String s)
Specified by:
parseParameter in class Parser

parseStereotype

public MStereotype parseStereotype(java.lang.String s)
Specified by:
parseStereotype in class Parser

parseTaggedValue

public MTaggedValue parseTaggedValue(java.lang.String s)
Specified by:
parseTaggedValue in class Parser

parseMultiplicity

public MMultiplicity parseMultiplicity(java.lang.String s)
Parse a string of the form: "range, ...", where range is of the form "lower..upper", or "integer"

Specified by:
parseMultiplicity in class Parser

parseState

public MState parseState(java.lang.String s)
Specified by:
parseState in class Parser

parseStateBody

public void parseStateBody(MState st,
                           java.lang.String s)
parse user input for state bodies and assign the individual lines to according actions or transistions.


parseStateEntyAction

public void parseStateEntyAction(MState st,
                                 java.lang.String s)

parseStateExitAction

public void parseStateExitAction(MState st,
                                 java.lang.String s)

parseStateDoAction

public void parseStateDoAction(MState st,
                               java.lang.String s)

parseTransition

public MTransition parseTransition(MTransition trans,
                                   java.lang.String s)
Parse a line of the form: "name: trigger [guard] / actions"

Specified by:
parseTransition in class Parser

parseClassifierRole

public void parseClassifierRole(MClassifierRole cls,
                                java.lang.String s)
                         throws java.text.ParseException
Parses a line on the form:
baselist := [base] [, base]*
classifierRole := [name] [/ role] [: baselist]

role and baselist can be given in any order.

This syntax is compatible with the UML 1.3 specification.

Parameters:
cls - The MClassifierRole to apply any changes to.
s - The String to parse.
Throws:
java.text.ParseException - when it detects an error in the attribute string. See also ParseError.getErrorOffset().

parseMessage

public void parseMessage(MMessage mes,
                         java.lang.String s)
                  throws java.text.ParseException
Parses a message line on the form:
intno := integer|name
seq := intno ['.' intno]*
recurrance := '*'['//'] | '*'['//']'['iteration']' | '['condition']'
seqelem := {[intno] ['['recurrance']']}
seq2 := seqelem ['.' seqelem]*
ret_list := lvalue [',' lvalue]*
arg_list := rvalue [',' rvalue]*
message := [seq [',' seq]* '/'] seq2 ':' [ret_list :=] name ([arg_list])

Which is rather complex, so a few examples:
2: display(x, y)
1.3.1: p := find(specs)
[x < 0] 4: invert(color)
A3, B4/ C3.1*: update()

This syntax is compatible with the UML 1.3 specification.

Actually, only a subset of this syntax is currently supported, and some is not even planned to be supported. The exceptions are intno, which allows a number possibly followed by a sequence of letters in the range 'a' - 'z', seqelem, which does not allow a recurrance, and message, which does allow one recurrance near seq2.

Parameters:
mes - The MMessage to apply any changes to.
s - The String to parse.
Throws:
java.text.ParseException - when it detects an error in the attribute string. See also ParseError.getErrorOffset().

parseStimulus

public void parseStimulus(MStimulus sti,
                          java.lang.String s)
Parse a line of the form: "name: action"


parseAction

public java.lang.Object parseAction(java.lang.String s)
Specified by:
parseAction in class Parser

parseGuard

public MGuard parseGuard(java.lang.String s)
Specified by:
parseGuard in class Parser

parseEvent

public MEvent parseEvent(java.lang.String s)
Specified by:
parseEvent in class Parser

parseObject

public void parseObject(MObject obj,
                        java.lang.String s)
Parse a line of the form: "name: base-class"


parseNodeInstance

public void parseNodeInstance(MNodeInstance noi,
                              java.lang.String s)
Parse a line of the form: "name : base-node"


parseComponentInstance

public void parseComponentInstance(MComponentInstance coi,
                                   java.lang.String s)
Parse a line of the form: "name : base-component"



ArgoUML © 1996-2003 (20040229)ArgoUML Project HomeArgoUML Cookbook