Displaying 20 results from an estimated 300 matches similar to: "Call super methods from inherited classes R.oo"
2011 Aug 26
1
R.oo data members / inheritance
If someone is able, can you tell me if there is a better way to do this?
More specifically, do I have to rewrite all of the data members stuff and
extend stuff of parent class in the child class? See below. Thanks in
advance!
Example 1:
setConstructorS3("ClassA", function(A,x) {
if(missing(A))A=15;
if(missing(x))x=NA;
extend(Object(), "ClassA",
.size = A,
.x=x
2008 Nov 05
1
Methods dispatch and inheritance R.oo
Hi to all members, i have a question about class inheritance and methods
using R.oo package:
I have the following code and it doesn't work, guess i'm doing smth wrong
and there is nothing in the help.
library(R.oo)
setConstructorS3("ClassA", function(A=15) {
extend(Object(), "ClassA",
.size = A
);
})
setMethodS3("print", "ClassA",
2011 Oct 24
0
R.oo package: do setMethodS3 work upon construction
Hello (Heinrich),
I did not know I could do this. It doesn't seem to be documented anywhere.
Thought this would be helpful to the fraction of the community using package
R.oo. Note the call of a setMethodS3 method, xOne, in the setConstructorS3.
This is extremely useful if xOne (in this case) is a very complex method
(that you always want to be called every time you create a new object). If I
2009 Jul 07
0
[LLVMdev] How to add an include file
On Tue, Jul 7, 2009 at 1:42 AM, David Minor<dahvid.minor at gmail.com> wrote:
> Hi Eli,
> Let's say I have a file ClassA.h, that pairs with a file ClassA.cpp
> to product a library libClassA.a.
> ClassA.h contains the single declaration.
>
> class A {...};
>
> I want to transform it to:
>
> #include "ClassB.h"
>
> class A : public class B
2009 Jul 07
2
[LLVMdev] How to add an include file
Hi Eli,
Let's say I have a file ClassA.h, that pairs with a file ClassA.cpp
to product a library libClassA.a.
ClassA.h contains the single declaration.
class A {...};
I want to transform it to:
#include "ClassB.h"
class A : public class B {...};
ClassB.h is the header file for a library libClassB.a built from ClassB.cpp
and ClassB.h.
I can clearly link libClassB with libClassA.
2009 Jul 08
1
[LLVMdev] How to add an include file
I see,
Adding includes is trivial even w/o llvm, but the real problem here is
manipulation of classes, if I understand you correctly adding an inheritee
wouldn't be possible.
David
On Tue, Jul 7, 2009 at 12:43 PM, Eli Friedman <eli.friedman at gmail.com>wrote:
> On Tue, Jul 7, 2009 at 1:42 AM, David Minor<dahvid.minor at gmail.com> wrote:
> > Hi Eli,
> > Let's
2002 May 21
4
setClass() and packages
Where should the setClass() ('methods' package) calls be placed in a
package? I try to follow a one-class-one-file principe, but since
setClass("ClassA", "ClassB") has to come a after setClass("ClassB", [snip])
it is not possible to fully follow this rule. So the best I can do now is to
put all setClass() calls in a file named "000.R" (I know this
2011 Oct 27
0
R.oo package, inherit two classes
Hello,
How do I inherit two classes using the R.oo package. Below is kind of a
silly example, but I am trying to create class PerDog from classes Dog and
Person. Error at bottom. I've tried a few other ways of using extend(), but
nothing seems to get me what I want.
Example:
setConstructorS3("Person", function(age=NA) {
this = extend(Object(), "Person",
.age=age
)
2005 Aug 21
0
Patch for Element.Class - wrong regexp
Hello,
I noticed (due to a recent post by Martin Honnen to clp) that
Element.Class uses wrong regexps for its operations.
E.g., Element.Class.has() will find "classA" in "classA-foobar"
I also changed the interface of .has() to the more general one used in
.has_any()
--- util.js.old 2005-08-21 19:18:40.000000000 +0200
+++ util.js 2005-08-21 19:31:42.000000000 +0200
@@
2011 Aug 26
0
R.oo inheritance with pass by reference
I thought I would post an example of using R.oo with inheritance and pass by
reference for future searches. With PerMore I am inheriting Person. Then I
am changing an object data memeber of an object of PerMore class using pass
by reference ('mimiced' by R.oo) in an object of AgeMultiplier. I change a
data member in the child class and the parent class for demonstration
purposes. This is
2003 Sep 18
1
2 time dependend states and probability transition matrix
Hi,
have got anybody experience or a starting
point for me, how i can program a function
which calculate me a probability transition matrix with a data.frame and two states.
I have some independend variable and a class variable
for two states - in example one from Jan2003 and the same variables from June2003.
Now i would like to calculate the probability that PERSON X change
from classA to
2012 Apr 13
0
Reference Class import() behaviour
Dear All,
In a project I've been working on we've been using Reference Classes
and grid extensively. However, something that I have come across is
that when using the import() method on refclass objects, it does not
work as expected with grid grobs and viewports.
I have prepared test cases that illustrate the point but the general
idea is that importing appears to work fine for
2013 Feb 06
1
[LLVMdev] Process the initializers of a C++ class properly
Hi,
I have been trying to get information from the initializers of a C++
class. For example if I have something like this:
classA { };
classB :public A {
float f;
public:
B(A& a) : A(a), f(3.14159) { }
};
I wold like to get the initialization values for each member. In this
example the values a and 3.14159 for the members A and f respectively.
What I have done so far is
2011 Sep 22
1
R.oo: do work on data member at construction
Hello,
I'd like to 'do work' on data members upon construction (i.e. without
implementing it in a get method). Is this the best way to create data member
'z' upon construction? I'm thinking if .z=paste(x,y) below gets more complex
I'll run into issues.
setConstructorS3("MyClass", function(x=NA,y=NA,...) {
this <- extend(Object(), "MyClass",
2007 Jul 12
11
Problem with "defined" keyword
Hi,
I''m running Puppet 0.23.0 on my servers, and i got something like this:
In a classa.pp file (included in site.pp):
class A {
file { "test1":
...
}
}
In a classb.pp file (included in site.pp):
class B {
file { "test2":
...
}
if defined(File["test1"]) {
... do things ...
}
if
2011 Jun 16
1
Question about R.oo package
Dear R.oo package users,
while testing some functionality of the R.oo, I found that during the first construction of a object from a class, the constructor is twice called, but only one object is finalized.
In all subsequent creation processes, the constructor is (expectedly) called once.
Here some example code:
library(R.oo)
setConstructorS3("Test_class",function(val) {
2003 Oct 27
1
Difficulties with R.oo (static fields, etc.)
I would like to use R.oo and tcltk to implement a Turtle World. I have
encountered
many problems because:
1) I am not sure how to implement static fields with R.oo
2) I am not sure how to implement a constructor that would
call a function only for the first instance of a class (i.e., to
initialize
value of static fields only once)
3) I am not sure how to remove/delete cleanly existing
2007 Dec 17
0
Extending data.frame
Hi,
I've got a long-running project whose data fits nicely into data.frame
objects in R. As I accumulate more and more functions, I decided to switch
to an OO approach so I can organize things better.
Looking around at the various approaches to OO R, I came across R.oo, which
seems nice.
Where I'm currently stuck is getting my objects to be mutable. For example,
in the following toy
Suggestion for exception handling: More informative error message for "no applicable method..." (S3)
2009 Oct 20
1
Suggestion for exception handling: More informative error message for "no applicable method..." (S3)
I'd like to suggest that whenever there is no S3 method implementation
available for a particular class, that the error message would also
report the class structure of the object dispatched on.
Example:
foo <- function(...) UseMethod("foo")
foo.ClassA <- function(object, ...) { cat("foo() for ClassA called.\n") }
> foo(structure(1, class="ClassA"))
2009 Jul 05
0
[LLVMdev] How to add an include file
On Sun, Jul 5, 2009 at 1:16 PM, David Minor<dahvid.minor at gmail.com> wrote:
> I'm writing a code transformation that involves adding an include to
> existing code, adding a base class
> to and existing class and then linking with a previously compiled library.
> The main problem for me
> seems to be how can I add the include? Can I compile the include alone to
> byte