SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-18-2009, 12:04 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Need help sorting an array in eclipse

So I am trying to sort an array using Sort() in eclipse but I am not sure how to define the comparator that I want to sort by

Say my array is named arr1 and I want to sort by the default "ShowAPI.GetShowTitle" how do I go about defining that

I know I would have

sort(arr1, ) not sure what goes after the arr1.

I tried sidestepping this and using the default database sortmethods on the array but it doesn't seem to like the sorting method called the same as in studio ie
"GetShowTitle"
Reply With Quote
  #2  
Old 08-18-2009, 12:30 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
figured out my problem calling default sage sorting but would still like to know how to do it in java if anyone cares to share.
Reply With Quote
  #3  
Old 08-18-2009, 07:09 PM
jphipps jphipps is offline
Sage Expert
 
Join Date: Aug 2006
Location: Maryland
Posts: 512
It really depends on what you are sorting...

This is an example of a HashMap<String,CustomObject> where menu is the HashMap:

Object[] mi = menu.keySet().toArray();
Arrays.sort(mi, new Comparator() {
public int compare(Object o1, Object o2) {
if ( menu.get(o1).getPosition() > menu.get(o2).getPosition())
return 1;
else
return -1;
}
});
This will return you a list of keys in this example sorting on the getPosition method in the CustomObject...

If you are sorting sage objects, I found it easy to use Greg's API and use the Sage sort methods...

Thanks,
Jeff
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
building array in eclipse to pass to studio PLUCKYHD SageTV Studio 8 08-04-2009 12:08 PM
Help with removeall in eclipse PLUCKYHD SageTV Studio 3 07-29-2009 10:50 AM
What is required for a Raid 5 storage array myoung84 Hardware Support 15 08-09-2008 09:40 AM
My Frakking array went south trini0 The SageTV Community 0 04-03-2008 04:45 PM
aaaaaaaaaaaagh! Disk array corrupt. sleonard SageTV Software 41 12-23-2004 12:35 PM


All times are GMT -6. The time now is 06:05 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.