|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.argouml.uml.generator.Parser
org.argouml.uml.generator.ParserDisplay
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 org.apache.log4j.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 |
public static ParserDisplay SINGLETON
protected static final org.apache.log4j.Logger _cat
private PropertySpecialString[] _attributeSpecialStrings
private java.util.Vector _attributeCustomSep
private PropertySpecialString[] _operationSpecialStrings
private java.util.Vector _operationCustomSep
private java.util.Vector _parameterCustomSep
private static final java.lang.String visibilityChars
Constructor Detail |
private ParserDisplay()
SINGLETON
Method Detail |
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.
useCase
- The use case that owns this extension pointep
- The extension point concernedtext
- The text to parsepublic void parseModelElement(java.lang.Object me, java.lang.String text) throws java.text.ParseException
me
- The MModelElement text describes.text
- A String on the above format.
java.text.ParseException
- when it detects an error in the
attribute string. See also ParseError.getErrorOffset().private int indexOfNextCheckedSemicolon(java.lang.String s, int start)
public void parseOperationFig(java.lang.Object cls, java.lang.Object op, java.lang.String text) throws java.text.ParseException
cls
- The classifier the operation(s) belong toop
- The operation on which the editing happenedtext
- The string to parse
java.text.ParseException
public void parseAttributeFig(java.lang.Object cls, java.lang.Object at, java.lang.String text) throws java.text.ParseException
cls
- The classifier the attribute(s) belong toat
- The attribute on which the editing happenedtext
- The string to parse
java.text.ParseException
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.
parseExtensionPoint
in class Parser
text
- The string to parse
null
if we are given null
or a
blank string. Note. The string ":" can be used to
set both name and location to null.public void parseOperation(java.lang.String s, java.lang.Object op) throws java.text.ParseException
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.
parseOperation
in class Parser
s
- The String to parse.op
- The MOperation to adjust to the spcification in s.
java.text.ParseException
- when it detects an error in the
attribute string. See also ParseError.getErrorOffset().private void parseParamList(java.lang.Object op, java.lang.String param, int paramOffset) throws java.text.ParseException
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.
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.
java.text.ParseException
- when it detects an error in the
attribute string. See also ParseError.getErrorOffset().private void setReturnParameter(java.lang.Object op, java.lang.Object type)
private void setParamKind(java.lang.Object p, java.lang.String s)
protected java.lang.String parseOutMultiplicity(java.lang.Object f, java.lang.String s)
f
- s
-
public void parseAttribute(java.lang.String s, java.lang.Object attr) throws java.text.ParseException
The following properties are recognized to have special meaning: frozen.
This syntax is compatible with the UML 1.3 spec.
parseAttribute
in class Parser
s
- The String to parse.attr
- The attribute to modify to comply with the instructions in s.
java.text.ParseException
- when it detects an error in the
attribute string. See also ParseError.getErrorOffset().private java.lang.Object getType(java.lang.String name, java.lang.Object defaultSpace)
name
- The name of the type to get.defaultSpace
- The default name-space to place the type in.
private short getVisibility(java.lang.String name)
name
- The Java name of the visibility.
private void setProperties(java.lang.Object elem, java.util.Vector prop, PropertySpecialString[] spec)
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.private java.lang.Object recFindStereotype(java.lang.Object obj, java.lang.Object root, java.lang.String name)
obj
- The model element to be suitable for.root
- The model element to search from.name
- The name of the stereotype to search for.
private java.lang.Object getStereotype(java.lang.Object obj, java.lang.String name)
TODO: Should create the stereotype under root if it isn't found.
obj
- A MModelElements to find a suitable stereotype for.name
- The name of the stereotype to search for.
protected java.lang.String parseOutProperties(java.lang.Object handle, java.lang.String s)
private java.lang.String parseOutAttributeProperties(java.lang.Object a, java.lang.String s)
a
- s
-
private java.lang.String parseOutOperationProperties(java.lang.Object op, java.lang.String s)
private void addTaggedValue(java.lang.Object target, java.lang.String property)
target
- the element on which to place the tagged valueproperty
- the tag value pair in the form "tag=value"public java.lang.String parseOutVisibility(java.lang.Object f, java.lang.String s)
f
- The feature the visibility is part ofs
- The string that possibly identifies some visibility
public java.lang.String parseOutParams(java.lang.Object op, java.lang.String s)
op
- s
-
public java.lang.String parseOutName(java.lang.Object me, java.lang.String s)
me
- s
-
public java.lang.String parseOutType(java.lang.Object attr, java.lang.String s)
attr
- s
-
protected java.lang.String parseOutReturnType(java.lang.Object op, java.lang.String s)
op
- s
-
protected java.lang.String parseOutInitValue(java.lang.Object attr, java.lang.String s)
public java.lang.Object parseParameter(java.lang.String s)
parseParameter
in class Parser
public java.lang.Object parseStereotype(java.lang.String s)
parseStereotype
in class Parser
public java.lang.Object parseTaggedValue(java.lang.String s)
parseTaggedValue
in class Parser
public java.lang.Object parseMultiplicity(java.lang.String s)
parseMultiplicity
in class Parser
public java.lang.Object parseState(java.lang.String s)
parseState
in class Parser
public void parseStateBody(java.lang.Object st, java.lang.String s)
public void parseStateEntyAction(java.lang.Object st, java.lang.String s)
public void parseStateExitAction(java.lang.Object st, java.lang.String s)
public void parseStateDoAction(java.lang.Object st, java.lang.String s)
public java.lang.Object parseTransition(java.lang.Object trans, java.lang.String s)
parseTransition
in class Parser
public void parseClassifierRole(java.lang.Object cls, java.lang.String s) throws java.text.ParseException
role and baselist can be given in any order.
This syntax is compatible with the UML 1.3 specification.
cls
- The classifier role to apply any changes to.s
- The String to parse.
java.text.ParseException
- when it detects an error in the
attribute string. See also ParseError.getErrorOffset().public void parseMessage(java.lang.Object mes, java.lang.String s) throws java.text.ParseException
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.
mes
- The MMessage to apply any changes to.s
- The String to parse.
java.text.ParseException
- when it detects an error in the
attribute string. See also ParseError.getErrorOffset().private boolean isBadPreMsg(java.lang.Object ans, java.lang.Object chld)
private boolean isPredecessorMsg(java.lang.Object pre, java.lang.Object suc, int md)
private java.lang.Object walkTree(java.lang.Object root, java.util.Vector path)
root
- The root of the call tree.path
- The path to walk in the call tree.
private boolean hasMsgWithActivator(java.lang.Object r, java.lang.Object m)
private void insertSuccessor(java.lang.Object m, java.lang.Object s, int p)
private java.lang.Object successor(java.lang.Object r, int steps)
private java.lang.Object walk(java.lang.Object r, int steps, boolean strict)
private java.util.Collection findCandidateRoots(java.util.Collection c, java.lang.Object a, java.lang.Object veto)
private java.util.Collection filterWithActivator(java.util.Collection c, java.lang.Object a)
private java.lang.Object findMsg(java.lang.Object r, java.lang.String n)
private boolean compareMsgNumbers(java.lang.String n1, java.lang.String n2)
private boolean isMsgNumberStartOf(java.lang.String n1, java.lang.String n2)
private java.util.Vector getOperation(java.util.Collection c, java.lang.String name, int params)
private int countParameters(java.lang.Object bf)
private static int parseMsgOrder(java.lang.String s)
private static int findMsgOrderBreak(java.lang.String s)
public void parseStimulus(java.lang.Object sti, java.lang.String s)
public java.lang.Object parseAction(java.lang.String s)
parseAction
in class Parser
public java.lang.Object parseGuard(java.lang.String s)
parseGuard
in class Parser
public java.lang.Object parseEvent(java.lang.String s)
parseEvent
in class Parser
public void parseObject(java.lang.Object obj, java.lang.String s)
public void parseNodeInstance(java.lang.Object noi, java.lang.String s)
public void parseComponentInstance(java.lang.Object coi, java.lang.String s)
private static java.lang.String beforeAnyOf(java.lang.String base, java.lang.String chars)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArgoUML © 1996-2004 (20040316) | ArgoUML Homepage | ArgoUML Developers' page | ArgoUML Cookbook |