RepastHPC  2.3.1
Public Member Functions | List of all members
repast::relogo::AbstractRelogoAgent Class Referenceabstract

Abstract base class for turtles and patches. More...

#include <AbstractRelogoAgent.h>

Inheritance diagram for repast::relogo::AbstractRelogoAgent:
repast::relogo::RelogoAgent repast::Agent repast::relogo::Patch repast::relogo::Turtle

Public Member Functions

 AbstractRelogoAgent (AgentId id, Observer *observer)
 
virtual int pxCor () const =0
 Gets the patch x coordinate of the agent's location. More...
 
virtual int pyCor () const =0
 Gets the patch y coordinate of the agent's location. More...
 
template<typename AgentType >
void inRadius (AgentSet< RelogoAgent > &inSet, double radius, AgentSet< AgentType > &outSet) const
 Gets all the agents in the inSet within the specified radius for this RelogoAgent and put them in the outSet. More...
 
template<typename PatchType >
PatchType * patchAt (double dx, double dy) const
 Gets the patch at direction dx, dy from the this agent. More...
 
template<typename AgentType >
void turtlesHere (AgentSet< AgentType > &set) const
 Gets all the turtles on this turtle's patch and puts them into the specifed set. More...
 
template<typename AgentType >
AgentSet< AgentType > turtlesHere () const
 Gets all the turtles on this turtle's patch and returns them in an AgentSet. More...
 
template<typename PatchType >
PatchType * patchAtHeadingAndDistance (float heading, double distance)
 Gets the patch at the specified heading and distance from this patch or turtle. More...
 
template<typename AgentType >
void turtlesOn (AgentSet< AgentType > &out) const
 Gets the turtles that are on this patch or if this is a Turtle get the turtles that are on the patch this turtle is on. More...
 
template<typename AgentType >
AgentSet< AgentType > turtlesOn () const
 Gets the turtles that are on this patch or if this is a Turtle get the turtles that are on the patch this turtle is on. More...
 
- Public Member Functions inherited from repast::relogo::RelogoAgent
 RelogoAgent (repast::AgentId id, Observer *observer)
 Creates a RelogoAgent with the specified id and managed by the specified Observer. More...
 
virtual repast::AgentIdgetId ()
 Gets the id of this RelogoAgent. More...
 
virtual const repast::AgentIdgetId () const
 Gets the const id of this RelogoAgent. More...
 
Point< double > location () const
 Gets the location of this RelogoAgent. More...
 
virtual void hatchCopy ()
 If this ReLogo agent is 'hatched', makes an appropriate copy, setting instance variables as appropriate.
 
double xCor () const
 Gets the x coordinate of the agent's location. More...
 
double yCor () const
 Gets the y coordinate of the agent's location. More...
 
double distance (RelogoAgent *obj) const
 Gets the distance from this RelogoAgent to the specified agent. More...
 
double distancexy (double x, double y) const
 Gets the distance from this RelogoAgent to the specified point. More...
 

Additional Inherited Members

- Protected Attributes inherited from repast::relogo::RelogoAgent
Observer_observer
 
Point< double > _location
 
repast::AgentId _id
 

Detailed Description

Abstract base class for turtles and patches.

This contains some methods that can apply to either.

Member Function Documentation

◆ inRadius()

template<typename AgentType >
void repast::relogo::AbstractRelogoAgent::inRadius ( AgentSet< RelogoAgent > &  inSet,
double  radius,
AgentSet< AgentType > &  outSet 
) const

Gets all the agents in the inSet within the specified radius for this RelogoAgent and put them in the outSet.

Parameters
inSetthe set of agents to test if they are withinthe radius
Template Parameters
thetype of agents to include in the outSet

◆ patchAt()

template<typename PatchType >
PatchType * repast::relogo::AbstractRelogoAgent::patchAt ( double  dx,
double  dy 
) const

Gets the patch at direction dx, dy from the this agent.

If the resulting location is outside of the world, this returns 0.

Parameters
dxthe distance from the caller along the x dimension
dythe distance from the caller along the y dimension
Template Parameters
thetype of the Patch
Returns
the patch at that distance from this Turtle, or 0 if the resulting location is outside of the world.

◆ patchAtHeadingAndDistance()

template<typename PatchType >
PatchType * repast::relogo::AbstractRelogoAgent::patchAtHeadingAndDistance ( float  heading,
double  distance 
)

Gets the patch at the specified heading and distance from this patch or turtle.

Parameters
headingthe heading
distancethe distance
Template Parameters
PatchTypethe patch's type

◆ pxCor()

virtual int repast::relogo::AbstractRelogoAgent::pxCor ( ) const
pure virtual

Gets the patch x coordinate of the agent's location.

Returns
the patch x coordinate

Implements repast::relogo::RelogoAgent.

Implemented in repast::relogo::Turtle, and repast::relogo::Patch.

◆ pyCor()

virtual int repast::relogo::AbstractRelogoAgent::pyCor ( ) const
pure virtual

Gets the patch y coordinate of the agent's location.

Returns
the patch y coordinate

Implements repast::relogo::RelogoAgent.

Implemented in repast::relogo::Turtle, and repast::relogo::Patch.

◆ turtlesHere() [1/2]

template<typename AgentType >
AgentSet< AgentType > repast::relogo::AbstractRelogoAgent::turtlesHere

Gets all the turtles on this turtle's patch and returns them in an AgentSet.

Template Parameters
AgentTypethe type of turtles to get
Returns
an AgentSet containing all the turtles on this turtles patch.

◆ turtlesHere() [2/2]

template<typename AgentType >
void repast::relogo::AbstractRelogoAgent::turtlesHere ( AgentSet< AgentType > &  set) const

Gets all the turtles on this turtle's patch and puts them into the specifed set.

Parameters
setthe set to put the found turtles in
Template Parameters
AgentTypethe type of turtles to get

◆ turtlesOn() [1/2]

template<typename AgentType >
AgentSet< AgentType > repast::relogo::AbstractRelogoAgent::turtlesOn

Gets the turtles that are on this patch or if this is a Turtle get the turtles that are on the patch this turtle is on.

Template Parameters
AgentTypethe type of turtle
Returns
an AgentSet containing all the turtles that are on the patch the caller is on.

◆ turtlesOn() [2/2]

template<typename AgentType >
void repast::relogo::AbstractRelogoAgent::turtlesOn ( AgentSet< AgentType > &  out) const

Gets the turtles that are on this patch or if this is a Turtle get the turtles that are on the patch this turtle is on.

Template Parameters
AgentTypethe type of turtle
Parameters
outthe turtles will be put in out

The documentation for this class was generated from the following files: