[Bioc-devel] S4 overwrite inspector of virtual class
Zach Skidmore
zskidmor at wustl.edu
Mon Aug 15 18:56:19 CEST 2016
maybe validator is the proper term in R? i've highlighted what I refer to as the inspector below as an example:
setClass("file",
contains="file_virtual",
validity=function(object){
# Check that object is as expected
}
)
On 8/15/16 11:46 AM, Gabe Becker wrote:
Zach,
Is an inspector a method you define on your classes? I'm not quite
following what you mean by your question. AFAIK inspectors are not
generally a thing in R (at least that go by that name).
~G
On Mon, Aug 15, 2016 at 9:42 AM, Zach Skidmore <zskidmor at wustl.edu><mailto:zskidmor at wustl.edu> wrote:
Hi All,
I'm currently transforming the GenVisR package into an Object Oriented
system. Currently I have a virtual class and several child-classes. I am
wondering if there is a way to tell R to use the inspector of the virtual
class only if the inspector of a child class in not defined.
For example say I had a class to store versions of a file-type and I have
a slot in the class to store the position. Between different versions of
the file-type there may be small differences (for example Chromosome may be
capitalized in version 2,3,4 but not version 1). Ideally the child classes
for 2,3,4 would be able to inherit the inspector from the virtual class to
check the chromosome name and I would define a separate inspector for
version 1 which is different.
Any thoughts? Currently both inspectors are called (virtual and the
appropriate sub-class), meaning if i added more versions in the future I
would have to re-write the virtual and child class. Whereas if I could say
ignore the virtual (i.e. default) inspector if another is defined I would
only have to write the child class inspector in the future.
Hopefully this makes sense, let me know if it doesn't or if i'm violating
a core OO principle, i'm relatively new to object oriented programming.
Thanks, Zach!
________________________________
The materials in this message are private and may contain Protected
Healthcare Information or other information of a sensitive nature. If you
are not the intended recipient, be advised that any unauthorized use,
disclosure, copying or the taking of any action in reliance on the contents
of this information is strictly prohibited. If you have received this email
in error, please immediately notify the sender via telephone or return mail.
[[alternative HTML version deleted]]
_______________________________________________
Bioc-devel at r-project.org<mailto:Bioc-devel at r-project.org> mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel
________________________________
The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.
[[alternative HTML version deleted]]
More information about the Bioc-devel
mailing list