hi all,
i have about 30 variables in my java program that i have to keep track
of over every tick count. i have been just using "print" function for
all the variables. as you expect, it is not very convienient.
so i am wondering if there are methods that shows variables in a table
format which is updated at every tick count but still preserves the
data for the previous tick count.
tick1 tick2 tick3 ...
var1 a b c ...
var2 a' b' c' ...
var3 a'' b'' c'' ...
..
finally, i want the data to be saved in a file so that i can import it
in microsoft excel.
i would like your help. Thanks.
rsaccone@gmail.com - 13 Jan 2006 14:34 GMT
As a first shot I might try the following:
var1, var2, var3 etc.. become Objects we'll call them Ticker. You
didn't indicate the purpose of these variables so I will leave it to
you to name the Objects something relevant. Depending on your access
needs you can store all needed instances of these new Tickers in a List
or Map that lives in your TickTracker class.
Each Ticker has a List<String> tickVal where you will store the value
for each tick. Obviously if your ticks don't correlate with index
values you can use a Map.
Finally I would introduce a TickWriter class with method
writeTicks(List<Ticker> theTickers) that handles the writing of the
Tickers. In the TickWriter you can format the output however you like.
Later on you can pull the Format functionality out of the TickWriter
into a TickOutputFormatter interface you can set at run time then pass
into your TickWriter. That allows you to play with different output
formats without effecting the other code.
Hope this helps
Rich
Jonie - 13 Jan 2006 15:38 GMT
Thank you, Rich. I will try as you suggested.