barsuift.simLife.tree
Class BasicTreeLeaf
java.lang.Object
java.util.Observable
barsuift.simLife.tree.BasicTreeLeaf
- All Implemented Interfaces:
- IObservable, LivingPart, TreeLeaf
public class BasicTreeLeaf
- extends java.util.Observable
- implements TreeLeaf
| Methods inherited from class java.util.Observable |
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
BasicTreeLeaf
public BasicTreeLeaf(Universe universe,
TreeLeafState leafState)
getId
public java.lang.Long getId()
- Specified by:
getId in interface LivingPart
spendTime
public void spendTime()
- Make the leaf older than it was.
Concretely, it means :
- age : reduce the efficiency by 5 percent and send a notifying message of LeafUpdateCode.age
- collect solar energy : add energy based on sun luminosity and leaf efficiency
- if the leaf is too weak :
- fall : send a notifying message of LeafUpdateCode.fall
else :
- use energy : improve the leaf efficiency by using the collected energy
- Specified by:
spendTime in interface LivingPart
isTooWeak
public boolean isTooWeak()
- Return true if the leaf efficiency is lower than the lowest acceptable value
- Specified by:
isTooWeak in interface TreeLeaf
getEfficiency
public Percent getEfficiency()
- Specified by:
getEfficiency in interface TreeLeaf
getEnergy
public java.math.BigDecimal getEnergy()
- Specified by:
getEnergy in interface TreeLeaf
collectFreeEnergy
public java.math.BigDecimal collectFreeEnergy()
- Specified by:
collectFreeEnergy in interface TreeLeaf
getAge
public int getAge()
- Specified by:
getAge in interface LivingPart
getTreeLeaf3D
public TreeLeaf3D getTreeLeaf3D()
- Specified by:
getTreeLeaf3D in interface TreeLeaf
getState
public TreeLeafState getState()
- Specified by:
getState in interface TreeLeaf
hashCode
public int hashCode()
- Overrides:
hashCode in class java.lang.Object
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals in class java.lang.Object
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
Copyright © 2010. All Rights Reserved.