×

Discussion Board

Results 1 to 14 of 14
  1. #1
    Regular Contributor
    Join Date
    Feb 2005
    Location
    Kista, Sweden
    Posts
    267

    How to sort objects in real time?

    I am porting an app from Android to MIDP. I use TreeSet to sort a lot of objects in real time. TreeSet is not available in the java.util package that MIDP uses. So I wonder if there is any fast and efficent way to sort objects in real time in MIDP?

  2. #2
    Nokia Developer Expert
    Join Date
    Aug 2011
    Posts
    555

    Re: How to sort objects in real time?

    You can use the Tree widget to display hierarchical tree structures. This is available as part of the eSWT library.
    Take a look at this link:

    http://library.developer.nokia.com/i...753E8A934.html

  3. #3
    Regular Contributor
    Join Date
    Feb 2005
    Location
    Kista, Sweden
    Posts
    267

    Re: How to sort objects in real time?

    Thanks, that sounds like a good idea. I tried to import org.eclipse.swt.widgets.Tree, but it wasn't possible. I couldn't find "Embedded Standard Widget Toolkit" among the optional packages. Do I have to install something to get access to the Embedded Standard Widget Toolkit?

    How many mobile devices support the Embedded Standard Widget Toolkit package?

  4. #4
    Nokia Developer Expert
    Join Date
    Aug 2011
    Posts
    555

    Re: How to sort objects in real time?

    eSWT is supported only on Symbian Devices (not Series 40) as of 3rd Edition FP2.

    For more information regarding UI development on Nokia Devices see here:
    http://library.developer.nokia.com/i...E112B8B6D.html

    For a complete list of devices that satisfy this requirement, please use the Device specification page:
    http://www.developer.nokia.com/Devic...pecifications/

    You need to use Nokia's Symbian SDK in order to be able to use this library. The library is part of the SDK so you don't need to download it separately. You can download the SDK from here:
    http://www.developer.nokia.com/info/..._One_SDKs.html

    You will also need to download a JDK from Oracle. For complete installation instructions see here:
    http://library.developer.nokia.com/i...C2D2937BC.html

  5. #5
    Regular Contributor
    Join Date
    Feb 2005
    Location
    Kista, Sweden
    Posts
    267

    Re: How to sort objects in real time?

    So it is supported on Symbian 3, Series 60 5th edition and Series 60 3rd edition FP2?

    It is not supported on devices from LG and Samsung, which don't use Symbian?

    Is there some way to sort objects in real time, which work on all MIDP 2 devices?

  6. #6
    Nokia Developer Expert
    Join Date
    Aug 2011
    Posts
    555

    Re: How to sort objects in real time?

    Symbian 3, 5th Edition and 3rd Edition FP2 all support eSWT, while Android devices do not.

    It is always possible to write code that can run cross platform if you use the lower lever LCDUI Canvas class. In that way you can have full control of what is drawn on the display, listen for key presses/releases from all the keys in the mobile device and access concrete keys. That takes considerable effort from programming's perspective though.

    The Light Weight UI Toolkit (LWUIT) does provide a Tree Component and it is compatible with MIDP2.0/CLDC 1.1 Devices, it seems that it is also ported to android and blackberry devices. You might want to take a look at the following links:

    LWUIT page:
    http://lwuit.java.net/

    LWUIT Example with tree component:
    http://lwuit.blogspot.com/2009/04/lwuit-model-tree.html

    LWUIT for Blackberry and Android:
    http://www.pader-sync.com/lwuit-for-...d-android.html

  7. #7
    Regular Contributor
    Join Date
    Feb 2005
    Location
    Kista, Sweden
    Posts
    267

    Re: How to sort objects in real time?

    I checked out LWUIT, but it is too big. It is 750 kb and including it in my app would double it file size.

    I investigated eSWT, but it seems that it only can be used with GUI components. I am not going to use sorting in a GUI and I don't have any GUI components in my project. I want to sort objects based on their numeric values. Can I really do that with the Tree class in eSWT?

    The Tree documentation says "selectable user interface object that displays a hierarchy of items and issues notification when an item in the hierarchy is selected". It seems like this class have to be used in a GUI.

  8. #8
    Nokia Developer Expert
    Join Date
    Aug 2011
    Posts
    555

    Re: How to sort objects in real time?

    Yes eSWT is indeed mainly for UI elements, but it provides a ShortedList class:

    http://library.developer.nokia.com/i...1AA1E53F2.html
    http://library.developer.nokia.com/i...ortedList.html

    that you might be able to use in shorting your data.

    Then there is also a RecordComparator interface within the MIDP2.0 but I doubt it can be of any use for you:
    http://library.developer.nokia.com/i...e-summary.html

    If you want something more universally accepted why not write your own quickshort algorithm? It's a very popular and efficient shorting algorithm, you don't need an additional library that will add up some extra Kb and you can easily write one for your midlet by taking a look at some javaSE implementations of the algorithm:

    http://www.roseindia.net/java/beginn...uickSort.shtml

  9. #9
    Regular Contributor
    Join Date
    Feb 2005
    Location
    Kista, Sweden
    Posts
    267

    Re: How to sort objects in real time?

    Thanks, I got this quick sort to work. My problem is however a bit more complicated than this. This thread explains what I mean:

    http://www.developer.nokia.com/Commu...675#post866675

    Do you know if there is any way to to sort the vertices in real time for a MorphingMesh?

  10. #10
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105

    Re: How to sort objects in real time?

    Quote Originally Posted by MobileVisuals View Post
    TreeSet is not available in the java.util package that MIDP uses.
    Back in 1999, Sun released the Collections API from J2SE for JDK 1.1. Apache Commons offers a Collection API as well. In both cases, you have to change the class path in your source and you have to change the way Iterators work – just syntactically. Perhaps that helps.

  11. #11
    Regular Contributor
    Join Date
    Feb 2005
    Location
    Kista, Sweden
    Posts
    267

    Re: How to sort objects in real time?

    It seems possible to find a method for sorting, but I need to fetch the current positions from a MorphingMesh, then sort them and then put them back into the MorphingMesh. Do you know if that is possible? I can't find any suitable get or set method for this.

    When I say "current positions", I mean those that are the result of the morph calculation. My animation morphs between 20 different galaxy shapes.

    I put the original galaxy shapes positions in the VertexArray[] morphedPositions. These are then put into the VertexBuffer[] morphedVertices, which are put into MorphingMesh. The AnimationTrack then uses this and the weights to calculate the current positions.

  12. #12
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105

    Re: How to sort objects in real time?

    With my mentioned libraries, you do not have (or should have) to port anything except to change the class paths.

  13. #13
    Regular Contributor
    Join Date
    Feb 2005
    Location
    Kista, Sweden
    Posts
    267

    Re: How to sort objects in real time?

    I know how to sort the objects now. The problem is that I need to fetch the current positions from a MorphingMesh and put them back into the MorphingMesh after they have been sorted. When I say "current positions", I mean those that are the result of the morph calculation. Do you know if that is possible?

  14. #14
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105

    Re: How to sort objects in real time?

    No, I do not know. M3G (JSR-184) is not an API I use regularly. Because this question highly specialized, I would go for another discussion board and check there, too.

Similar Threads

  1. The TCP/IP issue in real time
    By Ronak_86 in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2008-12-16, 04:05
  2. Bubble sort a list of linked objects!
    By hclemson in forum Symbian
    Replies: 2
    Last Post: 2005-05-15, 13:39
  3. About Hard Real Time
    By davide1234 in forum Symbian
    Replies: 0
    Last Post: 2005-02-03, 21:27
  4. Can the nokia api be used from multiple objects at the same time?
    By psmshankar in forum PC Suite API and PC Connectivity SDK
    Replies: 2
    Last Post: 2003-09-01, 15:19

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×