barsuift.simLife.tree
Class BasicTreeLeaf

java.lang.Object
  extended by java.util.Observable
      extended by barsuift.simLife.tree.BasicTreeLeaf
All Implemented Interfaces:
IObservable, LivingPart, Persistent<State>, TreeLeaf

public class BasicTreeLeaf
extends java.util.Observable
implements TreeLeaf


Constructor Summary
BasicTreeLeaf(Universe universe, TreeLeafState leafState)
           
 
Method Summary
 java.math.BigDecimal collectFreeEnergy()
           
 int getAge()
           
 java.math.BigDecimal getEfficiency()
           
 java.math.BigDecimal getEnergy()
           
 TreeLeafState getState()
           
 TreeLeaf3D getTreeLeaf3D()
           
 boolean isTooWeak()
          Return true if the leaf efficiency is lower than the lowest acceptable value
 void spendTime()
          Make the leaf older than it was.
 void synchronize()
           
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface barsuift.simLife.IObservable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 

Constructor Detail

BasicTreeLeaf

public BasicTreeLeaf(Universe universe,
                     TreeLeafState leafState)
Method Detail

spendTime

public void spendTime()
Make the leaf older than it was.

Concretely, it means :

  1. reduce the efficiency by 5 percent
  2. collect solar energy : add energy based on sun luminosity and leaf efficiency
  3. if the leaf is too weak, then fall, else, use collected energy to improve the leaf efficiency

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 java.math.BigDecimal 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 Persistent<State>

synchronize

public void synchronize()
Specified by:
synchronize in interface Persistent<State>


Copyright © 2010. All Rights Reserved.