org.jscience.biology.lsystems.growing
Class LSystem

java.lang.Object
  extended by org.jscience.biology.lsystems.growing.LSystem

public class LSystem
extends java.lang.Object

This class represents an LSystem as we know it in text form. It can read values from a file and store them in this class. The file must respect some definitions: All codewords listed in the Def class must stand at the beginning of the line and be written in the right case. As separator to the value only the specified symbol may be used. The order of the lines does not matter. Lines which do not begin with a codeword are ignored. White spaces may be used or not. See the design for an exact description on the keywords.

Example:

 name = Red
 depth = 12
 angle = 22.5
 thickness = 0.3
 decrement = 0.025
 length = 0.8
 branch = brown
 leaf = green
 flower = red
 scale = 0.3
 

axiom = (a,0)

rule = (a,0) -> (b,5) rule = (b,1) -> [////(b,4)][&////(c,4)]^////(c,4) rule = (b,0) -> [&&&{-^ff&+ff+&ff^-|-ff+ff+ff}]//////[&&&{-^ff&+ff+&ff^-|-ff+ff+ff}]//////[&&&{-^ff&+ff+&ff^-|-ff+ff+ff}] rule = (c,1) -> (z,2)[&////(d,3)]^////(d,3) rule = (c,2) -> [&&&{-^ff&+ff+&ff^-|-ff+ff+ff}]///////&&&{-^ff&+ff+&ff^-|-ff+ff+ff} rule = (d,2) -> (z,1)[&////(e,2)]^////(e,2) rule = (d,2) -> [&&&{-^f&+f+&f^-|-f+f+f}]/////[&&&{-^f&+f+&f^-|-f+f+f}]/////[&&&{-^f&+f+&f^-|-f+f+f}] rule = (e,3) -> [&&&{!-f++f-|-f++f}]//[&&{!-f++f-|-f++f}]//[&&&{!-f++f-|-f++f}]//[&&{!-f++f-|-f++f}]//[&&&{!-f++f-|-f++f}]//[&&{!-f++f-|-f++f}]//[&&&{!-f++f-|-f++f}]//[&&{!-f++f-|-f++f}] rule = (z,2) -> //[&&{!-f++f-|-f++f}]//[&&&{!-f++f-|-f++f}]//[&&{!-f++f-|-f++f}]////[&&{!-f++f-|-f++f}]//[&&&{!-f++f-|-f++f}]//[&&{!-f++f-|-f++f}]


Constructor Summary
LSystem(java.io.File fileLsy)
          Constructor.
 
Method Summary
 float getAngle()
          Gets the angle of the LSystem
 java.lang.String getAxiom()
          Returns the axiom of this class.
 javax.media.j3d.Appearance getBranchAppearance()
          DOCUMENT ME!
 float getDecrement()
          Gets the value of decrenentation of the thickness of a branch.
 int getDepth()
          Gets the derivation depth for the LSystem.
 javax.media.j3d.Appearance getFlowerAppearance()
          DOCUMENT ME!
 javax.media.j3d.Appearance getLeafAppearance()
          DOCUMENT ME!
 float getLength()
          Gets the length of the branch at beginning.
 java.lang.String getName()
          Gets the name of the plant.
 java.util.Vector getRules()
          Gets the rules of the plant.
 float getScale()
          Gets the value of decrenentation of the thickness of a branch.
 float getThickness()
          Get the thickness of the branch at beginning.
 javax.media.j3d.Appearance makeAppearance(java.lang.String strColor)
          Makes a new appearance object with the string name of a color.
 void setAngle(float fAngle)
          Sets the angle for the LSystem to the member field.
 void setAxiom(java.lang.String strAxiom)
          Stores the new axiom for this class.
 void setDepth(int iDepth)
          Sets the derivation depth for the LSystem.
 void setName(java.lang.String strName)
          Gets the name of the plant.
 void setRules(java.util.Vector vRules)
          Gets the name of the plant.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LSystem

public LSystem(java.io.File fileLsy)
        throws java.lang.Exception
Constructor. Initializes the member variables, reads the values for the LSystem from a file and stores them in the member fields. Note that the values have to be declared in a certain manner defined in this class.

Parameters:
fileLsy - The file to extract and store.
Throws:
java.lang.Exception
Method Detail

makeAppearance

public javax.media.j3d.Appearance makeAppearance(java.lang.String strColor)
Makes a new appearance object with the string name of a color.

Parameters:
strColor - The color name as string.
Returns:
The appearance of the specified color.

setDepth

public void setDepth(int iDepth)
Sets the derivation depth for the LSystem.

Parameters:
iDepth - The depth to set.

getDepth

public int getDepth()
Gets the derivation depth for the LSystem.

Returns:
The depth.

setAngle

public void setAngle(float fAngle)
Sets the angle for the LSystem to the member field.

Parameters:
fAngle - The new value for the angle.

getAngle

public float getAngle()
Gets the angle of the LSystem

Returns:
The angle of the system

setAxiom

public void setAxiom(java.lang.String strAxiom)
Stores the new axiom for this class.

Parameters:
strAxiom - The new axiom to set.

getAxiom

public java.lang.String getAxiom()
Returns the axiom of this class.

Returns:
The axiom.

getThickness

public float getThickness()
Get the thickness of the branch at beginning.

Returns:
The thickness of the branch.

getLength

public float getLength()
Gets the length of the branch at beginning.

Returns:
The length of the branches.

getDecrement

public float getDecrement()
Gets the value of decrenentation of the thickness of a branch.

Returns:
The decrementation value.

getScale

public float getScale()
Gets the value of decrenentation of the thickness of a branch.

Returns:
The scale value.

getName

public java.lang.String getName()
Gets the name of the plant.

Returns:
The name.

setName

public void setName(java.lang.String strName)
Gets the name of the plant.


getRules

public java.util.Vector getRules()
Gets the rules of the plant.

Returns:
The name.

setRules

public void setRules(java.util.Vector vRules)
Gets the name of the plant.


getBranchAppearance

public javax.media.j3d.Appearance getBranchAppearance()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getLeafAppearance

public javax.media.j3d.Appearance getLeafAppearance()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getFlowerAppearance

public javax.media.j3d.Appearance getFlowerAppearance()
DOCUMENT ME!

Returns:
DOCUMENT ME!