|
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. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
List constructor ?
Is there an easy way to create a List (instead of a set) ?
The DataUnion respects the order, but it doesnt seem to allow duplicates, a list = DataUnion(1,2,3,2,1) only results in [1,2,3] I know that I could use Code:
list = new_java_util_ArrayList() java_util_List_add(list, "1") java_util_List_add(list, "2") java_util_List_add(list, "1") Also, the above java code only works with strings, but not with integer ... I probably could find something in one of the various imports, but maybe someone can point me to an example more quickly ... Thanks, Dirk |
#2
|
||||
|
||||
I don't know of a more concise way to do what you want, short of writing your own constructor function in Java.
That would also solve your string-v.-int problem by letting you declare the argument types explicit as int. (I've noticed that Sage has trouble passing ints where Objects are expected.)
__________________
-- Greg |
#3
|
||||
|
||||
Something like this might meet your needs.
list = java_lang_String_split("1,2,3,2,1",",") |
#4
|
|||
|
|||
Quote:
Thanks for all answers, Dirk |
#5
|
||||
|
||||
I won't claim to be a list expert (and once created a DataUnion of a fixed length of numbers 1-10 just to get an array that size, which I could then fill with the real data at set locations), but SageTV will usually automatically convert from one data type to another. If you have "3" as a string, you can multiple it by the number 2 in order to get 6 as a result. In fact, I use this in various places when I need to use a property as a numerical value -- multiply it by 1 to get a number instead of a string.
- Andy
__________________
SageTV Open Source v9 is available. - Read the SageTV FAQ. Older PDF User's Guides mostly still apply: SageTV V7.0 & SageTV Studio v7.1. - Hauppauge remote help: 1) Basics/Extending it 2) Replace it 3) Use it w/o needing focus - HD Extenders: A) FAQs B) URC MX-700 remote setup Note: This is a users' forum; see the Rules. For official tech support fill out a Support Request. |
#6
|
|||
|
|||
Quote:
Dirk |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|