Agent-class: An S4 class to represent an agent.

Description Usage Arguments Methods (by generic) Slots See Also Examples

Description

An S4 class to represent an agent.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## S4 method for signature 'Agent'
getLocation(object)

## S4 method for signature 'Agent'
getVelocity(object)

## S4 method for signature 'Agent'
getActive(object)

## S4 method for signature 'Agent'
setLocation(object, location)

## S4 method for signature 'Agent'
setVelocity(object, velocity)

## S4 method for signature 'Agent'
setActive(object, active)

Arguments

object

An object of class "Agent"

location

A numerical vector of length 2 specifying the x- and y-position of the object [Default: c(0, 0)].

velocity

A numerical vector of length 2 specifying the velocity in the x- and y-direction of the object [Default: c(0, 0)].

active

A length-one logical vector indicating whether the object is active (TRUE) or not (FALSE) [Default: TRUE].

Methods (by generic)

Slots

location

A numerical vector of length 2 specifying the x- and y-position of the object [Default: c(0, 0)].

velocity

A numeric vector for specifying the object's velocity, where the first value specifies the velocity in the x-direction and the second in the y-direction [Default: c(0.0, 0.0)].

active

A length-one logical vector indicating whether the object is active [Default: TRUE].

See Also

validAgentObject, initialize,Agent-method

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
a <- new("Agent")
print(a)
a <- initialize(a,
                location = c(1.23, 10.5),
                velocity = c(5 * sqrt(2), 5 * sqrt(2)),
                active = FALSE)
validAgentObject(a)
print(a)
is.object(a)
isS4(a)

mverouden/rsfour documentation built on May 25, 2019, 5:01 a.m.