E&S CVS Commit: PEAK - Added a couple of utility methods ('__getitem__' and 'find()') to namespace

pje at eby-sarna.com pje at eby-sarna.com
Tue Dec 17 15:41:00 EST 2002


Module Name:	PEAK
Committed By:	pje
Date:		Tue Dec 17 20:40:39 UTC 2002

Modified Files:
	PEAK/src/peak/metamodels/uml: Model.py

Log Message:
Added a couple of utility methods ('__getitem__' and 'find()') to namespace
classes in the UML metamodel.  This makes it easier to play with a UML
model loaded from XMI.  For example 'aModel["SomePackage.SomeClass"]'
would return 'SomeClass' from 'SomePackage' (assuming that the former is
directly inside the latter, and the latter is directly inside 'aModel').
The 'find()' method applies its '*args' as a series of criteria to be
invoked against a query on the namespace's contents.  So something like
'aModel.find(TYPE(UMLClass.Package),'name')' would be an iterator over the
names of the packages directly contained in 'aModel'.

These should be useful in developing code generation tools to write Python
or other output from UML and other types of models.


To view diffs of this commit, you can use the following URL(s):
http://cvs.eby-sarna.com/PEAK/src/peak/metamodels/uml/Model.py.diff?r1=1.27&r2=1.28

To generate a diff of this commit:
cvs rdiff -r1.27 -r1.28 PEAK/src/peak/metamodels/uml/Model.py

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




More information about the source-changes mailing list