March 2016


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
Christian Meyer <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Fri, 18 Mar 2016 10:08:49 +0100
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
  "The elements in the returned array are not sorted and are not in any
particular order."

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,

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