Class Creature
- java.lang.Object
- 
- jadex.bdi.examples.hunterprey_classic.WorldObject
- 
- jadex.bdi.examples.hunterprey_classic.Creature
 
 
- 
 public abstract class Creature extends WorldObject Editable Java class for concept Creature of hunterprey ontology.
- 
- 
Field SummaryFields Modifier and Type Field Description protected intageThe age of the creature (in simulation steps).protected IComponentIdentifieraidAgent identifier of the creature.static java.lang.String[]alldirsAll possible directions.protected intleaseticksThe number of simulation ticks, this creature is considered alive.protected java.lang.StringnameUnique name for this creature.protected intpointsAttribute for slot points.protected intvisionrangeThe distance a creature is able to see.protected intworldheightThe height of the world.protected intworldwidthThe width of the world.- 
Fields inherited from class jadex.bdi.examples.hunterprey_classic.WorldObjectlocation
 
- 
 - 
Constructor SummaryConstructors Constructor Description Creature()Create a new Creature.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Clone the creature.LocationcreateLocation(Location loc, java.lang.String dir)Create a location.LocationcreateLocation(java.lang.String dir)Create a location.booleanequals(java.lang.Object o)Test if two creatures are equal.intgetAge()Get the age of this Creature.IComponentIdentifiergetAID()Get the aid of this Creature.java.lang.String[]getDirections(Location a, Location b)Get the directions between two locations.java.lang.String[]getDirections(WorldObject a)Get the directions between me and an object.java.lang.String[]getDirections(WorldObject a, WorldObject b)Get the directions between two objects.intgetDistance(WorldObject a)Get the distance between me and an object.intgetDistance(WorldObject a, WorldObject b)Get the distance between two objectsintgetLeaseticks()Get the leaseticks of this Creature.intgetLocationDistance(Location a, Location b)Get the distance between two locations.java.lang.StringgetName()Get the name of this Creature.WorldObjectgetObject(Location loc, WorldObject[] objects)Get a world object at a specified location.intgetPoints()Get the points of this Creature.java.lang.String[]getPossibleDirections(WorldObject[] objects)Get all possible directions to move.intgetVisionRange()Get the visionrange of this Creature.intgetWorldHeight()Get the world-height of this Creature.intgetWorldWidth()Get the world-width of this Creature.inthashCode()Get the hash code of the creature.booleanisInVisionRange(Location a)Test if a location is in my vision range.booleanisNear(Location a, Location b, int range)Test if two locations are near Range is in all direction (including diagonals).voidsetAge(int age)Set the age of this Creature.voidsetAID(IComponentIdentifier aid)Set the aid of this Creature.voidsetLeaseticks(int leaseticks)Set the leaseticks of this Creature.voidsetName(java.lang.String name)Set the name of this Creature.voidsetPoints(int points)Set the points of this Creature.voidsetVisionRange(int visionrange)Set the visionrange of this Creature.voidsetWorldHeight(int worldheight)Set the world-height of this Creature.voidsetWorldWidth(int worldwidth)Set the world-width of this Creature.voidsortByDistance(WorldObject[] objects)Sort objects by distance.voidsortByDistance(WorldObject[] objects, Location loc)Sort objects by distance.voidupdate(Creature creature)Update the creature.- 
Methods inherited from class jadex.bdi.examples.hunterprey_classic.WorldObjectgetLocation, setLocation, toString
 
- 
 
- 
- 
- 
Field Detail- 
alldirspublic static final java.lang.String[] alldirs All possible directions.
 - 
ageprotected int age The age of the creature (in simulation steps).
 - 
pointsprotected int points Attribute for slot points.
 - 
nameprotected java.lang.String name Unique name for this creature.
 - 
aidprotected transient IComponentIdentifier aid Agent identifier of the creature.
 - 
visionrangeprotected int visionrange The distance a creature is able to see.
 - 
worldwidthprotected int worldwidth The width of the world.
 - 
worldheightprotected int worldheight The height of the world.
 - 
leaseticksprotected int leaseticks The number of simulation ticks, this creature is considered alive.
 
- 
 - 
Method Detail- 
getAgepublic int getAge() Get the age of this Creature. The age of the creature (in simulation steps).- Returns:
- age
 
 - 
setAgepublic void setAge(int age) Set the age of this Creature. The age of the creature (in simulation steps).- Parameters:
- age- the value to be set
 
 - 
getPointspublic int getPoints() Get the points of this Creature.- Returns:
- points
 
 - 
setPointspublic void setPoints(int points) Set the points of this Creature.- Parameters:
- points- the value to be set
 
 - 
getNamepublic java.lang.String getName() Get the name of this Creature. Unique name for this creature.- Returns:
- name
 
 - 
setNamepublic void setName(java.lang.String name) Set the name of this Creature. Unique name for this creature.- Parameters:
- name- the value to be set
 
 - 
getAIDpublic IComponentIdentifier getAID() Get the aid of this Creature. Agent identifier of the creature.- Returns:
- aid
 
 - 
setAIDpublic void setAID(IComponentIdentifier aid) Set the aid of this Creature. Agent identifier of the creature.- Parameters:
- aid- the value to be set
 
 - 
getVisionRangepublic int getVisionRange() Get the visionrange of this Creature. The distance a creature is able to see.- Returns:
- visionrange
 
 - 
setVisionRangepublic void setVisionRange(int visionrange) Set the visionrange of this Creature. The distance a creature is able to see.- Parameters:
- visionrange- the value to be set
 
 - 
getWorldWidthpublic int getWorldWidth() Get the world-width of this Creature. The width of the world.- Returns:
- world-width
 
 - 
setWorldWidthpublic void setWorldWidth(int worldwidth) Set the world-width of this Creature. The width of the world.- Parameters:
- worldwidth- the value to be set
 
 - 
getWorldHeightpublic int getWorldHeight() Get the world-height of this Creature. The height of the world.- Returns:
- world-height
 
 - 
setWorldHeightpublic void setWorldHeight(int worldheight) Set the world-height of this Creature. The height of the world.- Parameters:
- worldheight- the value to be set
 
 - 
getLeasetickspublic int getLeaseticks() Get the leaseticks of this Creature. The number of simulation ticks, this creature is considered alive.- Returns:
- leaseticks
 
 - 
setLeasetickspublic void setLeaseticks(int leaseticks) Set the leaseticks of this Creature. The number of simulation ticks, this creature is considered alive.- Parameters:
- leaseticks- the value to be set
 
 - 
equalspublic boolean equals(java.lang.Object o) Test if two creatures are equal.- Overrides:
- equalsin class- WorldObject
 
 - 
hashCodepublic int hashCode() Get the hash code of the creature.- Overrides:
- hashCodein class- WorldObject
 
 - 
clonepublic java.lang.Object clone() Clone the creature.- Overrides:
- clonein class- java.lang.Object
 
 - 
createLocationpublic Location createLocation(java.lang.String dir) Create a location.- Parameters:
- dir- The direction.
- Returns:
- The new location.
 
 - 
createLocationpublic Location createLocation(Location loc, java.lang.String dir) Create a location.- Parameters:
- loc- The location.
- dir- The direction.
- Returns:
- The new location.
 
 - 
getDistancepublic int getDistance(WorldObject a) Get the distance between me and an object.- Returns:
- The number of moves required to move between the objects
 
 - 
getDistancepublic int getDistance(WorldObject a, WorldObject b) Get the distance between two objects- Returns:
- The number of moves required to move between the objects
 
 - 
getLocationDistancepublic int getLocationDistance(Location a, Location b) Get the distance between two locations.- Returns:
- The number of moves required to move between the locations.
 
 - 
isNearpublic boolean isNear(Location a, Location b, int range) Test if two locations are near Range is in all direction (including diagonals).
 - 
isInVisionRangepublic boolean isInVisionRange(Location a) Test if a location is in my vision range.
 - 
getDirectionspublic java.lang.String[] getDirections(WorldObject a) Get the directions between me and an object.- Returns:
- The possible directions to move nearer to the 2nd object.
 
 - 
getDirectionspublic java.lang.String[] getDirections(WorldObject a, WorldObject b) Get the directions between two objects.- Returns:
- The possible directions to move nearer to the 2nd object.
 
 - 
getDirectionspublic java.lang.String[] getDirections(Location a, Location b) Get the directions between two locations.- Returns:
- The possible directions to move nearer to the 2nd location.
 
 - 
sortByDistancepublic void sortByDistance(WorldObject[] objects) Sort objects by distance.
 - 
sortByDistancepublic void sortByDistance(WorldObject[] objects, Location loc) Sort objects by distance.
 - 
getObjectpublic WorldObject getObject(Location loc, WorldObject[] objects) Get a world object at a specified location.- Parameters:
- loc- The location.
- Returns:
- The object at the location.
 
 - 
getPossibleDirectionspublic java.lang.String[] getPossibleDirections(WorldObject[] objects) Get all possible directions to move.- Parameters:
- objects- The objects near.
- Returns:
- The objects one can move to.
 
 - 
updatepublic void update(Creature creature) Update the creature.
 
- 
 
-