Hi,
I find there seems only a way to read data to Dataset, i.e. readFile(). Is it possible to set values to Dataset from Arraylist, etc? I do not like to save the arraylist to hard disk as .text and then readed by Dataset.readFile();
Thank you!
Best wishes,
Yang
Can set value to Dataset from array, list, etc?
-
- Site Admin
- Posts: 1417
- Joined: Mon Nov 26, 2007 5:51 pm
Re: Can set value to Dataset from array, list, etc?
There's no direct support for Java collections, but you can build your dataset with the following methods defined in the DataSet class: addIntVariable, addFloatVariable, addEmptyRecord, setInt, setFloat, setMissing.
Define the structure of your dataset with addXXXVariable calls. To add rows, call addEmptyRecord followed by setInt or setFloat.
Define the structure of your dataset with addXXXVariable calls. To add rows, call addEmptyRecord followed by setInt or setFloat.
Re: Can set value to Dataset from array, list, etc?
Dear Shooltz,shooltz wrote:There's no direct support for Java collections, but you can build your dataset with the following methods defined in the DataSet class: addIntVariable, addFloatVariable, addEmptyRecord, setInt, setFloat, setMissing.
Define the structure of your dataset with addXXXVariable calls. To add rows, call addEmptyRecord followed by setInt or setFloat.
Thank you very much for your fast reply!
I find there is a wrapper for Java to generate .jar. Can I add a new function in the wrapper and then regenerate the smile.jar?
Thank you!
Best wishes,
Yang
-
- Site Admin
- Posts: 1417
- Joined: Mon Nov 26, 2007 5:51 pm
Re: Can set value to Dataset from array, list, etc?
You can do that, but you'd loose your changes when new version of jSMILE is posted. Why don't you create a class derived from DataSet or an utility class or set of classes providing the functionality on top of the DataSet?musicpxg wrote:I find there is a wrapper for Java to generate .jar. Can I add a new function in the wrapper and then regenerate the smile.jar?
Re: Can set value to Dataset from array, list, etc?
Hi Shooltz,shooltz wrote:You can do that, but you'd loose your changes when new version of jSMILE is posted. Why don't you create a class derived from DataSet or an utility class or set of classes providing the functionality on top of the DataSet?musicpxg wrote:I find there is a wrapper for Java to generate .jar. Can I add a new function in the wrapper and then regenerate the smile.jar?
Yes, you are right! I will have a try.
Thank you!
Regards,
Yang