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
private  java.util.Vector _attributeCustomSep
          The vector of CustomSeparators to use when tokenizing attributes
private  PropertySpecialString[] _attributeSpecialStrings
          The array of special properties for attributes
protected static Logger _cat
          The standard error etc.
private  java.util.Vector _operationCustomSep
          The vector of CustomSeparators to use when tokenizing attributes
private  PropertySpecialString[] _operationSpecialStrings
          The array of special properties for operations
private  java.util.Vector _parameterCustomSep
          The vector of CustomSeparators to use when tokenizing parameters
static ParserDisplay SINGLETON
           
private static java.lang.String visibilityChars
          The character with a meaning as a visibility at the start of an attribute
 
Constructor Summary
private ParserDisplay()
          Constructs the object contained in SINGLETON and initializes some instance variables.
 
Method Summary
private  void addTaggedValue(java.lang.Object target, java.lang.String property)
          Create a new tagged value and add it to the target element.
private static java.lang.String beforeAnyOf(java.lang.String base, java.lang.String chars)
           
private  boolean compareMsgNumbers(java.lang.String n1, java.lang.String n2)
          Compares two message numbers with each other to see if they are equal, in the sense that they refer to the same position in a call tree.
private  int countParameters(java.lang.Object bf)
          Counts the number of parameters that are not return values.
private  java.util.Collection filterWithActivator(java.util.Collection c, java.lang.Object a)
          Finds the messages in Collection c that has message a as activator.
private  java.util.Collection findCandidateRoots(java.util.Collection c, java.lang.Object a, java.lang.Object veto)
          Finds the root candidates in a collection c, ie the messages in c that has the activator a (may be null) and has no predecessor with the same activator.
private  java.lang.Object findMsg(java.lang.Object r, java.lang.String n)
          Finds the message in ClassifierRole r that has the message number written in n.
private static int findMsgOrderBreak(java.lang.String s)
          Finds the break between message number and (possibly) message order.
private  java.util.Vector getOperation(java.util.Collection c, java.lang.String name, int params)
          Finds the operations in Collection c with name name and params number of parameters.
private  java.lang.Object getStereotype(java.lang.Object obj, java.lang.String name)
          Finds a stereotype named name either in the subtree of the model rooted at root, or in the the ProfileJava model.
private  java.lang.Object getType(java.lang.String name, java.lang.Object defaultSpace)
          Finds the classifier associated with the type named in name.
private  short getVisibility(java.lang.String name)
          Finds a visibility for the visibility specified by name.
private  boolean hasMsgWithActivator(java.lang.Object r, java.lang.Object m)
          Examines a collection to see if any message has the given message as an activator.
private  int indexOfNextCheckedSemicolon(java.lang.String s, int start)
           
private  void insertSuccessor(java.lang.Object m, java.lang.Object s, int p)
          Inserts message s as the p'th successor of message m.
private  boolean isBadPreMsg(java.lang.Object ans, java.lang.Object chld)
          Examines the call tree from chld to see if ans is an ancestor.
private  boolean isMsgNumberStartOf(java.lang.String n1, java.lang.String n2)
          Compares two message numbers n1, n2 with each other to determine if n1 specifies a the same position as n2 in a call tree or n1 specifies a position that is a father of the position specified by n2.
private  boolean isPredecessorMsg(java.lang.Object pre, java.lang.Object suc, int md)
          Examines the call tree from suc to see if pre is a predecessor.
 java.lang.Object parseAction(java.lang.String s)
          Deprecated. Since 0.15.1, this is essentially a String constructor. It breaks the idea the idea that the parser is editing preexisting objects, which is bad. It is not used within core ArgoUML. d00mst.
 void parseAttribute(java.lang.String s, java.lang.Object 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(java.lang.Object cls, java.lang.Object at, java.lang.String text)
          Parse a string representing one ore more ';' separated attributes.
 void parseClassifierRole(java.lang.Object cls, java.lang.String s)
          Parses a line on the form:
baselist := [base] [, base]*
classifierRole := [name] [/ role] [: baselist]
 void parseComponentInstance(java.lang.Object coi, java.lang.String s)
          Parse a line of the form: "name : base-component"
 java.lang.Object parseEvent(java.lang.String s)
          Deprecated. Since 0.15.1, this is essentially a String constructor. It breaks the idea the idea that the parser is editing preexisting objects, which is bad. It is not used within core ArgoUML. d00mst.
 java.lang.Object parseExtensionPoint(java.lang.String text)
          Parse a string representing an extension point and return a new extension point.
 void parseExtensionPointFig(java.lang.Object useCase, java.lang.Object ep, java.lang.String text)
          Parse an extension point.
 java.lang.Object parseGuard(java.lang.String s)
          Deprecated. Since 0.15.1, this is essentially a String constructor. It breaks the idea the idea that the parser is editing preexisting objects, which is bad. It is not used within core ArgoUML. d00mst.
 void parseMessage(java.lang.Object mes, java.lang.String s)
          TODO - This method is too complex, lets break it up.
 void parseModelElement(java.lang.Object 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.
private static int parseMsgOrder(java.lang.String s)
          Parses a message order specification.
 java.lang.Object parseMultiplicity(java.lang.String s)
          Deprecated. Since 0.15.1, this is essentially a String constructor. It breaks the idea the idea that the parser is editing preexisting objects, which is bad. It is not used within core ArgoUML. d00mst.
 void parseNodeInstance(java.lang.Object noi, java.lang.String s)
          Parse a line of the form: "name : base-node"
 void parseObject(java.lang.Object obj, java.lang.String s)
          Parse a line of the form: "name: base-class"
 void parseOperation(java.lang.String s, java.lang.Object op)
          Parse a line of text and aligns the MOperation to the specification given.
 void parseOperationFig(java.lang.Object cls, java.lang.Object op, java.lang.String text)
          Parse a string representing one ore more ';' separated operations.
private  java.lang.String parseOutAttributeProperties(java.lang.Object a, java.lang.String s)
          Deprecated. Since 0.15.1, was probably part of the old parsing strategy which arguably wasn't a strategy and using it is a bad idea. It is not used within core ArgoUML. d00mst.
protected  java.lang.String parseOutInitValue(java.lang.Object attr, java.lang.String s)
          Deprecated. Since 0.15.1, was probably part of the old parsing strategy which arguably wasn't a strategy and using it is a bad idea. It is not used within core ArgoUML. d00mst.
protected  java.lang.String parseOutMultiplicity(java.lang.Object f, java.lang.String s)
          Deprecated. Since 0.15.1, was probably part of the old parsing strategy which arguably wasn't a strategy and using it is a bad idea. It is not used within core ArgoUML. d00mst.
 java.lang.String parseOutName(java.lang.Object me, java.lang.String s)
          Deprecated. Since 0.15.1, was probably part of the old parsing strategy which arguably wasn't a strategy and using it is a bad idea. It is not used within core ArgoUML. d00mst.
private  java.lang.String parseOutOperationProperties(java.lang.Object op, java.lang.String s)
          Deprecated. Since 0.15.1, was probably part of the old parsing strategy which arguably wasn't a strategy and using it is a bad idea. It is not used within core ArgoUML. d00mst.
 java.lang.String parseOutParams(java.lang.Object op, java.lang.String s)
          Deprecated. Since 0.15.1, was probably part of the old parsing strategy which arguably wasn't a strategy and using it is a bad idea. It is not used within core ArgoUML. d00mst.
protected  java.lang.String parseOutProperties(java.lang.Object handle, java.lang.String s)
          Deprecated. Since 0.15.1, was probably part of the old parsing strategy which arguably wasn't a strategy and using it is a bad idea. It is not used within core ArgoUML. d00mst.
protected  java.lang.String parseOutReturnType(java.lang.Object op, java.lang.String s)
          Deprecated. Since 0.15.1, was probably part of the old parsing strategy which arguably wasn't a strategy and using it is a bad idea. It is not used within core ArgoUML. d00mst.
 java.lang.String parseOutType(java.lang.Object attr, java.lang.String s)
          Deprecated. Since 0.15.1, was probably part of the old parsing strategy which arguably wasn't a strategy and using it is a bad idea. It is not used within core ArgoUML. d00mst.
 java.lang.String parseOutVisibility(java.lang.Object f, java.lang.String s)
          Deprecated. Since 0.15.1, was probably part of the old parsing strategy which arguably wasn't a strategy and using it is a bad idea. It is not used within core ArgoUML. d00mst.
 java.lang.Object parseParameter(java.lang.String s)
          Deprecated. Since 0.15.1, this is essentially a String constructor. It breaks the idea the idea that the parser is editing preexisting objects, which is bad. It is not used within core ArgoUML. d00mst.
private  void parseParamList(java.lang.Object op, java.lang.String param, int paramOffset)
          Parses a parameter list and aligns the parameter list in op to that specified in param.
 java.lang.Object parseState(java.lang.String s)
          Deprecated. Since 0.15.1, this is essentially a String constructor. It breaks the idea the idea that the parser is editing preexisting objects, which is bad. It is not used within core ArgoUML. d00mst.
 void parseStateBody(java.lang.Object st, java.lang.String s)
          parse user input for state bodies and assign the individual lines to according actions or transistions.
 void parseStateDoAction(java.lang.Object st, java.lang.String s)
           
 void parseStateEntyAction(java.lang.Object st, java.lang.String s)
           
 void parseStateExitAction(java.lang.Object st, java.lang.String s)
           
 java.lang.Object parseStereotype(java.lang.String s)
          Deprecated. Since 0.15.1, this is essentially a String constructor. It breaks the idea the idea that the parser is editing preexisting objects, which is bad. It is not used within core ArgoUML. d00mst.
 void parseStimulus(java.lang.Object sti, java.lang.String s)
          Parse a line of the form: "name: action"
 java.lang.Object parseTaggedValue(java.lang.String s)
          Deprecated. Since 0.15.1, this is essentially a String constructor. It breaks the idea the idea that the parser is editing preexisting objects, which is bad. It is not used within core ArgoUML. d00mst.
 java.lang.Object parseTransition(java.lang.Object trans, java.lang.String s)
          Parse a line of the form: "name: trigger [guard] / actions"
private  java.lang.Object recFindStereotype(java.lang.Object obj, java.lang.Object root, java.lang.String name)
          Recursively search a hive of a model for a stereotype with the name given in name.
private  void setParamKind(java.lang.Object p, java.lang.String s)
           
private  void setProperties(java.lang.Object elem, java.util.Vector prop, PropertySpecialString[] spec)
          Applies a Vector of name value pairs of properties to a model element.
private  void setReturnParameter(java.lang.Object op, java.lang.Object type)
          Sets the return parameter of op to be of type type.
private  java.lang.Object successor(java.lang.Object r, int steps)
          Finds the steps'th successor of message r in the sense that it is a direct successor of r.
private  java.lang.Object walk(java.lang.Object r, int steps, boolean strict)
          Finds the steps'th successor of r in the sense that it is a successor of a successor of r (steps times).
private  java.lang.Object walkTree(java.lang.Object root, java.util.Vector path)
          Walks a call tree from a root node following the directions given in path to a destination node.
 
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 Logger _cat
The standard error etc. logger


_attributeSpecialStrings

private PropertySpecialString[] _attributeSpecialStrings
The array of special properties for attributes


_attributeCustomSep

private java.util.Vector _attributeCustomSep
The vector of CustomSeparators to use when tokenizing attributes


_operationSpecialStrings

private PropertySpecialString[] _operationSpecialStrings
The array of special properties for operations


_operationCustomSep

private java.util.Vector _operationCustomSep
The vector of CustomSeparators to use when tokenizing attributes


_parameterCustomSep

private java.util.Vector _parameterCustomSep
The vector of CustomSeparators to use when tokenizing parameters


visibilityChars

private static final java.lang.String visibilityChars
The character with a meaning as a visibility at the start of an attribute

See Also:
Constant Field Values
Constructor Detail

ParserDisplay

private ParserDisplay()
Constructs the object contained in SINGLETON and initializes some instance variables.

See Also:
SINGLETON
Method Detail

parseExtensionPointFig

public void parseExtensionPointFig(java.lang.Object useCase,
                                   java.lang.Object 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(java.lang.Object 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().

indexOfNextCheckedSemicolon

private int indexOfNextCheckedSemicolon(java.lang.String s,
                                        int start)

parseOperationFig

public void parseOperationFig(java.lang.Object cls,
                              java.lang.Object 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:
cls - The classifier the operation(s) belong to
op - The operation on which the editing happened
text - The string to parse
java.text.ParseException

parseAttributeFig

public void parseAttributeFig(java.lang.Object cls,
                              java.lang.Object 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:
cls - The classifier the attribute(s) belong to
at - The attribute on which the editing happened
text - The string to parse
java.text.ParseException

parseExtensionPoint

public java.lang.Object 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,
                           java.lang.Object 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().

parseParamList

private void parseParamList(java.lang.Object op,
                            java.lang.String param,
                            int paramOffset)
                     throws java.text.ParseException
Parses a parameter list and aligns the parameter list in op to that specified in param. A parameter list generally has the following syntax:
param := [inout] [name] [: type] [= initial value]
list := [param] [, param]*

inout is optional and if omitted the old value preserved. If no value has been assigned, then in is assumed.
name, type and initial value are optional and if omitted the old value preserved.
type and initial value can be given in any order.
Unspecified properties is carried over by position, so if a parameter is inserted into the list, then it will inherit properties from the parameter that was there before for unspecified properties.

This syntax is compatible with the UML 1.3 specification.

Parameters:
op - The operation the parameter list belongs to.
param - The parameter list, without enclosing parentheses.
paramOffset - The offset to the beginning of the parameter list. Used for error reports.
Throws:
java.text.ParseException - when it detects an error in the attribute string. See also ParseError.getErrorOffset().

setReturnParameter

private void setReturnParameter(java.lang.Object op,
                                java.lang.Object type)
Sets the return parameter of op to be of type type. If there is none, one is created. If there are many, all but one are removed.


setParamKind

private void setParamKind(java.lang.Object p,
                          java.lang.String s)

parseOutMultiplicity

protected java.lang.String parseOutMultiplicity(java.lang.Object f,
                                                java.lang.String s)
Deprecated. Since 0.15.1, was probably part of the old parsing strategy which arguably wasn't a strategy and using it is a bad idea. It is not used within core ArgoUML. d00mst.

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,
                           java.lang.Object 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().

getType

private java.lang.Object getType(java.lang.String name,
                                 java.lang.Object defaultSpace)
Finds the classifier associated with the type named in name.

Parameters:
name - The name of the type to get.
defaultSpace - The default name-space to place the type in.
Returns:
The classifier associated with the name.

getVisibility

private short getVisibility(java.lang.String name)
Finds a visibility for the visibility specified by name. If no known visibility can be deduced, private visibility is used.

Parameters:
name - The Java name of the visibility.
Returns:
A visibility corresponding to name.

setProperties

private void setProperties(java.lang.Object elem,
                           java.util.Vector prop,
                           PropertySpecialString[] spec)
Applies a Vector of name value pairs of properties to a model element. The name is treated as the tag of a tagged value unless it is one of the PropertySpecialStrings, in which case the action of the PropertySpecialString is invoked.

Parameters:
elem - An model element to apply the properties to.
prop - A Vector with name, value pairs of properties.
spec - An array of PropertySpecialStrings to use.

recFindStereotype

private java.lang.Object recFindStereotype(java.lang.Object obj,
                                           java.lang.Object root,
                                           java.lang.String name)
Recursively search a hive of a model for a stereotype with the name given in name.

Parameters:
obj - The model element to be suitable for.
root - The model element to search from.
name - The name of the stereotype to search for.
Returns:
An stereotype named name, or null if none is found.

getStereotype

private java.lang.Object getStereotype(java.lang.Object obj,
                                       java.lang.String name)
Finds a stereotype named name either in the subtree of the model rooted at root, or in the the ProfileJava model.

TODO: Should create the stereotype under root if it isn't found.

Parameters:
obj - A MModelElements to find a suitable stereotype for.
name - The name of the stereotype to search for.
Returns:
A stereotype named name, or possibly null.

parseOutProperties

protected java.lang.String parseOutProperties(java.lang.Object handle,
                                              java.lang.String s)
Deprecated. Since 0.15.1, was probably part of the old parsing strategy which arguably wasn't a strategy and using it is a bad idea. It is not used within core ArgoUML. d00mst.


parseOutAttributeProperties

private java.lang.String parseOutAttributeProperties(java.lang.Object a,
                                                     java.lang.String s)
Deprecated. Since 0.15.1, was probably part of the old parsing strategy which arguably wasn't a strategy and using it is a bad idea. It is not used within core ArgoUML. d00mst.

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

parseOutOperationProperties

private java.lang.String parseOutOperationProperties(java.lang.Object op,
                                                     java.lang.String s)
Deprecated. Since 0.15.1, was probably part of the old parsing strategy which arguably wasn't a strategy and using it is a bad idea. It is not used within core ArgoUML. d00mst.


addTaggedValue

private void addTaggedValue(java.lang.Object target,
                            java.lang.String property)
Create a new tagged value and add it to the target element.

Parameters:
target - the element on which to place the tagged value
property - the tag value pair in the form "tag=value"

parseOutVisibility

public java.lang.String parseOutVisibility(java.lang.Object f,
                                           java.lang.String s)
Deprecated. Since 0.15.1, was probably part of the old parsing strategy which arguably wasn't a strategy and using it is a bad idea. It is not used within core ArgoUML. d00mst.

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(java.lang.Object op,
                                       java.lang.String s)
Deprecated. Since 0.15.1, was probably part of the old parsing strategy which arguably wasn't a strategy and using it is a bad idea. It is not used within core ArgoUML. d00mst.

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(java.lang.Object me,
                                     java.lang.String s)
Deprecated. Since 0.15.1, was probably part of the old parsing strategy which arguably wasn't a strategy and using it is a bad idea. It is not used within core ArgoUML. d00mst.

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(java.lang.Object attr,
                                     java.lang.String s)
Deprecated. Since 0.15.1, was probably part of the old parsing strategy which arguably wasn't a strategy and using it is a bad idea. It is not used within core ArgoUML. d00mst.

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(java.lang.Object op,
                                              java.lang.String s)
Deprecated. Since 0.15.1, was probably part of the old parsing strategy which arguably wasn't a strategy and using it is a bad idea. It is not used within core ArgoUML. d00mst.

Parses the return type for an operation.

Parameters:
op -
s -
Returns:
String

parseOutInitValue

protected java.lang.String parseOutInitValue(java.lang.Object attr,
                                             java.lang.String s)
Deprecated. Since 0.15.1, was probably part of the old parsing strategy which arguably wasn't a strategy and using it is a bad idea. It is not used within core ArgoUML. d00mst.


parseParameter

public java.lang.Object parseParameter(java.lang.String s)
Deprecated. Since 0.15.1, this is essentially a String constructor. It breaks the idea the idea that the parser is editing preexisting objects, which is bad. It is not used within core ArgoUML. d00mst.

Specified by:
parseParameter in class Parser

parseStereotype

public java.lang.Object parseStereotype(java.lang.String s)
Deprecated. Since 0.15.1, this is essentially a String constructor. It breaks the idea the idea that the parser is editing preexisting objects, which is bad. It is not used within core ArgoUML. d00mst.

Specified by:
parseStereotype in class Parser

parseTaggedValue

public java.lang.Object parseTaggedValue(java.lang.String s)
Deprecated. Since 0.15.1, this is essentially a String constructor. It breaks the idea the idea that the parser is editing preexisting objects, which is bad. It is not used within core ArgoUML. d00mst.

Specified by:
parseTaggedValue in class Parser

parseMultiplicity

public java.lang.Object parseMultiplicity(java.lang.String s)
Deprecated. Since 0.15.1, this is essentially a String constructor. It breaks the idea the idea that the parser is editing preexisting objects, which is bad. It is not used within core ArgoUML. d00mst.

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 java.lang.Object parseState(java.lang.String s)
Deprecated. Since 0.15.1, this is essentially a String constructor. It breaks the idea the idea that the parser is editing preexisting objects, which is bad. It is not used within core ArgoUML. d00mst.

Specified by:
parseState in class Parser

parseStateBody

public void parseStateBody(java.lang.Object 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(java.lang.Object st,
                                 java.lang.String s)

parseStateExitAction

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

parseStateDoAction

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

parseTransition

public java.lang.Object parseTransition(java.lang.Object 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(java.lang.Object 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 classifier role 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(java.lang.Object mes,
                         java.lang.String s)
                  throws java.text.ParseException
TODO - This method is too complex, lets break it up. 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().

isBadPreMsg

private boolean isBadPreMsg(java.lang.Object ans,
                            java.lang.Object chld)
Examines the call tree from chld to see if ans is an ancestor.


isPredecessorMsg

private boolean isPredecessorMsg(java.lang.Object pre,
                                 java.lang.Object suc,
                                 int md)
Examines the call tree from suc to see if pre is a predecessor. This function is recursive and md specifies the maximum level of recursions allowed.


walkTree

private java.lang.Object walkTree(java.lang.Object root,
                                  java.util.Vector path)
Walks a call tree from a root node following the directions given in path to a destination node. If the destination node cannot be reached, then null is returned.

Parameters:
root - The root of the call tree.
path - The path to walk in the call tree.
Returns:
The message at the end of path, or null.

hasMsgWithActivator

private boolean hasMsgWithActivator(java.lang.Object r,
                                    java.lang.Object m)
Examines a collection to see if any message has the given message as an activator.


insertSuccessor

private void insertSuccessor(java.lang.Object m,
                             java.lang.Object s,
                             int p)
Inserts message s as the p'th successor of message m.


successor

private java.lang.Object successor(java.lang.Object r,
                                   int steps)
Finds the steps'th successor of message r in the sense that it is a direct successor of r. Returns null if r has fewer successors.


walk

private java.lang.Object walk(java.lang.Object r,
                              int steps,
                              boolean strict)
Finds the steps'th successor of r in the sense that it is a successor of a successor of r (steps times). The first successor with the same activator as r is used in each step. If there are not enough successors, then struct determines the result. If struct is true, then null is returned, otherwise the last successor found.


findCandidateRoots

private java.util.Collection findCandidateRoots(java.util.Collection c,
                                                java.lang.Object a,
                                                java.lang.Object veto)
Finds the root candidates in a collection c, ie the messages in c that has the activator a (may be null) and has no predecessor with the same activator. If veto isn't null, then the message in veto will not be included in the Collection of candidates.


filterWithActivator

private java.util.Collection filterWithActivator(java.util.Collection c,
                                                 java.lang.Object a)
Finds the messages in Collection c that has message a as activator.


findMsg

private java.lang.Object findMsg(java.lang.Object r,
                                 java.lang.String n)
Finds the message in ClassifierRole r that has the message number written in n. If it isn't found, null is returned.


compareMsgNumbers

private boolean compareMsgNumbers(java.lang.String n1,
                                  java.lang.String n2)
Compares two message numbers with each other to see if they are equal, in the sense that they refer to the same position in a call tree.


isMsgNumberStartOf

private boolean isMsgNumberStartOf(java.lang.String n1,
                                   java.lang.String n2)
Compares two message numbers n1, n2 with each other to determine if n1 specifies a the same position as n2 in a call tree or n1 specifies a position that is a father of the position specified by n2.


getOperation

private java.util.Vector getOperation(java.util.Collection c,
                                      java.lang.String name,
                                      int params)
Finds the operations in Collection c with name name and params number of parameters. If no operation is found, one is created. The applicable operations are returned.


countParameters

private int countParameters(java.lang.Object bf)
Counts the number of parameters that are not return values.


parseMsgOrder

private static int parseMsgOrder(java.lang.String s)
Parses a message order specification.


findMsgOrderBreak

private static int findMsgOrderBreak(java.lang.String s)
Finds the break between message number and (possibly) message order.


parseStimulus

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


parseAction

public java.lang.Object parseAction(java.lang.String s)
Deprecated. Since 0.15.1, this is essentially a String constructor. It breaks the idea the idea that the parser is editing preexisting objects, which is bad. It is not used within core ArgoUML. d00mst.

Specified by:
parseAction in class Parser

parseGuard

public java.lang.Object parseGuard(java.lang.String s)
Deprecated. Since 0.15.1, this is essentially a String constructor. It breaks the idea the idea that the parser is editing preexisting objects, which is bad. It is not used within core ArgoUML. d00mst.

Specified by:
parseGuard in class Parser

parseEvent

public java.lang.Object parseEvent(java.lang.String s)
Deprecated. Since 0.15.1, this is essentially a String constructor. It breaks the idea the idea that the parser is editing preexisting objects, which is bad. It is not used within core ArgoUML. d00mst.

Specified by:
parseEvent in class Parser

parseObject

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


parseNodeInstance

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


parseComponentInstance

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


beforeAnyOf

private static java.lang.String beforeAnyOf(java.lang.String base,
                                            java.lang.String chars)


ArgoUML © 1996-2004 (20040306)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook