[Gambas-user] Subsetting a collection & clipboarding
Bruce Bruen
bbruen at ...2308...
Sun Oct 31 09:42:32 CET 2010
Hi folks,
I have a class "A" that has as one of its' properties ,"b", a collection of
objects (of type "C"). I wish to
a) provide a (READ) property in A that returns a subset of the collection (b')
based on a parameter (relating to a known property of C, say something like
"DaysAgo is less than 45" where DaysAgo is a property of C), and
b) copy all attributes of each instance of C in b' onto a new clipboard item.
To confound the issue, the DaysAgo property of C is computed and is relative
to another date that is independent of both A and C. Or to put that another
way, I suppose I need a window function, rather than a subsetting function
that will return each instance of C in b that is between a basedate and a
number of days beforehand.
To try and put this into a better perspective, we have a patient "Ms Sally
Simpson" who was diagnosed in early August as suffering from infectious
mononucleosis (aka glandular fever, college disease, kissing disease etc etc).
She has had a series of pathology tests done over the last 6 months when she
first presented ("Doctor, I dont feel well"). The blood samples take from her
over this period may have been subjected to over 150 odd pathology tests. My
learned pathological statisticians ( sorry pathology statisticians) now want
to select specific examples of certain tests to see if there is any evidence
of atypical results being "ahem, missed" in the earlier tests.
So, class A(patient) (instance "Simpson, Sally") has a collection b of path
tests generalised as a "test" (C) (with many specialisations). The
requirement put to me is "I want to copy all the data for the IG Count tests
done on Sally in the period between 2 Aug and 45 days prior to the clipboard
(so I can paste them into a spreadsheet and do mystical incantations over
them)"
(OK, I added the last bit.)
To me this requires subsetting b over testtype between two parameters (day0
and daysago)
So, is there a way to provide a "parameterised" property accessor,
TestSeries_Read(ttype as TestTypeCode, startdate as Date, window as Integer)
as TestSeries
and when I get it, how do I copy all attributes of each instance in the subset
to the clipboard (i.e. how can I serialise a specialisation of a generic
type).
If you have read this far, thank you.
If you can provide some help, may you be blessed.
--
best regards
Bruce Bruen
More information about the User
mailing list