LISTSERV mailing list manager LISTSERV 16.0

Help for MASON-INTEREST-L Archives


MASON-INTEREST-L Archives

MASON-INTEREST-L Archives


MASON-INTEREST-L@LISTSERV.GMU.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

MASON-INTEREST-L Home

MASON-INTEREST-L Home

MASON-INTEREST-L  January 2014

MASON-INTEREST-L January 2014

Subject:

Re: Plans to make bags typed or drop them?

From:

Roman Seidl <[log in to unmask]>

Reply-To:

MASON Multiagent Simulation Toolkit <[log in to unmask]>

Date:

Fri, 24 Jan 2014 14:32:18 +0100

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (232 lines)

Thanks for the reply! I have now digged a little bit into the code and I

now get what you mean by a "really big job".



The question is if it would really pay at all. I didn't even think about

all those Bags for primitives also affected.



As I can think of there would be three advantages:

- less code (which is aways good)

- less framework-specific binding in the simulation code and thus possibly

less conversions

- more control over referencing or copying data



Whereas there are some disadvantages:

- possbily less performance 

- primtive Bags might still be necessary 

- no access on the array 



Somehow I now get the overall complexity of the problem. 



Others have done similar things as e.g. the Colt project

(s.http://acs.lbl.gov/software/colt/) who seem to have implemented one of

the fastest alternative Java collections frameworks.



One could consider using such a framework as the background of the Bag

infrastructure as one would like to get rid of some code. As less code is

always bettter. But one would bind to a framework - which is bad as it

might mess with peoples library dependencies if they need for a specific

colt version by themselves. 



Colt e.g. does not implement a bag in the sense of a Set - they have an

ArrayList that does not allow for the specifity of the ArraySet/Bag remove

method.



To me the main aspect of this whole question is more on how people bind to

the framework more than on the internals.



There are three cases of binding:

-> in

<- out

<> linking 



-> in:

The Framework calls for a Bag or an Array on its methods such as a fields

add method. You can explicitly contruct a Bag from any collection or Array

(Colt could do this only from an Array). As I can see most of the cases the

content gets copied. This is the point where implicit conversions like in

scala might be wonderful to have. Else one could only use an AOP like

AspectJ to achieve that without producing boilerplate code

(s.http://getclass.blogspot.co.at/2008/03/inter-type-declarations-with-implicit.html).



<- out:

As for outgoing Bas one could maybe easily implement the Java List

interface. Bag allready implements Collection, which is probably fine for

many cases. In comparison Colt provides wrapper classes to convert to List

but doesn't even implement Java Collection with their ObjectList (s.

http://acs.lbl.gov/software/colt/api/cern/colt/list/ObjectArrayList.html).



<> linking:

This is the most wicked problem. When changing a collection either on the

mason side of the framwork or on the progam side and have this change

linked one must not copy but wrap the collections. Implementing ArrayList

on the Bag or wrapping it would allow for lining from Mason to the outside

but there could as far as I see be no link from a java collection to the

mason collections still retaining the Bag possibilites of e.g. direct array

access. 



This kind of a thinking loud exercise so I might be wrong in some aspects

and I hope nobody gets bored. 



regards

roman













On Tue, 21 Jan 2014 18:25:49 -0500, Sean Luke <[log in to unmask]> wrote:

> Roman, I’ve been mentioning two possibilities:

> 

> 	- Moving from Bags to ArrayLists now that (it appears) HotSpot has

> 	special-cased the errors in ArrayList.

> 

> 	- Adding some limited support for generics where appropriate in MASON.

> 

> These are both really big jobs.  We were hoping to move MASON in that

> direction with the support of an NSF grant, but applying for that grant

> will have to wait for a year.  :-(  So I think these two moves aren’t

going

> to happen for a while.

> 

> If you’re specifically thinking about Bags, here’s what would need to be

> done:

> 

> 	1. All internal references to scanning over bags using the numObjs

> 	variable would have to move to using get() and set().  This would

include

> 	all applications.

> 

> 	2. Any calls to Bag.remove() would have to instead go to a utility

method

> 	we’d make up which would do the same but be outside the class.  Also,

all

> 	applications.

> 

> 	3. We might need to deal with a few special constructors, though it

> 	wouldn’t be often.

> 

> 	4. Then we’d just need to refactor Bag to ArrayList namewise.

> 

> 	5. And finish up with changes to the documentation (manual, tutorials).

> 

> Not a small task.

> 

> Sean

>> roman

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2021
May 2021
April 2021
March 2021
February 2021
August 2020
July 2020
June 2020
February 2020
August 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
December 2018
October 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
September 2017
June 2017
May 2017
March 2017
February 2017
January 2017
December 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
February 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
April 2005
March 2005
February 2005
January 2005
December 2004
November 2004
October 2004
September 2004
July 2004
May 2004
April 2004
March 2004

ATOM RSS1 RSS2



LISTSERV.GMU.EDU

CataList Email List Search Powered by the LISTSERV Email List Manager