|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectsema.Element
An element is the basic world entity.
They are every thing in the world (excepted the immaterial things, such as: the Nature, the Signal and the Element.ElementEvent).
The Element class is principaly meant to implement inanimate things of the world,
in the meanwhile, the Agent extends the possibilities of an element.
The elements have the encapsulated basic event : Element.ElementEvent which provides basic functionalities.
| Nested Class Summary | |
protected class |
Element.ElementEvent
Mother class for the event of an element. |
| Field Summary | |
java.lang.Integer |
id
ID (in a world, there is unicity of the ID). |
World |
world
World in which is this element. |
| Constructor Summary | |
Element(World world,
Area area,
java.awt.Image image)
Constructs an element of the specified world and register itself to this world. |
|
| Method Summary | |
boolean |
canTake(Element e)
Determinates whether the given element can take this one. |
int |
compareTo(java.lang.Object o)
Used to compare two elements. |
protected void |
death()
Death of the element. |
void |
draw()
Draws the element. |
Area |
getArea()
Returns the Area. |
float |
getDrawingPriority()
Returns the drawing priority. |
float |
getHeight()
Returns the height of the element. |
javax.swing.Icon |
getIcon()
Returns the associated icon. |
java.awt.Image |
getImage()
Returns the main image. |
java.lang.String |
getKind()
Returns the kind of the element for example : "ant". |
java.lang.String |
getName()
Returns the name. |
java.lang.String[][] |
getProperties()
Returns the element's properties. |
void |
highlight()
|
void |
highlight(java.awt.Color c)
Highlights the element (used to draw that the element is selected in the interface). |
boolean |
isMarked()
Returns whether the element is marked. |
boolean |
kill(Element killer)
Tries to kill this element by the specified one. |
protected void |
setDrawingPriority(float priority)
Sets the drawing priority The world elements are drawn by growing priority, so that the element with the greatest priority is finally on the top and entirely visible. |
protected void |
setHeight(float h)
Sets the height of the element. |
protected void |
setKind(java.lang.String s)
Sets the kind of the element for example : "ant". |
void |
setMarked(boolean b)
Sets the marked property. |
void |
setProperties(java.lang.String property,
java.lang.String value)
Tries to set the value to the property of the element. |
java.lang.String |
toString()
Returns the String representing the element. |
static java.lang.String[][] |
union(java.lang.String[][] p1,
java.lang.String[][] p2)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public final World world
public final java.lang.Integer id
| Constructor Detail |
public Element(World world,
Area area,
java.awt.Image image)
world - the world which it have to register to.area - the area of it's 'body'.image - the main image of the element : used as an identity icon.Area| Method Detail |
public float getDrawingPriority()
Drawingprotected void setDrawingPriority(float priority)
priority - the drawing priority.public float getHeight()
protected void setHeight(float h)
h - the height of the element.public java.lang.String getKind()
protected void setKind(java.lang.String s)
s - the kind of the element.public java.lang.String getName()
public java.awt.Image getImage()
Element(World world, Area area, Image image)public Area getArea()
Areapublic boolean canTake(Element e)
e - the element wanting to take this one.
protected void death()
public boolean kill(Element killer)
killer - the element trying to kill this one.
public void draw()
Drawingpublic void highlight(java.awt.Color c)
public void highlight()
public void setMarked(boolean b)
b - the marked property.public boolean isMarked()
public javax.swing.Icon getIcon()
Iconpublic java.lang.String[][] getProperties()
Engine.getProperties()
public static java.lang.String[][] union(java.lang.String[][] p1,
java.lang.String[][] p2)
public void setProperties(java.lang.String property,
java.lang.String value)
property - the property to change.value - the new value for the property.Engine.setProperties(java.lang.String, java.lang.String)public java.lang.String toString()
public int compareTo(java.lang.Object o)
compareTo in interface java.lang.Comparableo - the element to compare to this one.
Comparable
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||