MASON-INTEREST-L Archives

March 2016

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Christian Meyer <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Fri, 18 Mar 2016 10:08:49 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (51 lines)
Hmm, for me the property order is not how I put the accessors into my 
source code. This seems to differ between JVMs. The Java documentation 
states:
  "The elements in the returned array are not sorted and are not in any 
particular order."
http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#getMethods%28%29

In my opinion it is better to set a certain order as default. For those 
people having a JVM which orders methods like they are in source code it 
might be a bad surprise when they run their application on a different 
machine and notice the order is different.

Usually, you do not handle the Properties object manually but just use 
Inspector.getInspector. A very convenient way to handle properties are 
probably annotations. In this way you could also attach a comparator to 
specify the order for the generated properties and set options like 
domain directly at the accessors.

Best regards,
Christian

On 17.03.2016 16:18, Sean Luke wrote:
> Yeah, that's a documentation error.  But before I change it, any
> opinions?
>
> SimpleProperties is kind of in flux.  I added the ability to sort the
> properties arbitrarily (not documented), and the sort based on an
> array of strings representing property names (the poorly named
> makeFilterComparator(...) -- I will change that method name).  And
> the ability to sort alphabetically.  And of course no sorting.
>
> Originally I was going to make alphabetical sorting the default.  But
> I've since found that alphabetical ordering can be a real pain.
> People put methods in their source code in a specific order *on
> purpose*, and alphabetical ordering totally messes with that.  So I
> removed the alphabetical ordering default but kept it as an option.
> What's your opinion on this?
>
> Sean
>
> On Mar 17, 2016, at 5:21 AM, Christian Meyer
> <[log in to unmask]> wrote:
>
>> Hi,
>>
>> I just noticed that SimpleProperties gets initialized without a
>> sortComparator (null), although documentation states that it sorts
>> alphabetically by default.
>>
>> Best regards, Christian

ATOM RSS1 RSS2