Displaying 20 results from an estimated 41 matches for "testclass".
2007 Apr 04
4
[LLVMdev] For a small help
...all help for creating an instruction that calls
e member method of an object. I suppose that this is not a headache
but I am impatient in learning :) I would be very thankful if you can
show me an example snippet code that does this in LLVM. Below is
described my case.
Let's say I have a class TestClass
class TestClass
{
int testMethod(int a);
}
and I want to create a call instruction that calls
obj.testMethod(input) where obj is an instance of TestClass
TestClass obj; // I have this declared prior
int input = 1; // I have declared prior
int output; // I have this declared prior too
output...
2007 Apr 04
0
[LLVMdev] For a small help
...uction that calls
> e member method of an object. I suppose that this is not a headache
> but I am impatient in learning :) I would be very thankful if you can
> show me an example snippet code that does this in LLVM. Below is
> described my case.
>
> Let's say I have a class TestClass
>
> class TestClass
> {
> int testMethod(int a);
> }
>
> and I want to create a call instruction that calls
> obj.testMethod(input) where obj is an instance of TestClass
>
> TestClass obj; // I have this declared prior
> int input = 1; // I have declared prio...
2009 Apr 12
1
Simple class with an automatic printing issue
I don't understand the following behavior for a simple S3 class. The
auto-printing at the command line
doesn't behave as I expect. I'm probably missing something, but it might be
a bug.
> print.testClass <- function(x, ...) cat("Class:", class(x), ":", x, "\n")
> structure(1, class = "testClass")
Class: testClass : 1
> print(1 * structure(1, class = "testClass"))
Class: testClass : 1
> 1 * structure(1, class = "testClass") #...
2009 Sep 15
2
S3 objects in S4 slots
...r vectors. tm (version 0.5) saves corpora as
lists with a class attribute of c("VCorpus", "Corpus", "list"). I
don't actually need the class-specific attributes, I only care about
the list itself.
Here's a simplified example of my problem:
> setClass("testclass", representation(slot="list"))
[1] "testclass"
> a = list(a="1", b="2")
> class(a) = c("VCorpus", "Corpus", "list") # same as corpora in tm v0.5
> x = new("testclass", slot=a)
Error in validObject(.Object)...
2011 Feb 03
2
Creating a reference class object from a class definition in a package fails
Hi,
I'm trying to create a package that contains reference class
definitions from which users can create reference objects, but there
seems to be something awry.
My toy example creates an empty package via
package.skeleton('TestClass') to which I add the following R code:
TestClass <- setRefClass('TestClass',fields=c('name'))
Unfortunately my R console output bears this:
> library(TestClass)
> TestClass$new(name='foo')
Error: attempt to apply non-function
> getRefClass('TestClass...
2010 Oct 28
2
Reference Classes: Generalizing Reference Class Generator objects?
...ence class
generator? I have tried adding a "new" method to the methods of the
class, but that is obviously not correct. I have also tried adding it to
the class generator, but the class generator still uses the default
constructor.
As a simple example, this is the current interface:
TestClass <- setRefClass ("TestClass",
fields = list (text = "character"),
methods = list (
print = function () {cat(text)})
)
test <- TestClass$new (text="Hello World")
test$print()
I would like to override $new(...) to be something li...
2012 Aug 23
1
[LLVMdev] Error: "Recursive compilation" when run lli
I edit two files named test.h,test.cpp as follow:
///////////////test.h////////////////////////////////////////////////////////////////class TestClass
{
private:
int fTotal;
public:
TestClass();
~TestClass();
};///////////test.cpp/////////////////////////////////////////////////////////////////////////////#include "test.h"
TestClass::TestClass()
{
fTotal = 2;
}
TestClass::~TestClass()
{
fTotal = 3;
}
int main()
{
TestClass short...
2012 Dec 12
1
Lost in S4 and S3 classes
...ost some of the guidelines.
Anyway this is my problem:
Version:
R version 2.15.2 (2012-10-26)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
I want to make an S4 class that use the output object of the function of nls.lm as a slot:
setOldClass("nls.lm")
setClass (
Class="TestClass",
representation=representation(
lmOutput = "nls.lm",
anumeric = "numeric"
)
)
Now, if I want to call this class in a "constructor function" I can do something like this (correct?):
myConstructor <- function()
{
return(new("TestCla...
2010 May 12
1
slot assignment in S4 classes
...ds,
I'm still studying S4 classes and I have a question about slot assignment. Why would I have to use a special setter method [example 2 below] if I can assign data to a slot directly when I call new() [example 1 below]?
## first way to do it (the idiosyncratic way?)
setClass(Class = "TestClass", representation = representation(myDf = "data.frame"))
setGeneric(name = "doStuff", def = function(object, ...){standardGeneric("doStuff")})
setMethod(f = "doStuff",
signature = "TestClass",
definition = function(object, ...) {
retu...
2007 Apr 04
0
[LLVMdev] For a small help
...ruction that calls
> e member method of an object. I suppose that this is not a headache
> but I am impatient in learning :) I would be very thankful if you can
> show me an example snippet code that does this in LLVM. Below is
> described my case.
>
> Let's say I have a class TestClass
>
> class TestClass
> {
> int testMethod(int a);
> }
>
> and I want to create a call instruction that calls
> obj.testMethod(input) where obj is an instance of TestClass
>
> TestClass obj; // I have this declared prior
> int input = 1; // I have declared prior
&...
2007 Apr 05
2
[LLVMdev] For a small help
On 4 Apr 2007, at 20:10, Jeff Cohen wrote:
> […]
> %obj = alloca %struct.TestClass, align 1 ; <%struct.TestClass*>
> [#uses=1]
> %tmp1 = call int %_ZN9TestClass10testMethodEi( %struct.TestClass* %
> obj, int 1 ) ; <int> [#uses=0]
> ret void
> }
>
> declare int %_ZN9TestClass10testMethodEi(%struct.TestClass*, int)
The name mangling is not v...
2010 Dec 08
2
S4 "["-method called twice - why?
Dear list,
When playing around with the "[" method for S4 classes I noticed that it gets called twice in my example.
setClass("testClass",
representation(a="character"))
setMethod("[", signature(x = "testClass", i = "ANY", j="ANY"),
function (x, i, j, ..., drop){
print("void function")
}
)
> x <- new("testClass")
>...
2013 Oct 16
1
Internally accessing ref class methods with .self$x is different from .self[['x']]
...e former copies the function
to the object's environment (with some attributes attached), and the
latter just return NULL (unless it has already been accessed once with
.self$x). Is this how it's supposed to work?
Here's an example that illustrates: https://gist.github.com/wch/7013262
TestClass <- setRefClass(
'TestClass',
fields = list(a = 'ANY'),
methods = list(
initialize = function() {
e <- environment()
pe <- parent.env(e)
ppe <- parent.env(pe)
# The environment of this object
print(ls(pe))
# The environment o...
2012 Feb 02
1
possibly Error in R version 2.12.1 (2010-12-16)
Hi,
the following Code demonstrates an possibly Error in R
(or you can explain me, why this happens, thanks in advance)
Code:
#####################################
testClass <- function( stackData= c())
{
list(
write= function( ...)
{
sChain= ""
for( s in c( stackData, ...))
{
sChain= paste( sChain, '"', sub( '"', '\\\\"', s), '"', sep, sep='')
}
write( sChain, fHandle, a...
2010 Dec 20
2
.Rd file for S4-method warning
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt.
Name: nicht verf?gbar
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20101220/d04ff621/attachment.pl>
2012 May 03
1
deparse(substitute(x)) on an object with S3 class
Dear list,
can someone explain to me why deparse(substitute(x)) does not seem to work
when x is of a user-defined S3 class?
In my actual problem, my print method is part of a package, and the method
is registered in the NAMESPACE, if that should make a difference.
> print.testclass <- function(x,...){
xname <- deparse(substitute(x))
cat("Your object name is",xname,"\n")
}
testlist <- list()
testlist[[1]] <- 1:10
class(testlist) <- "testclass"
# This does not work as expected:
> testlist
Your object name is structure(list...
2012 Feb 22
3
Error 400 on SERVER: Cannot append, variable node_data is defined in this scope at
Hi,
I have an problem that I can''t get resolved. I have an hash like
www.krzywanski.net/archives/703.
With this hash i whould like the add some extra hashes before passing to
the module, i have tryed the code below.
node testnode {
class { ''testclass'':
nodes_data => {
''node1'' => { ''server'' => ''node1.some.domain.com'', ''port'' =>
''2560'' },
''node2'' => { ''server'' =&g...
2011 Jun 08
1
Reference Class error message: may be caused by lazy evaluation?
...be found in defined method without using
.self, this make it difficulty that sometimes in my initialize method, I
need to call other method defined in the same reference class, the
workaround for this is add .sef to it.
############### example begin ############################
setRefClass("testclass", fields = list(a = "numeric"),
methods = list(
addOne = function(){
a <<- a+1
print(a)
},
add = function(){
addOne()
},
show = function(){...
2012 Aug 24
0
[LLVMdev] what is "Recursive compilation detected" error?
I edit two files named test.h,test.cpp as follow:
///////////////test.h////////////////////////////////////////////////////////////////
class TestClass
{
private:
int fTotal;
public:
TestClass();
~TestClass();
};
///////////test.cpp/////////////////////////////////////////////////////////////////////////////
#include "test.h"
TestClass::TestClass()
{
fTotal = 2;
}
TestClass::~TestClass()
{
fTotal = 3;
}
int main()
{
TestClass sho...
2007 Apr 05
0
[LLVMdev] For a small help
Luc Bourhis wrote:
> On 4 Apr 2007, at 20:10, Jeff Cohen wrote:
>
>
>> […]
>> %obj = alloca %struct.TestClass, align 1 ; <%struct.TestClass*>
>> [#uses=1]
>> %tmp1 = call int %_ZN9TestClass10testMethodEi( %struct.TestClass* %
>> obj, int 1 ) ; <int> [#uses=0]
>> ret void
>> }
>>
>> declare int %_ZN9TestClass10testMethodEi(%struct.TestClass*, int)...