From: Robert L. <rle...@us...> - 2007-02-12 16:01:35
|
Update of /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv17108/src/ccmtools/parser/assembly/metamodel Modified Files: Constant.java Module.java Assembly.java Attribute.java Port.java Connection.java QualifiedName.java Component.java ModelElement.java AssemblyElement.java Model.java Log Message: ccm assembly metamodel Index: Component.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/Component.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Component.java 12 Feb 2007 14:08:31 -0000 1.2 --- Component.java 12 Feb 2007 16:01:13 -0000 1.3 *************** *** 11,14 **** --- 11,15 ---- import java.io.PrintStream; + import java.util.Map; /** *************** *** 27,30 **** --- 28,42 ---- } + void postProcessing( Assembly parent, Map<String, Component> components ) + { + parent_ = parent; + idl_name_.postProcessing(parent.getParent()); + if (components.containsKey(name_)) + { + throw new RuntimeException("inner component \"" + name_ + "\" already exists"); + } + components.put(name_, this); + } + public void prettyPrint( PrintStream out, String offset ) { Index: Connection.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/Connection.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Connection.java 12 Feb 2007 14:08:31 -0000 1.2 --- Connection.java 12 Feb 2007 16:01:13 -0000 1.3 *************** *** 11,14 **** --- 11,15 ---- import java.io.PrintStream; + import java.util.Map; /** *************** *** 27,30 **** --- 28,38 ---- } + void postProcessing( Assembly parent, Map<String, Component> components ) + { + parent_ = parent; + facet_.postProcessing(components); + receptacle_.postProcessing(components); + } + public void prettyPrint( PrintStream out, String offset ) { Index: AssemblyElement.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/AssemblyElement.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AssemblyElement.java 12 Feb 2007 14:08:31 -0000 1.2 --- AssemblyElement.java 12 Feb 2007 16:01:13 -0000 1.3 *************** *** 11,14 **** --- 11,15 ---- import java.io.PrintStream; + import java.util.Map; /** *************** *** 18,20 **** --- 19,31 ---- { public abstract void prettyPrint( PrintStream out, String offset ); + + protected Assembly parent_; + + /** + * call this method after model creation + * + * @param parent the assembly + * @param components map with all known inner components + */ + abstract void postProcessing( Assembly parent, Map<String, Component> components ); } Index: Constant.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/Constant.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Constant.java 12 Feb 2007 14:08:31 -0000 1.2 --- Constant.java 12 Feb 2007 16:01:12 -0000 1.3 *************** *** 11,14 **** --- 11,15 ---- import java.io.PrintStream; + import java.util.Map; /** *************** *** 27,30 **** --- 28,37 ---- } + void postProcessing( Assembly parent, Map<String, Component> components ) + { + parent_ = parent; + target_.postProcessing(components); + } + public void prettyPrint( PrintStream out, String offset ) { Index: Attribute.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/Attribute.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Attribute.java 12 Feb 2007 14:08:31 -0000 1.3 --- Attribute.java 12 Feb 2007 16:01:12 -0000 1.4 *************** *** 11,14 **** --- 11,15 ---- import java.io.PrintStream; + import java.util.Map; /** *************** *** 27,30 **** --- 28,38 ---- } + void postProcessing( Assembly parent, Map<String, Component> components ) + { + parent_ = parent; + target_.postProcessing(components); + source_.postProcessing(components); + } + public void prettyPrint( PrintStream out, String offset ) { Index: Model.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/Model.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Model.java 12 Feb 2007 14:08:31 -0000 1.3 --- Model.java 12 Feb 2007 16:01:17 -0000 1.4 *************** *** 29,32 **** --- 29,43 ---- /** + * call this method after model creation + */ + public void postProcessing() + { + for (int i = 0; i < elements_.size(); ++i) + { + elements_.get(i).postProcessing(null); + } + } + + /** * prints the model to an output stream * *************** *** 35,39 **** public void prettyPrint( PrintStream out ) { ! for(int i=0; i<elements_.size(); ++i) { elements_.get(i).prettyPrint(out, ""); --- 46,50 ---- public void prettyPrint( PrintStream out ) { ! for (int i = 0; i < elements_.size(); ++i) { elements_.get(i).prettyPrint(out, ""); Index: ModelElement.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/ModelElement.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ModelElement.java 12 Feb 2007 14:08:31 -0000 1.2 --- ModelElement.java 12 Feb 2007 16:01:13 -0000 1.3 *************** *** 25,27 **** --- 25,44 ---- public abstract void prettyPrint( PrintStream out, String offset ); + + protected Module parent_; + + /** + * returns the parent Module of this element (or null) + */ + public Module getParent() + { + return parent_; + } + + /** + * call this method after model creation + * + * @param parent namespace or null + */ + abstract void postProcessing( Module parent ); } Index: QualifiedName.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/QualifiedName.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** QualifiedName.java 12 Feb 2007 14:08:31 -0000 1.2 --- QualifiedName.java 12 Feb 2007 16:01:13 -0000 1.3 *************** *** 21,28 **** qn_ = qn; } ! public String toString() { return qn_; } } --- 21,35 ---- qn_ = qn; } ! public String toString() { return qn_; } + + private Module container_; + + void postProcessing( Module container ) + { + container_ = container; + } } Index: Assembly.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/Assembly.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Assembly.java 12 Feb 2007 14:08:31 -0000 1.3 --- Assembly.java 12 Feb 2007 16:01:12 -0000 1.4 *************** *** 11,16 **** --- 11,20 ---- import java.io.PrintStream; + import java.util.HashMap; import java.util.Vector; + /** + * defines one assembly + */ public class Assembly extends ModelElement { *************** *** 26,29 **** --- 30,46 ---- } + private HashMap<String, Component> components_; + + void postProcessing( Module parent ) + { + parent_ = parent; + idl_name_.postProcessing(parent); + components_ = new HashMap<String, Component>(); + for (int i = 0; i < elements_.size(); ++i) + { + elements_.get(i).postProcessing(this, components_); + } + } + public void prettyPrint( PrintStream out, String offset ) { Index: Port.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/Port.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Port.java 12 Feb 2007 14:08:31 -0000 1.3 --- Port.java 12 Feb 2007 16:01:12 -0000 1.4 *************** *** 10,13 **** --- 10,15 ---- package ccmtools.parser.assembly.metamodel; + import java.util.Map; + /** * facet or receptacle *************** *** 49,51 **** --- 51,64 ---- return component_ + "." + connector_; } + + void postProcessing( Map<String, Component> components ) + { + if (component_ != null) + { + if (!components.containsKey(component_)) + { + throw new RuntimeException("inner component \"" + component_ + "\" is undefined"); + } + } + } } Index: Module.java =================================================================== RCS file: /cvsroot/ccmtools/ccmtools/src/ccmtools/parser/assembly/metamodel/Module.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Module.java 12 Feb 2007 14:08:31 -0000 1.3 --- Module.java 12 Feb 2007 16:01:12 -0000 1.4 *************** *** 26,29 **** --- 26,38 ---- } + void postProcessing( Module parent ) + { + parent_ = parent; + for (int i = 0; i < children_.size(); ++i) + { + children_.get(i).postProcessing(this); + } + } + public void prettyPrint( PrintStream out, String offset ) { |