Jadex 0.96

jadex.examples.hunterprey
Class Creature

java.lang.Object
  extended by jadex.examples.hunterprey.WorldObjectData
      extended by jadex.examples.hunterprey.WorldObject
          extended by jadex.examples.hunterprey.CreatureData
              extended by jadex.examples.hunterprey.Creature
All Implemented Interfaces:
Serializable, nuggets.INugget
Direct Known Subclasses:
HunterData, ObserverData, PreyData

public abstract class Creature
extends CreatureData

Editable Java class for concept Creature of hunterprey ontology.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface nuggets.INugget
nuggets.INugget.Helper
 
Field Summary
static String[] alldirs
          All possible directions.
 
Constructor Summary
Creature()
          Create a new Creature.
 
Method Summary
 Object clone()
          Clone the creature.
 Location createLocation(Location loc, String dir)
          Create a location.
 Location createLocation(String dir)
          Create a location.
 boolean equals(Object o)
          Test if two creatures are equal.
 String[] getDirections(Location a, Location b)
          Get the directions between two locations.
 String[] getDirections(WorldObject a)
          Get the directions between me and an object.
 String[] getDirections(WorldObject a, WorldObject b)
          Get the directions between two objects.
 int getDistance(Location a, Location b)
          Get the distance between two locations.
 int getDistance(WorldObject a)
          Get the distance between me and an object.
 int getDistance(WorldObject a, WorldObject b)
          Get the distance between two objects
 WorldObject getObject(Location loc, WorldObject[] objects)
          Get a world object at a specified location.
 String[] getPossibleDirections(WorldObject[] objects)
          Get all possible directions to move.
 int hashCode()
          Get the hash code of the creature.
 boolean isInVisionRange(Location a)
          Test if a location is in my vision range.
 boolean isNear(Location a, Location b, int range)
          Test if two locations are near Range is in all direction (including diagonals).
 void sortByDistance(WorldObject[] objects)
          Sort objects by distance.
 void sortByDistance(WorldObject[] objects, Location loc)
          Sort objects by distance.
 
Methods inherited from class jadex.examples.hunterprey.CreatureData
_persist, _set, getAge, getAID, getLeaseticks, getName, getPoints, getVisionRange, getWorldHeight, getWorldWidth, setAge, setAID, setLeaseticks, setName, setPoints, setVisionRange, setWorldHeight, setWorldWidth, toString
 
Methods inherited from class jadex.examples.hunterprey.WorldObjectData
getLocation, setLocation
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

alldirs

public static final String[] alldirs
All possible directions.

Constructor Detail

Creature

public Creature()
Create a new Creature.

Method Detail

equals

public boolean equals(Object o)
Test if two creatures are equal.

Overrides:
equals in class WorldObject

hashCode

public int hashCode()
Get the hash code of the creature.

Overrides:
hashCode in class WorldObject

clone

public Object clone()
Clone the creature.

Overrides:
clone in class Object

createLocation

public Location createLocation(String dir)
Create a location.

Parameters:
dir - The direction.
Returns:
The new location.

createLocation

public Location createLocation(Location loc,
                               String dir)
Create a location.

Parameters:
loc - The location.
dir - The direction.
Returns:
The new location.

getDistance

public int getDistance(WorldObject a)
Get the distance between me and an object.

Returns:
The number of moves required to move between the objects

getDistance

public int getDistance(WorldObject a,
                       WorldObject b)
Get the distance between two objects

Returns:
The number of moves required to move between the objects

getDistance

public int getDistance(Location a,
                       Location b)
Get the distance between two locations.

Returns:
The number of moves required to move between the locations.

isNear

public boolean isNear(Location a,
                      Location b,
                      int range)
Test if two locations are near Range is in all direction (including diagonals).


isInVisionRange

public boolean isInVisionRange(Location a)
Test if a location is in my vision range.


getDirections

public String[] getDirections(WorldObject a)
Get the directions between me and an object.

Returns:
The possible directions to move nearer to the 2nd object.

getDirections

public String[] getDirections(WorldObject a,
                              WorldObject b)
Get the directions between two objects.

Returns:
The possible directions to move nearer to the 2nd object.

getDirections

public String[] getDirections(Location a,
                              Location b)
Get the directions between two locations.

Returns:
The possible directions to move nearer to the 2nd location.

sortByDistance

public void sortByDistance(WorldObject[] objects)
Sort objects by distance.


sortByDistance

public void sortByDistance(WorldObject[] objects,
                           Location loc)
Sort objects by distance.


getObject

public WorldObject getObject(Location loc,
                             WorldObject[] objects)
Get a world object at a specified location.

Parameters:
loc - The location.
Returns:
The object at the location.

getPossibleDirections

public String[] getPossibleDirections(WorldObject[] objects)
Get all possible directions to move.

Parameters:
objects - The objects near.
Returns:
The objects one can move to.

Jadex 0.96

Submit a bug or feature
For further API reference and developer documentation, see the Jadex User Guide and the Jadex Tutorial. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, and working code examples.

Copyright (C) 2002-2007 Lars Braubach, Alexander Pokahr - University of Hamburg. Use is subject to license terms.