| setClass {methods} | R Documentation |
Create a class definition and return a generator function to create objects from the class. Typical usage will be of the style:
myClass <- setClass("myClass", slots= ...., contains =....)
where the first argument is the name of the new class and, if supplied, the arguments
slots=
and contains=
specify the slots
in the new class and existing classes from which the new class
should inherit. Calls to setClass()
are normally found in the
source of a package; when the package is loaded the class will be
defined in the package's namespace. Assigning the generator
function with the name of the class is convenient for users, but
not a requirement.
setClass(Class, representation, prototype, contains=character(), validity, access, where, version, sealed, package, S3methods = FALSE, slots)
Class |
character string name for the class. |
slots |
The names and classes for the slots in the new class. This argument
must be supplied by name, The argument must be vector with a names attribute, the names being those of the slots in
the new class. Each element of the vector specifies an
existing class; the corresponding slot must be from this class
or a subclass of it. Usually, this is a character vector
naming the classes. It's also legal for the elements of the
vector to be class representation objects, as returned by As a limiting
case, the argument may be an unnamed character
vector; the elements are taken as slot names and all slots have
the unrestricted class |
contains |
A vector specifying existing classes from which
this class should inherit. The new class will have all the slots
of the superclasses, with the same requirements on the classes
of these slots. This argument
must be supplied by name, See the section ‘Virtual Classes’ for the special
superclass |
prototype, where, validity, sealed, package |
These arguments are currently allowed, but either they are unlikely to be useful or there are modern alternatives that are preferred.
|
representation, access, version, S3methods |
All these arguments are deprecated from version 3.0.0 of R and should be avoided.
|
A generator function suitable for creating objects from the class is
returned, invisibly. A call to this function generates a call to
new
for the class. The call takes any number of arguments,
which will be passed on to the initialize method. If no
initialize
method is defined for the class or one of its
superclasses, the default method expects named arguments with the
name of one of the slots and unnamed arguments that are objects from
one of the contained classes.
Typically the generator function is assigned the name of the class,
for programming clarity. This is not a requirement and objects
from the class can also be generated directly from
new
. The advantages of the generator function are a
slightly simpler and clearer call, and that the call will contain
the package name of the class (eliminating any ambiguity if two
classes from different packages have the same name).
If the class is virtual, an attempt to generate an object from
either the generator or new()
will result in an error.
The two essential arguments other than the class name are
slots
and contains
, defining the explicit slots
and the inheritance (superclasses). Together, these arguments define
all the information in an object from this class; that is, the names
of all the slots and the classes required for each of them.
The name of the class determines which methods apply directly to objects from this class. The superclass information specifies which methods apply indirectly, through inheritance. See Methods_Details for inheritance in method selection.
The slots in a class definition will be the union of all the slots
specified directly by slots
and all the slots in all
the contained classes.
There can only be one slot with a given name.
A class may override the definition of a slot with a given name, but
only if the newly specified class is a subclass of the
inherited one.
For example, if the contained class had a slot a
with class
"ANY"
, then a subclass could specify a
with class
"numeric"
,
but if the original specification for the slot was class
"character"
, the new call to setClass
would generate an error.
Slot names "class"
and "Class"
are not allowed.
There are other slot names with a special meaning; these names start with
the "."
character. To be safe, you should define all of
your own slots with names starting with an alphabetic character.
Some inherited classes will be treated specially—object types, S3 classes and a few special cases—whether inherited directly or indirectly. See the next three sections.
Classes exist for which no actual objects can be created, the virtual classes.
The most common and useful form of virtual class is the class
union, a virtual class that is defined in a call to
setClassUnion()
rather than a call to
setClass()
.
This call lists the members of the union—subclasses
that extend the new class.
Methods that are written with the class union in the signature
are eligible for use with objects from any of the member classes.
Class
unions can include as members classes whose
definition is otherwise sealed, including basic R data types.
Calls to setClass()
will also create a virtual class,
either when only the Class
argument is supplied (no slots
or superclasses) or when the contains=
argument includes
the special class name "VIRTUAL"
.
In the latter case, a
virtual class may include
slots to provide some common behavior without fully defining
the object—see the class traceable
for an
example.
Note that "VIRTUAL"
does not carry over to subclasses; a
class that contains a virtual class is not itself automatically virtual.
In addition to containing other S4 classes, a class definition can
contain either an S3 class (see the next section) or a built-in R pseudo-class—one
of the R
object types or one of the special R pseudo-classes "matrix"
and
"array"
.
A class can contain at most one of the object types, directly or indirectly.
When it does, that contained class determines the “data part”
of the class.
This appears as a pseudo-slot, ".Data"
and can be treated as a
slot but actually determines
the type of objects from this slot.
Objects from the new class try to inherit the built in
behavior of the contained type.
In the case of normal R data types, including vectors, functions and
expressions, the implementation is relatively straightforward.
For any object x
from the class,
typeof(x)
will be the contained basic type; and a special
pseudo-slot, .Data
, will be shown with the corresponding class.
See the "numWithId"
example below.
Classes may also inherit from "vector"
, "matrix"
or
"array"
.
The data part of these objects can be any vector data type.
For an object from any class that does not contain one of these
types or classes,
typeof(x)
will be "S4"
.
Some R data types do not behave normally, in the sense that they are
non-local references or other objects that are not duplicated.
Examples include those corresponding to classes "environment"
, "externalptr"
, and "name"
.
These can not be the types for objects with user-defined
classes (either S4 or S3) because setting an attribute overwrites the
object in all contexts.
It is possible to define a class that inherits from such types,
through an indirect mechanism that stores the inherited object in a
reserved slot, ".xData"
.
See the
example for class "stampedEnv"
below.
An object from such a class does not have a ".Data"
pseudo-slot.
For most computations, these classes behave transparently as if they
inherited directly from the anomalous type.
S3 method dispatch and the relevant as.
type()
functions should behave correctly, but code that uses the type of the
object directly will not.
For example, as.environment(e1)
would work as expected with the
"stampedEnv"
class, but typeof(e1)
is "S4"
.
Old-style S3 classes have no formal definition. Objects are “from” the class when their class attribute contains the character string considered to be the class name.
Using such classes with formal classes and methods is necessarily a
risky business, since there are no guarantees about the content of the
objects or about consistency of inherited methods.
Given that, it is still possible to define a class that inherits from
an S3 class, providing that class has been registered as an old class
(see setOldClass
).
Broadly speaking, both S3 and S4 method dispatch try to behave
sensibly with respect to inheritance in either system.
Given an S4 object, S3 method dispatch and the inherits
function should use the S4 inheritance information.
Given an S3 object, an S4 generic function will dispatch S4 methods
using the S3 inheritance, provided that inheritance has been declared via
setOldClass
. For details, see setOldClass
and Section 10.8 of the reference.
Class definitions normally belong to packages (but can be defined in
the global environment as well, by evaluating the expression on the
command line or in a file sourced from the command line).
The corresponding package name is part of the class definition; that
is, part of the classRepresentation
object holding that
definition. Thus, two classes with the same name can exist in
different packages, for most purposes.
When a class name is supplied for a slot or a superclass in a call to
setClass
, a
corresponding class definition will be found, looking from the
namespace of the current package, assuming the call in question appears directly in the source for the
package, as it should to avoid ambiguity.
The class definition
must be already defined in this package, in the imports directives of
the package's DESCRIPTION
and
NAMESPACE
files or in the basic classes defined by the methods package.
(The ‘methods’ package must be included in the imports directives
for any package that uses
S4 methods and classes, to satisfy the
"CMD check"
utility.)
If a package imports two classes of the same name from separate packages, the packageSlot
of the name
argument needs to be set to the package name of the
particular class.
This should be a rare occurrence.
Chambers, John M. (2016) Extending R, Chapman & Hall. (Chapters 9 and 10.)
Classes_Details
for a general discussion of classes,
Methods_Details
for an analogous discussion of methods,
makeClassRepresentation
## A simple class with two slots track <- setClass("track", slots = c(x="numeric", y="numeric")) ## an object from the class t1 <- track(x = 1:10, y = 1:10 + rnorm(10)) ## A class extending the previous, adding one more slot trackCurve <- setClass("trackCurve", slots = c(smooth = "numeric"), contains = "track") ## an object containing a superclass object t1s <- trackCurve(t1, smooth = 1:10) ## A class similar to "trackCurve", but with different structure ## allowing matrices for the "y" and "smooth" slots setClass("trackMultiCurve", slots = c(x="numeric", y="matrix", smooth="matrix"), prototype = list(x=numeric(), y=matrix(0,0,0), smooth= matrix(0,0,0))) ## A class that extends the built-in data type "numeric" numWithId <- setClass("numWithId", slots = c(id = "character"), contains = "numeric") numWithId(1:3, id = "An Example") ## inherit from reference object of type "environment" stampedEnv <- setClass("stampedEnv", contains = "environment", slots = c(update = "POSIXct")) setMethod("[[<-", c("stampedEnv", "character", "missing"), function(x, i, j, ..., value) { ev <- as(x, "environment") ev[[i]] <- value #update the object in the environment x@update <- Sys.time() # and the update time x}) e1 <- stampedEnv(update = Sys.time()) e1[["noise"]] <- rnorm(10)


Primate Safari (9 Days)
Queen Elizabeth NP, Kibale NP, Bwindi impenetrable NP and Lake Mburo NP
This safari will take you through Queen Elizabeth NP with the dense forests of Kibale NP and Bwindi impenetrable NP and Lake Mburo NP. Giving you a wonderful wildlife viewing and unforgettable encounters with the primates of Uganda.
Day 1: Arrival
Arrival at Entebbe Airport where you will be welcomed by a Grey Horizons’ experienced driver guide and transferred to the hotel in Kampala.
Day 2: KAMPALA - KIBALE FOREST NATIONAL PARK
After a relaxed breakfast we will depart Entebbe and head west to Fort Portal, with (packed) lunch en route. Fort Portal rests in the shadow of the fabled “Mountains of the Moon” and is famous for the many tea plantations. From this lovely town we will continue to Kibale National Park, while passing the region of the Crater Lakes. Here we will explore some small lakes, before heading to our accommodation for the night. Meal Plan: Full Board.
Day 3: KIBALE FOREST & BIGODI SWAMP
Kibale Forest is reputable for having the greatest variety and highest concentration of primates in East Africa. You will therefore enjoy a guided nature walk in the tropical rainforest in search of the wild chimpanzee, red-tailed monkey, black-and-white colobus monkey and many others. After a hearty lunch we transfer to the Bigodi Swamp for another, totally different nature walk. The Bigodi Swamp Walk is an initiative of the local community and is known for its rich diversity of birds and primates. Meal Plan: Full Board.
Day 4: KIBALE FOREST - QUEEN ELIZABETH NATIONAL PARK
After a delicious breakfast we calmly transfer to Queen Elizabeth National Park. Have lunch and relax at the pool before going on a game drive in search of the first wildlife, including warthogs, buffaloes, waterbucks and elephants. Meal Plan: Full Board.
Day 5: QUEEN ELIZABETH NATIONAL PARK
The day begins early as we start with a morning game drive and head to the mating ground of the Uganda Kobs. We search for lions, elephants, buffaloes and other wild animals in their natural habitat before returning for lunch. In the afternoon we take on a boat cruise along the Kazinga Channel, a natural channel between Lake Edward and Lake George. The abundant birdlife is sighted, and the elephants, buffaloes and hundreds of hippos that are cooling off at the shores, this cruise will definitely be one of the highlights of your safari. Meal Plan: Full Board .
Day 6: QUEEN ELIZABETH - BWINDI NATIONAL PARK
After breakfast we head towards the south, to a place called Ishasha famous for the tree climbing lions. After a short game drive in this area we continue to Bwindi. While driving through a verdant countryside, you will pass traditional homesteads and enjoy panoramic views. In the afternoon arrival in Bwindi National Park, home of the endangered mountain gorillas. Meal Plan: Full Board .
Day 7: GORILLA TRACKING
The highlight of your safari: a meeting with the gentle giants of Bwindi! Especially hikers will love the tracking in the beautiful ecosystem of the park. Expect to walk a long distance before you encounter any gorillas. But it will definitely be worthwhile as you observe them closely while they eat, play and rest. A unique and unforgettable experience!
Those who prefer not to participate in the gorilla tracking can go for a guided forest walk or explore the surroundings with the Buhoma Village Walk. Meal Plan: Full Board.
Day 8: BWINDI - LAKE MBURO NATIONAL PARK
After breakfast we depart the impenetrable forest of Bwindi and head to Lake Mburo National Park. As we enter the park it is likely that you will spot some wildlife.  Have an early dinner before going on a night game drive in an open safari vehicle with spot light. This special game drive of 2-3 hours provides 30% chances of seeing the elusive leopard and of course other nocturnal animals. Meal Plan: Full Board.
Day 9: LAKE MBURO NATIONAL PARK - ENTEBBE
Early start of the day as we will go for a nature walk guided by a ranger. Lake Mburo is the only national park where you can experience a safari on foot. Return the lodge for breakfast and with a game drive on our way out we depart the protected area and drive back to Entebbe through Kampala. You will be transferred to Entebbe Airport for your international flight.
End of tour.


|
Clothoids
Clothoids: a library for line, circle, clothoids and more
|
Class to manage AABB tree. More...
#include <AABBtree.hxx>
Public Types | |
| typedef BBox const * | PtrBBox |
| typedef AABBtree * | PtrAABB |
| typedef pair< PtrBBox, PtrBBox > | PairPtrBBox |
| typedef vector< PtrBBox > | VecPtrBBox |
| typedef vector< PairPtrBBox > | VecPairPtrBBox |
Public Member Functions | |
| void | clear () |
| initialized AABB tree | |
| bool | empty () const |
| check if AABB tree is empty | |
| void | bbox (real_type &xmin, real_type &ymin, real_type &xmax, real_type &ymax) const |
| void | build (vector< PtrBBox > const &bboxes) |
| build AABB tree given a list of bbox More... | |
| void | print (ostream_type &stream, int level=0) const |
| template<typename COLLISION_fun > | |
| bool | collision (AABBtree const &tree, COLLISION_fun ifun, bool swap_tree=false) const |
| void | intersect (AABBtree const &tree, VecPairPtrBBox &intersectionList, bool swap_tree=false) const |
| void | min_distance (real_type x, real_type y, VecPtrBBox &candidateList) const |
Class to manage AABB tree.
| void G2lib::AABBtree::build | ( | vector< PtrBBox > const & | bboxes | ) |
build AABB tree given a list of bbox
pBBox = make_shared<BBox>( bboxes, 0, 0 );
|
inline |
Check if two AABB tree collide
| [in] | tree | an AABB tree that is used to check collision |
| [in] | ifun | function the check if the contents of two bbox (curve) collide |
| [in] | swap_tree | if true exchange the tree in computation |
| void G2lib::AABBtree::intersect | ( | AABBtree const & | tree, |
| VecPairPtrBBox & | intersectionList, | ||
| bool | swap_tree = false |
||
| ) | const |
Compute all the intersection of AABB trees
| [in] | tree | an AABB tree that is used to check collision |
| [out] | intersectionList | list of pair bbox that overlaps |
| [in] | swap_tree | if true exchange the tree in computation |


Fail the build if v1
or v2
is empty or null
.
By default the empty string or null
is treated as the lowest version and will not fail the build.
I.e.:
null
compared to null
== 0
== 0
null
compared to empty == 0
null
or empty compared to anything == -1
null
or empty == 1


The Voyages of Doctor Dolittle
by Hugh Lofting
Part 5, Chapter 3: Fire
Additional Information
- Year Published: 1922
- Language: English
- Country of Origin: England
- Source: Lofting, H. (1922). The Voyages of Doctor Dolittle. London, England: Lippincott Publishing.
-
Readability:
- Flesch–Kincaid Level: 4.2
- Word Count: 1,027
- Genre: Fantasy
- Keywords: 20th century literature, british literature, children's literature
- ✎ Cite This
Downloads
Then the Doctor asked Long Arrow if he knew what fire was, explaining it to him by pictures drawn on the buckskin table-cloth. Long Arrow said he had seen such a thing—coming out of the tops of volcanoes; but that neither he nor any of the Popsipetels knew how it was made.
"Poor perishing heathens!" muttered Bumpo. "No wonder the old chief died of cold!"
At that moment we heard a crying sound at the door. And turning round, we saw a weeping Indian mother with a baby in her arms. She said something to the Indians which we could not understand; and Long Arrow told us the baby was sick and she wanted the white doctor to try and cure it.
"Oh Lord!" groaned Polynesia in my ear—"Just like Puddleby: patients arriving in the middle of dinner. Well, one thing: the food's raw, so nothing can get cold anyway."
The Doctor examined the baby and found at once that it was thoroughly chilled.
"Fire—FIRE! That's what it needs," he said turning to Long Arrow—"That's what you all need. This child will have pneumonia if it isn't kept warm."
"Aye, truly. But how to make a fire," said Long Arrow—"where to get it: that is the difficulty. All the volcanoes in this land are dead."
Then we fell to hunting through our pockets to see if any matches had survived the shipwreck. The best we could muster were two whole ones and a half—all with the heads soaked off them by salt water.
"Hark, Long Arrow," said the Doctor: "divers ways there be of making fire without the aid of matches. One: with a strong glass and the rays of the sun. That however, since the sun has set, we cannot now employ. Another is by grinding a hard stick into a soft log—Is the daylight gone without?—Alas yes. Then I fear we must await the morrow; for besides the different woods, we need an old squirrel's nest for fuel—And that without lamps you could not find in your forests at this hour."
"Great are your cunning and your skill, oh White Man," Long Arrow replied. "But in this you do us an injustice. Know you not that all fireless peoples can see in the dark? Having no lamps we are forced to train ourselves to travel through the blackest night, lightless. I will despatch a messenger and you shall have your squirrel's nest within the hour."
He gave an order to two of our boy-servants who promptly disappeared running. And sure enough, in a very short space of time a squirrel's nest, together with hard and soft woods, was brought to our door.
The moon had not yet risen and within the house it was practically pitch-black. I could feel and hear, however, that the Indians were moving about comfortably as though it were daylight. The task of making fire the Doctor had to perform almost entirely by the sense of touch, asking Long Arrow and the Indians to hand him his tools when he mislaid them in the dark. And then I made a curious discovery: now that I had to, I found that I was beginning to see a little in the dark myself. And for the first time I realized that of course there is no such thing as pitch-dark, so long as you have a door open or a sky above you.
Calling for the loan of a bow, the Doctor loosened the string, put the hard stick into a loop and began grinding this stick into the soft wood of the log. Soon I smelt that the log was smoking. Then he kept feeding the part that was smoking with the inside lining of the squirrel's nest, and he asked me to blow upon it with my breath. He made the stick drill faster and faster.  And at last the darkness about us was suddenly lit up. The squirrel's nest had burst into flame.
The Indians murmured and grunted with astonishment. At first they were all for falling on their knees and worshiping the fire. Then they wanted to pick it up with their bare hands and play with it. We had to teach them how it was to be used; and they were quite fascinated when we laid our fish across it on sticks and cooked it. They sniffed the air with relish as, for the first time in history, the smell of fried fish passed through the village of Popsipetel.
Then we got them to bring us piles and stacks of dry wood; and we made an enormous bonfire in the middle of the main street. Round this, when they felt its warmth, the whole tribe gathered and smiled and wondered. It was a striking sight, one of the pictures from our voyages that I most frequently remember: that roaring jolly blaze beneath the black night sky, and all about it a vast ring of Indians, the firelight gleaming on bronze cheeks, white teeth and flashing eyes—a whole town trying to get warm, giggling and pushing like school-children.
In a little, when we had got them more used to the handling of fire, the Doctor showed them how it could be taken into their houses if a hole were only made in the roof to let the smoke out. And before we turned in after that long, long, tiring day, we had fires going in every hut in the village.
The poor people were so glad to get really warm again that we thought they'd never go to bed. Well on into the early hours of the morning the little town fairly buzzed with a great low murmur: the Popsipetels sitting up talking of their wonderful pale-faced visitor and this strange good thing he had brought with him—FIRE!


Appearance
Delia Ketchum is a slender woman with fair skin and brown eyes (which Ash inherited). Unlike her son (who has messy and spiky black hair), Delia has sleek brown hair, which she usually braids into a ponytail with a green hair tie. She usually wears a pink short-sleeved jacket, yellow tank top, purple skirt, and light green shoes, although her outfits vary.
While doing housework, Delia wears a light yellow T-shirt, pink apron, blue jeans (later replaced by a green dress), and orange shoes. However, she sometimes wears a straw hat and a purple skirt from her usual outfit.
When she saw Ash compete in the Indigo League and Joto League, Delia wore a blue dress with a white short-sleeved jacket and shoes. While on vacation in Alola, she wore an orange strapless dress with pink circles on the chest, a pink belt with a gold buckle, a pink flower, and white frills. She also wore a white coat, as well as a matching sun hat and pink sandals.
While sleeping, Delia wears yellow pajamas.


Original Work
A youtube video using iframe
An image using object tag
An audio using audio tag
Your browser does not support the audio element.
A video using video tag:
Your browser does not support the video tag.
Where I'm from
An RSS Feed


Don’t worry, it happens. Enter your email below and we’ll send you a link to access your account.
Please contact<EMAIL_ADDRESS>to reset the password
Well that was easy! We’ve sent an email to {{sentEmail}}. If you don’t hear from us in the next few minutes take a look in your Junk or Spam folders. Still no luck? Send an email to support and we’ll fix it right away.
Looks like something went wrong. Send an email to support and we’ll fix it right away.
Request sucessfully submitted. An email has been sent to<EMAIL_ADDRESS>check your e-mail for the link to reset your password. If you don't receive the email, please check your junk or spam mail folders.