Community
Participate
Working Groups
Section 4.2.5 needs improvement.. see: http://eclipse.org/amp/documentation/amp.pdf
original source: https://sourceforge.net/projects/ascape/forums/forum/731620/topic/3854156
Note that we have control key instructions wrong for Windows. Ranier, if you could verify that the behavior is actually: "Ctrl" for move and.. "Ctrl-Shift" for link I'll change docs to reflect and save other users a lot of hassle.
wow ... this is interesting: you don't need any additional key at all! Here's the most reliable way: grab the Intersection, drag it slowly over the Within Query until a link symbol appears (dragged Intersection is basically above the input line), let go of it ... basta, that's it :) Rainer
I should have paid attention to the icon change in the first place ... it might make sense to mention this change ... provides people with recognizable feedback. (In reply to comment #3) > wow ... this is interesting: you don't need any additional key at all! > > Here's the most reliable way: grab the Intersection, drag it slowly over the > Within Query until a link symbol appears (dragged Intersection is basically > above the input line), let go of it ... basta, that's it :) > > Rainer
Jonas, Would you mind just confirming this behavior? I'm not sure exactly how to write this up in a clear way for windows users that will be correct for all cases.. Miles
(In reply to comment #5) Hi Miles, When stepping through the tutorial, I can get as far as 4.2.3.2. But then I get a Java compilation error in StupidModel.java: "StupidModel.Bug cannot be resolved to a type" And here's the type cast that cannot be compiled: bugScape.addInitialRule(new Rule("Initialize") { private static final long serialVersionUID = 6846144446402098982L; public void execute(Agent a) { ((StupidModel.Bug) a).intializeNonFramework(); } }); Have I missed anything when following the tutorial?
Jonas, you must have ... I can successfully complete the tutorial until I hit 4.2.5 ... I'll try to figure out what you have missed later today. Rainer bugScape.addInitialRule(new Rule("Initialize") { private static final long serialVersionUID = 6846144446402098982L; public void execute(Agent a) { ((org.me.StupidModel.Bug) a).intializeNonFramework(); } }); bugScape.addRule(new Rule("Bug Rule") { private static final long serialVersionUID = 6846144446402098981L; public void execute(Agent a) { ((org.me.StupidModel.Bug) a).bugRule(); } }); (In reply to comment #6) > (In reply to comment #5) > > Hi Miles, > When stepping through the tutorial, I can get as far as 4.2.3.2. But then I get > a Java compilation error in StupidModel.java: "StupidModel.Bug cannot be > resolved to a type" > > And here's the type cast that cannot be compiled: > > bugScape.addInitialRule(new Rule("Initialize") { > private static final long serialVersionUID = 6846144446402098982L; > public void execute(Agent a) { > ((StupidModel.Bug) a).intializeNonFramework(); > } > }); > > Have I missed anything when following the tutorial?
Oh... wait. I found what's causing the compilation error. The MetaABM file should not be called the same as the project name! Actually, in the tutorial the screenshots show a MetaABM file named "StupidModel1.metaabm". But in section 4.2.1.4 the name "StupidModel.metaabm" is proposed. So this should be changed!
Section 4.2.4.1 should be changed as well. In the trunk version from the CVS, a default Style is being added to the Agent. So creating a Style Rule is not necessary. Instead the user should change default Style behavior.
In section 4.2.5 I can achieve the drag&drop interaction by pressing CTRL+SHIFT at the same time. Pressing only CTRL will lead to a number of copies of the Intersection. I still get compilation errors in Bug.java ("duplicate local variable bugCopy"). public void bugRule() { Object bugCopy = (Object) ((org.ascape.model.space.Discrete) getStupidModel1() .getGrid2D().getSpace()).findRandomAvailable(); if (bugCopy != null) { Object bugCopy = (Object) ((org.ascape.model.space.Discrete) getStupidModel1() .getGrid2D().getSpace()).findRandomWithin( ((org.ascape.model.CellOccupant) this).getHostCell(), false, bugCopy.getStupidModel1().getBugVision()); if (bugCopy != null) { } } }
(In reply to comment #8) > Actually, in the tutorial the screenshots show a MetaABM file named > "StupidModel1.metaabm". But in section 4.2.1.4 the name "StupidModel.metaabm" > is proposed. So this should be changed! OK, done.
(In reply to comment #10) > In section 4.2.5 I can achieve the drag&drop interaction by pressing CTRL+SHIFT > at the same time. Pressing only CTRL will lead to a number of copies of the > Intersection. What about pressing nothing for linking, as Rainer suggested...does that work? > > > I still get compilation errors in Bug.java ("duplicate local variable > bugCopy"). > > public void bugRule() { > Object bugCopy = (Object) ((org.ascape.model.space.Discrete) > getStupidModel1() > .getGrid2D().getSpace()).findRandomAvailable(); > if (bugCopy != null) { > Object bugCopy = (Object) ((org.ascape.model.space.Discrete) > getStupidModel1() > .getGrid2D().getSpace()).findRandomWithin( > ((org.ascape.model.CellOccupant) this).getHostCell(), > false, bugCopy.getStupidModel1().getBugVision()); > if (bugCopy != null) { > } > } > } Could you attach (just) the .metaabm file?
BTW, I"ve added information on wiki about how to edit and submit documentation directly. ;) http://wiki.eclipse.org/AMP/Building
something I noted several times: deleting elements in the .metaabm file does not properly roll back the file to its previous state. For example, I just generated an error with the Within query(rooted it on Available instead on Next Location). Deleting Within does not return the metaabm file to its error free state. Rainer
(In reply to comment #14) > something I noted several times: > > deleting elements in the .metaabm file does not properly roll back the file to > its previous state. > > For example, I just generated an error with the Within query(rooted it on > Available instead on Next Location). Deleting Within does not return the > metaabm file to its error free state. Rainer, please enter a separate bug for this. Do you mean "deleting" or "cutting"? There is a crucial difference there.
Created attachment 179354 [details] StupidModel1 with compilation error in Bug.java (See comment #10)
(In reply to comment #12) > What about pressing nothing for linking, as Rainer suggested...does that work? Dragging slowly without pressing a key does not change anything. (Still, this is Windows 7.) Oh... think I found it! When pressing ALT while dragging I can see the mouse cursor changing. Same icon as with CTRL+SHIFT. But it does not seem to have the same affect. Pressing the ALT key seems to be doing what we're looking for! Haven't tested the functionality. Just visually in the editor.
(In reply to comment #17) And me once again... Yes, after all I think ALT and CTRL+SHIFT do the same thing. It's just absolutely relevant to press SHIFT *before* you press CTRL. Otherwise you'll end up with lots of copies of the Intersection.
I ran through the tutorial yesterday again ... and again I was able to just drag the Intersection to create the double input ... also no copies were generated. Still, the metaabm file was buggy (not the generated code). I am on XP with latest Eclipse and latest nightly AMP build and Java 1.6_20 Is it possible that different configurations cause different behaviors? Might it make sense to test certain reference configurations? ... only if tis tutorial has wider implications for the code base of AMP. Rainer (In reply to comment #18) > (In reply to comment #17) > And me once again... > Yes, after all I think ALT and CTRL+SHIFT do the same thing. It's just > absolutely relevant to press SHIFT *before* you press CTRL. Otherwise you'll > end up with lots of copies of the Intersection.
> > > (In reply to comment #17) > > Yes, after all I think ALT and CTRL+SHIFT do the same thing. It's just > > absolutely relevant to press SHIFT *before* you press CTRL. Otherwise you'll > > end up with lots of copies of the Intersection. That is completely bizarre about needing to do "SHIFT" and then "CTRL". Just the kind of thing that I'd love (not) to have to explain in the docs. (In reply to comment #19) > I ran through the tutorial yesterday again ... and again I was able to just > drag the Intersection to create the double input ... also no copies were > generated. Still, the metaabm file was buggy (not the generated code). > > I am on XP with latest Eclipse and latest nightly AMP build and Java 1.6_20 > > Is it possible that different configurations cause different behaviors? Might > it make sense to test certain reference configurations? ... only if tis > tutorial has wider implications for the code base of AMP. It would be really not good if a plain old drag actually did a link. That would mean that there is no effective way to move anything! This is actually quite complex 0- Eclipse maps actual keyboard keys such as ctrl, Mac Command, alt, option and so on to M1, M2, M3, etc.. these are specified in SWT. Then those in turn are mapped to SWT DnD values, which then end up being interpreted by EMF framework and customized by the AMF editor. Theoretically, a Windows "alt" should be a Mac "option", i.e. copy I'd think, and a Windows "Ctrl" should be a Mac "Command". But its not clear what a Mac "Ctrl" maps to! That's why I used Ctrl-Shift. But I think that something is getting invoked that should not be getting invoked. But I think we have a situation where we are not getting the same behavior from XP as we do with Windows 7. Now, that would be a surprise. I'm trying to think of someway to test this behavior outside of AMP. I can't think of any other EMF editor off hand which uses the link behavior. I'll check bugs and see if I can find anything about this. Worst case I think we'd actually need a test case that demonstrated different behavior for XP and SWT to give to someone else to take a look at.