Print

Print


Thanks for your interest, Model and Controller posted on list.

Kind regards,

Stewart.

On 2 April 2018 at 19:31, Robert Zupko <[log in to unmask]> wrote:

> Can you share some of the code? The exception indicates an indexing error
> which is fairly unusual if you are using a pattern like the following:
>
> int height = 6, width = 5;
> for (int ndx = 0; ndx < width; ndx++) {
>   for (int ndy = 0; ndy < height; ndy++) {
>     array[ndx, ndy] = /* math */
>   }
> }
>
> On Mon, Apr 2, 2018 at 2:17 PM, Stewart Aitken <00000068a29a4109-dmarc-
> [log in to unmask]> wrote:
>
>> Hello,
>>
>> I currently have a simulation where I am creating square and long thin
>> horizontal rectangles in ObjectGrid2D.
>> Using grids that range from 900 cells to 2500 cells.
>>
>> A toy model typically has width of 6 and height of 5 and everything
>> works, all 30 cells are filled.
>>
>> Now, I have to change to long thin vertical rectangles to provide a
>> comparison to the horizontal rectangles.
>>
>> Hence, I have width as 5 and height as 6. The result is that the grid
>> fills up to width squared and then never stops.
>> In this case the grid has 30 cells and 25 of them are filled and the last
>> five remain empty.
>>
>> Can anyone advise me as to how to overcome this or is it just inherent
>> that the height cannot be more than the width?
>>
>> Eclipse debug gives this error:
>>
>> Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException:
>> -1 at javax.swing.text.BoxView.getOffset(BoxView.java:1101) at
>> javax.swing.text.BoxView.childAllocation(BoxView.java:695) at
>> javax.swing.text.CompositeView.getChildAllocation(CompositeView.java:232)
>> at javax.swing.text.BoxView.getChildAllocation(BoxView.java:453) at
>> javax.swing.plaf.basic.BasicTextUI$UpdateHandler.calculateVi
>> ewPosition(BasicTextUI.java:1999) at javax.swing.plaf.basic.BasicTe
>> xtUI$UpdateHandler.layoutContainer(BasicTextUI.java:1975) at
>> java.awt.Container.layout(Container.java:1511) at
>> java.awt.Container.doLayout(Container.java:1500) at
>> java.awt.Container.validateTree(Container.java:1696) at
>> java.awt.Container.validateTree(Container.java:1705) at
>> java.awt.Container.validateTree(Container.java:1705) at
>> java.awt.Container.validateTree(Container.java:1705) at
>> java.awt.Container.validateTree(Container.java:1705) at
>> java.awt.Container.validateTree(Container.java:1705) at java.awt.Contai!
>>  ner.validateTree(Container.java:1705) at java.awt.Container.validateTree(Container.java:1705)
>> at java.awt.Container.validateTree(Container.java:1705) at
>> java.awt.Container.validate(Container.java:1631) at
>> java.awt.Window.dispatchEventImpl(Window.java:2744) at
>> java.awt.Component.dispatchEvent(Component.java:4711) at
>> java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at
>> java.awt.EventQueue.access$500(EventQueue.java:97) at
>> java.awt.EventQueue$3.run(EventQueue.java:709) at
>> java.awt.EventQueue$3.run(EventQueue.java:703) at
>> java.security.AccessController.doPrivileged(Native Method) at
>> java.security.ProtectionDomain$JavaSecurityAccessImpl.doInte
>> rsectionPrivilege(ProtectionDomain.java:80) at
>> java.security.ProtectionDomain$JavaSecurityAccessImpl.doInte
>> rsectionPrivilege(ProtectionDomain.java:90) at
>> java.awt.EventQueue$4.run(EventQueue.java:731) at
>> java.awt.EventQueue$4.run(EventQueue.java:729) at
>> java.security.AccessController.doPrivileged(Native Method) at
>> java.security.Pro
>> <http://secure-web.cisco.com/1oLggIOWP60PSQ7mRYEDysBr2-cxnpKCzU_6TtGH_BXkQ1MrEzXU7y2BMQUgtarJ4N0klJO78OcVuy8NCOhONZB0f5kOoO4mxhTe5x2sz-SSs4dahN19RRddYd9HlJCf5qxJqUw1SfPMe1_hOBSLjwZNewhNVzSgMnSLWqtenRixSKZMyMuIF-Lb5MPLV7fKzt6Sd_LmC9kdjoEDH9wlfvL3iFsBOcfkn-4YsrOwCHg21WaxEW4Me9iYHK4WiJmPcusrCmIXkpVsk3Dd_mwQ3mILfVjU0tBjbYAVhfBs3mwe9nNeeKuNie1R1OyK-RtNC29oAWGzvi--xrr2uDAq7OmkAeebqLoXu76G_P-nJ6TiTDBxAhLDwuKSujvupU2Hpbbe3AxmQeiBIxEut_2tEbMXVuvHdNIxD00q6Z-dtso44aFU6zHa_zYUrMnwCfo8V/http%3A%2F%2Fjava.security.Pro>
>> !
>>  tectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
>> at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at
>> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
>> at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
>> at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
>> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
>> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
>> at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
>> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
>> at javax.swing.text.BoxView.getOffset(BoxView.java:1101) at
>> javax.swing.text.BoxView.childAllocation(BoxView.java:695) at
>> javax.swing.text.CompositeView.getChildAllocation(CompositeView.java:232)
>> at javax.swing.text.BoxView.getChildAllocation(BoxView.java:453) at
>> javax.swing.plaf.basic.BasicTextUI$UpdateHandler.calculateVi
>> ewPosition(BasicTextUI.java:1999) at javax.swing.plaf.ba
>> <http://secure-web.cisco.com/1_J7YogSPoYd_ZI58DWFhLsEuVdsdahgowzoMR9vRQGkoK7hUCmdvLsaka3ZuZdaZlIJXxInRQCAr9a-BugOUwGBZI6TNVSs4r7yF1jLwArXw17tKJvVtb6-chCDoqVTBK0qPUupxvePkkM0c94l9c8b2t8l4MIkEK2vXcDH-GB-M8W3N2xj37VxyTFNGEg5TukEEWzCRTKhthW9shoODt8qVbWXe8z94rXQJqA-9W96R5eWdndVZ6dc2z3LDC7pSZOv23dpKh2OJvmZrL8YciKk1l9MBvjOjGWChlpvwoW4JMWbiJWzt4y-bbzIonjsqjQMNgOaKj5BwT17_es3a7X23950U0OhO8miUmoWhPXpywGM-9ll2Kk7Jjorm2znoSbH5oqsBBTJePRtz_GoWVWO3h_5RSj-IUfi6M6AXVlu5DdCaOV6sQPImoOAwae5b/http%3A%2F%2Fjavax.swing.plaf.ba>
>> !
>>  sic.BasicTextUI$UpdateHandler.layoutContainer(BasicTextUI.java:1975) at
>> java.awt.Container.layout(Container.java:1511) at
>> java.awt.Container.doLayout(Container.java:1500) at
>> java.awt.Container.validateTree(Container.java:1696) at
>> java.awt.Container.validateTree(Container.java:1705) at
>> java.awt.Container.validateTree(Container.java:1705) at
>> java.awt.Container.validateTree(Container.java:1705) at
>> java.awt.Container.validateTree(Container.java:1705) at
>> java.awt.Container.validateTree(Container.java:1705) at
>> java.awt.Container.validateTree(Container.java:1705) at
>> java.awt.Container.validateTree(Container.java:1705) at
>> java.awt.Container.validateTree(Container.java:1705) at
>> java.awt.Container.validate(Container.java:1631) at
>> java.awt.Container.validateUnconditionally(Container.java:1668) at
>> java.awt.Window.show(Window.java:1033) at java.awt.Component.show(Component.java:1671)
>> at java.awt.Component.setVisible(Component.java:1623) at
>> java.awt.Window.setVisible(Window.java:1014) at!
>>   sim.algs.alg2.SimEnviro2WithUI.main(SimEnviro2WithUI.java:32)
>>
>
>


-- 



EMAIL DISCLAIMER http://secure-web.cisco.com/1_Q7Z6I98SnWKtT2yD1ywUpHWjIK3B4xFEX1yxXbxyUr-6ukuX97WL_mRKzgZ4aEJmJfBpDvwEuqN3GuVvN4I-o-UBLc4c8w-tC2PgqwFSrxVvfMm5ROJl_nApYO6fPiJv5raB-A1K_DIG92xaBpfjGJRyODO_OkvXc9KMQBRp4ZssdU0sBpjGsKw5ggUTfTlD2k1N0QmTojQvxTh7sFWPqBjDnHUWERty3PBmFc5T-Jah-yAOvN83Uxqn2xDcjhjmCd-47PkT8_qQGMAXi3nogR0pu7qgiStUHO4167auVxVvWEluSX4GC20W9p970ZTtE8ZCFT7UZsN1VrG5pSwWDllECO2EdRUVh7JJexOUt-K_a-s26kRMzQdf1_f6QdxP3SF2uzKbUR20gk44-i4rIUAi_NBtur9C_tyHXgk160/http%3A%2F%2Fwww.york.ac.uk%2Fdocs%2Fdisclaimer%2Femail.htm
<http://secure-web.cisco.com/1_Q7Z6I98SnWKtT2yD1ywUpHWjIK3B4xFEX1yxXbxyUr-6ukuX97WL_mRKzgZ4aEJmJfBpDvwEuqN3GuVvN4I-o-UBLc4c8w-tC2PgqwFSrxVvfMm5ROJl_nApYO6fPiJv5raB-A1K_DIG92xaBpfjGJRyODO_OkvXc9KMQBRp4ZssdU0sBpjGsKw5ggUTfTlD2k1N0QmTojQvxTh7sFWPqBjDnHUWERty3PBmFc5T-Jah-yAOvN83Uxqn2xDcjhjmCd-47PkT8_qQGMAXi3nogR0pu7qgiStUHO4167auVxVvWEluSX4GC20W9p970ZTtE8ZCFT7UZsN1VrG5pSwWDllECO2EdRUVh7JJexOUt-K_a-s26kRMzQdf1_f6QdxP3SF2uzKbUR20gk44-i4rIUAi_NBtur9C_tyHXgk160/http%3A%2F%2Fwww.york.ac.uk%2Fdocs%2Fdisclaimer%2Femail.htm>