de.grogra.grogra
Class LSystem

java.lang.Object
  extended by de.grogra.graph.impl.Edge
      extended by de.grogra.graph.impl.Node
          extended by de.grogra.rgg.RGG
              extended by de.grogra.grogra.LSystem
All Implemented Interfaces:
Manageable, PersistenceCapable, Shareable, RegistryContext, Selectable, UserFields, XObject, Map, java.io.Serializable

public class LSystem
extends RGG

See Also:
Serialized Form

Nested Class Summary
 class LSystem.Apply
           
 
Nested classes/interfaces inherited from class de.grogra.graph.impl.Node
Node.AccessorBridge, Node.FieldAttributeAccessor, Node.NType
 
Nested classes/interfaces inherited from interface de.grogra.util.Map
Map.Chain
 
Field Summary
static Node.NType $TYPE
           
 float angle
           
static Node.NType.Field angle$FIELD
           
 Node currentNode
          Contains the current node which matched the left hand side of a rule, or which is the current node of an arithmetical-structural computation.
protected  float[] defaultValuesForLocalRegisters
           
 int generation
           
static Node.NType.Field generation$FIELD
           
 float r0
          Contains the value of GROGRA's register 0.
 float r1
          Contains the value of GROGRA's register 1.
 float r2
          Contains the value of GROGRA's register 2.
 float r3
          Contains the value of GROGRA's register 3.
 float r4
          Contains the value of GROGRA's register 4.
 float r5
          Contains the value of GROGRA's register 5.
 float r6
          Contains the value of GROGRA's register 6.
 float r7
          Contains the value of GROGRA's register 7.
 float r8
          Contains the value of GROGRA's register 8.
 float r9
          Contains the value of GROGRA's register 9.
 
Fields inherited from class de.grogra.rgg.RGG
classesToIgnoreOrConsider$FIELD, consider$FIELD, doRun$FIELD, GROUP_TYPE, I18N, initialTurtleState, initialTurtleState$FIELD, STEPRUN
 
Fields inherited from class de.grogra.graph.impl.Node
ADDITIONAL_FIELDS, bits, DELETED, EXTENT_BIT, EXTENT_MASK, extentIndex$FIELD, extentTail$FIELD, HAS_OBSERVERS, IS_INTERPRETIVE, isInterpretive$FIELD, LAST_EXTENT_INDEX, layer$FIELD, MARK, mark$FIELD, MIME_TYPE, MIN_UNUSED_SPECIAL_OF_SOURCE, MIN_UNUSED_SPECIAL_OF_TARGET, name$FIELD, USED_BITS
 
Fields inherited from interface de.grogra.util.Map
DEFAULT_VALUE, EMPTY_MAP
 
Constructor Summary
LSystem()
           
 
Method Summary
protected  void assignLocalRegister(int no, float value)
          Go back to the next shoot with the given localregisterno and assign the given value
protected  void assignLocalRegisterAdd(int no, float value)
          Go back to the next shoot with the given localregisterno and add the given value
protected  void assignLocalRegisterMul(int no, float value)
          Go back to the next shoot with the given localregisterno and multiply the given value
protected  void assignReferenceShoot(int no, float value)
          Go to the reference shoot (select by function21) and assign the localregisterno with the given value
protected  void assignReferenceShootAdd(int no, float value)
          Go to the reference shoot (select by function21) and add the localregisterno with the given value
protected  void assignReferenceShootMul(int no, float value)
          Go to the reference shoot (select by function21) and multiply the localregisterno with the given value
static float atan(float x)
           
static float atg(float x)
           
static LSystem current()
           
 float currentLength()
          The GROGRA variable of type "length" returns the length of the associated shoot of the currentNode if generative rules are active, or the value of length of the current turtle state if interpretative rules are active.
 float currentXcoordinate()
          Returns the global x-coordinate of the tip of the associated shoot of the currentNode.
 float currentYcoordinate()
          Returns the global y-coordinate of the tip of the associated shoot of the currentNode.
 float currentZcoordinate()
          Returns the global z-coordinate of the tip of the associated shoot of the currentNode.
 void derivation()
           
static float exp(float x)
           
static float floor(float x)
           
 float function1(double minLength)
           
static float function10(float x)
           
static float function11(float n, float k, float b, float c2, float d)
           
static float function12(float i, float age)
           
static float function13(double xl, double xf)
          GROGRA function 13 Calculation of number of lateral buds from shoot length
 float function15(int color)
           
 float function2(double minLength, int color)
           
 float function20(int color)
           
 float function21(int color)
           
 float function3()
          GROGRA function 3 computes the sum of the parameter values of the turtle states of all Shoots emerging from the currentNode.
 float function30(float arg1, float arg2, float arg3)
          Auxilliary function for control purposes.
 float function31(float arg1, float arg2, float arg3)
           
 float function32(float arg1, float arg2, float arg3)
           
 float function33(float arg1, float arg2, float arg3)
           
 float function34(float arg1, float arg2, float arg3)
           
 float function35(float arg1, float arg2, float arg3)
           
 float function36(float arg1, float arg2, float arg3)
           
 float function37(float arg1, float arg2, float arg3)
           
 float function38(float arg1, float arg2, float arg3)
           
 float function39(float arg1, float arg2, float arg3)
           
 float function4(double alpha, double minLength)
           
 float function5(double alpha)
           
 float function6()
          GROGRA function 6 computes the sum of the carbon values of the turtle states of all Shoots emerging from the currentNode.
 float function7()
          GROGRA function 7 computes the angle (in degrees) between the global z-direction and the local z-direction of the currentNode.
 float function8(int color)
           
 float function9(double alpha, double minleng, int co)
           
static LSystem get(Registry r)
           
 int getGenerationNo()
           
protected  float getLocalRegisterValue(int no)
          Method is called, when the value of a localregister is needed
protected  Node.NType getNTypeImpl()
          This method returns the Node.NType which describes the managed fields of the class of this node.
 Shoot getRefShoot()
           
 Dataset getShootPopulation()
           
protected  void initializeApplyMenu(Item d, boolean flat, boolean useRunCheckBox)
           
protected  void initializeRunMenu(Item d, boolean flat, boolean useRunCheckBox)
           
 void interpretation()
           
static float log(float x)
           
static float max(float a, float b)
           
 void method1()
          Computated the distribution of assimilate in a simple plant-model.
 void method10()
          Interface to branch library of TRAGIC++ (BITOEK, XI/1998)
 void method12()
          Writes all carbon-values of shoots with the color 14 to method12.dat
 void method30()
          Auxiliary method for control purposes: Scans through the whole structure, finds trees, whorls and branches.
 void method31()
           
 void method32()
          Creates boxes for every branch and calculates different kind of information of shoots, which belong to different boxes.
 void method33()
           
 void method34()
           
 void method35()
           
 void method36()
           
 void method37()
           
 void method38()
           
 void method39()
           
 void method4()
          Write the current-structure in a binary-file strutemp.dat.
 void method40()
           
 void method41()
           
 void method42()
           
 void method43()
           
 void method44()
           
static float min(float a, float b)
           
protected  Node newInstance()
          This method returns a new instance of the class of this node.
static float normal(float mu, float sigma)
          Returns a pseudorandom number which is distributed according to a normal distribution with mean value mu and standard deviation sigma.
 void patternMatched(RGGProducer prod)
          Invoked after a pattern of a rule has matched, but before the right-hand side of the rule is executed.
static float random()
          Returns a pseudo-random number which is uniformly distributed between 0 and 1.
protected  void reset()
          This method can be invoked to reset the RGG to its initial state.
static int round(float x)
           
protected  void shutdown()
          This method is invoked when an RGG instance is unloaded within GroIMP.
static float sqr(float x)
           
static float sqrt(float x)
           
protected  void startup()
          This method is invoked when an RGG instance is loaded within GroIMP.
 void sumdGenerator(VoidConsumer c)
          This generator method yields void for every daughter shoot of the associated shoot of the currentNode.
 void sumGenerator(VoidConsumer c)
          This generator method yields void for every shoot of the subtree starting at the associated shoot of the currentNode.
 void sumpGenerator(VoidConsumer c)
          This generator method yields void for every shoot in the path from the associated shoot of the currentNode downwards to the root.
static float uniform(float min, float max)
          Returns a pseudo-random number which is uniformly distributed between min and max.
 
Methods inherited from class de.grogra.rgg.RGG
addTask, applyInterpretation, consider, getMainRGG, getRate, getRegistry, getRGGForTypeMap, getRoot, getSolver, getTasks, ignore, init, initializeTurtleState, integrate, integrate, interpret, invokeInit, isAutoClearMonitors, isMainRGG, left, monitor, monitor, monitorPeriodic, readChannelAt, readChannelAt, readChannelAt, right, run, runLater, runLater, setAutoClearMonitors, setSolver, setSolver, shutdown, solveTasks, startup, stop, toSelection, unmonitor
 
Methods inherited from class de.grogra.graph.impl.Node
addEdgeBitsTo, addReference, appendBranchNode, appendBranchNode, appendReferencesTo, clone, clone, cloneGraph, dump, dumpTree, dup, dupUnmanagedFields, edgeChanged, fieldModified, findAdjacent, get, getAccessor, getAccessor, getAttributes, getAxisParent, getBoolean, getBranch, getBranchLength, getBranchNode, getBranchTail, getByte, getChar, getCommonAncestor, getCurrentGraphState, getDirectChildCount, getDouble, getEdgeAttributeAccessor, getEdgeAttributes, getEdgeBitsTo, getEdgeTo, getExtentIndex, getFirst, getFirstEdge, getFloat, getGraph, getId, getIndex, getInstantiator, getInt, getLayer, getLong, getManageableType, getName, getNeighbor, getNext, getNType, getObject, getOrCreateEdgeTo, getOrNull, getPersistenceManager, getPredecessor, getProvider, getShort, getSource, getStamp, getSuccessor, getSymbol, getSymbolColor, getTarget, getTransaction, getUserField, getUserFieldCount, getXClass, getXData, hasName, initProvider, initXClass, insertBranchNode, insertBranchNode, instantiateGraph, isAncestorOf, isDirection, isManagingInstance, isMarked, isRoot, isSource, isTarget, manageableReadResolve, manageableWriteReplace, paramString, removeAll, removeEdgeBitsTo, removeFromChain, removeFromChain, removeReference, setBranch, setBranch, setExtentIndex, setGraphForDeserialization, setLayer, setMark, setName, setSuccessor, setSuccessor, specialEdgeAdded, specialEdgeRefModified, specialEdgeRemoved, toString, writeReplace
 
Methods inherited from class de.grogra.graph.impl.Edge
addEdgeBits, getBitMark, getEdgeBits, getObjectMark, getSpecialEdgeDescriptor, parseEdgeKeys, remove, removeEdgeBits, setBitMark, setEdgeBits, setObjectMark, testEdgeBits
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.grogra.persistence.PersistenceCapable
getBitMark, getObjectMark, setBitMark, setObjectMark
 

Field Detail

$TYPE

public static final Node.NType $TYPE

angle

public float angle

angle$FIELD

public static final Node.NType.Field angle$FIELD

currentNode

public Node currentNode
Contains the current node which matched the left hand side of a rule, or which is the current node of an arithmetical-structural computation.


defaultValuesForLocalRegisters

protected float[] defaultValuesForLocalRegisters

generation

public int generation

generation$FIELD

public static final Node.NType.Field generation$FIELD

r0

public float r0
Contains the value of GROGRA's register 0.


r1

public float r1
Contains the value of GROGRA's register 1.


r2

public float r2
Contains the value of GROGRA's register 2.


r3

public float r3
Contains the value of GROGRA's register 3.


r4

public float r4
Contains the value of GROGRA's register 4.


r5

public float r5
Contains the value of GROGRA's register 5.


r6

public float r6
Contains the value of GROGRA's register 6.


r7

public float r7
Contains the value of GROGRA's register 7.


r8

public float r8
Contains the value of GROGRA's register 8.


r9

public float r9
Contains the value of GROGRA's register 9.

Constructor Detail

LSystem

public LSystem()
Method Detail

assignLocalRegister

protected void assignLocalRegister(int no,
                                   float value)
Go back to the next shoot with the given localregisterno and assign the given value

Parameters:
nr - the localregisterno
value - the value

assignLocalRegisterAdd

protected void assignLocalRegisterAdd(int no,
                                      float value)
Go back to the next shoot with the given localregisterno and add the given value

Parameters:
nr - the localregisterno
value - the value

assignLocalRegisterMul

protected void assignLocalRegisterMul(int no,
                                      float value)
Go back to the next shoot with the given localregisterno and multiply the given value

Parameters:
nr - the localregisterno
value - the value

assignReferenceShoot

protected void assignReferenceShoot(int no,
                                    float value)
Go to the reference shoot (select by function21) and assign the localregisterno with the given value

Parameters:
nr - the localregisterno
value - the value

assignReferenceShootAdd

protected void assignReferenceShootAdd(int no,
                                       float value)
Go to the reference shoot (select by function21) and add the localregisterno with the given value

Parameters:
nr - the localregisterno
value - the value

assignReferenceShootMul

protected void assignReferenceShootMul(int no,
                                       float value)
Go to the reference shoot (select by function21) and multiply the localregisterno with the given value

Parameters:
nr - the localregisterno
value - the value

atan

public static float atan(float x)

atg

public static float atg(float x)

current

public static LSystem current()

currentLength

public float currentLength()
The GROGRA variable of type "length" returns the length of the associated shoot of the currentNode if generative rules are active, or the value of length of the current turtle state if interpretative rules are active.

Returns:
current length

currentXcoordinate

public float currentXcoordinate()
Returns the global x-coordinate of the tip of the associated shoot of the currentNode.

Returns:
x-coordinate of current shoot

currentYcoordinate

public float currentYcoordinate()
Returns the global y-coordinate of the tip of the associated shoot of the currentNode.

Returns:
y-coordinate of current shoot

currentZcoordinate

public float currentZcoordinate()
Returns the global z-coordinate of the tip of the associated shoot of the currentNode.

Returns:
z-coordinate of current shoot

derivation

public void derivation()

exp

public static float exp(float x)

floor

public static float floor(float x)

function1

public float function1(double minLength)

function10

public static float function10(float x)

function11

public static float function11(float n,
                               float k,
                               float b,
                               float c2,
                               float d)

function12

public static float function12(float i,
                               float age)

function13

public static float function13(double xl,
                               double xf)
GROGRA function 13 Calculation of number of lateral buds from shoot length

Parameters:
xl - the length of the shoot
xf - an (optional) conversion factor to be multiplied with xl^2
Returns:

function15

public float function15(int color)

function2

public float function2(double minLength,
                       int color)

function20

public float function20(int color)

function21

public float function21(int color)

function3

public float function3()
GROGRA function 3 computes the sum of the parameter values of the turtle states of all Shoots emerging from the currentNode.

Returns:
sum of parameter values

function30

public float function30(float arg1,
                        float arg2,
                        float arg3)
Auxilliary function for control purposes. Write the arguments to the console.

Parameters:
arg1 - First argument
arg2 - Second argument
arg3 - third argument
Returns:
Constant 0.0f

function31

public float function31(float arg1,
                        float arg2,
                        float arg3)

function32

public float function32(float arg1,
                        float arg2,
                        float arg3)

function33

public float function33(float arg1,
                        float arg2,
                        float arg3)

function34

public float function34(float arg1,
                        float arg2,
                        float arg3)

function35

public float function35(float arg1,
                        float arg2,
                        float arg3)

function36

public float function36(float arg1,
                        float arg2,
                        float arg3)

function37

public float function37(float arg1,
                        float arg2,
                        float arg3)

function38

public float function38(float arg1,
                        float arg2,
                        float arg3)

function39

public float function39(float arg1,
                        float arg2,
                        float arg3)

function4

public float function4(double alpha,
                       double minLength)

function5

public float function5(double alpha)

function6

public float function6()
GROGRA function 6 computes the sum of the carbon values of the turtle states of all Shoots emerging from the currentNode.

Returns:
sum of carbon values

function7

public float function7()
GROGRA function 7 computes the angle (in degrees) between the global z-direction and the local z-direction of the currentNode.

Returns:
angle between local and global z-direction in degrees

function8

public float function8(int color)

function9

public float function9(double alpha,
                       double minleng,
                       int co)

get

public static LSystem get(Registry r)

getGenerationNo

public int getGenerationNo()

getLocalRegisterValue

protected float getLocalRegisterValue(int no)
Method is called, when the value of a localregister is needed

Parameters:
no - number of the localregister
Returns:
the value

getNTypeImpl

protected Node.NType getNTypeImpl()
Description copied from class: Node
This method returns the Node.NType which describes the managed fields of the class of this node. This method has to be implemented in every concrete subclass.

Overrides:
getNTypeImpl in class RGG
Returns:
type describing the managed fields of the class of this node

getRefShoot

public Shoot getRefShoot()

getShootPopulation

public Dataset getShootPopulation()

initializeApplyMenu

protected void initializeApplyMenu(Item d,
                                   boolean flat,
                                   boolean useRunCheckBox)
Overrides:
initializeApplyMenu in class RGG

initializeRunMenu

protected void initializeRunMenu(Item d,
                                 boolean flat,
                                 boolean useRunCheckBox)
Overrides:
initializeRunMenu in class RGG

interpretation

public void interpretation()

log

public static float log(float x)

max

public static float max(float a,
                        float b)

method1

public void method1()
Computated the distribution of assimilate in a simple plant-model. Use the global registers 1 - 4. (non-realistic example, only for demonstration)


method10

public void method10()
Interface to branch library of TRAGIC++ (BITOEK, XI/1998)


method12

public void method12()
Writes all carbon-values of shoots with the color 14 to method12.dat


method30

public void method30()
Auxiliary method for control purposes: Scans through the whole structure, finds trees, whorls and branches.


method31

public void method31()

method32

public void method32()
Creates boxes for every branch and calculates different kind of information of shoots, which belong to different boxes. (These boxes are used, when shading, photosynthesis, formation of new shoots etc. is calculated)


method33

public void method33()

method34

public void method34()

method35

public void method35()

method36

public void method36()

method37

public void method37()

method38

public void method38()

method39

public void method39()

method4

public void method4()
Write the current-structure in a binary-file strutemp.dat. WARNING: The stored structured is using big endian for coding the bytes (highest byte first). The class RandomAccessFile does not support little endian coding for binary-files. Big endian is normally used on UNIX-systems. All int-values are stored as 16-bit-values, for the compatibility to system where int-values have a range of 16-bits and for the compatibility to GroGra-files. All long-values are stored as 32-bit-values. Additional ... there could be problems with the floating point values ... it's in the Java-format. The GroGra auxiliary-variables yka, xke and yke will saved with the value 0. The GroGra auxiliary-variable xka will saved with the carbon-value. The GroGra scale-counter-variable is currently saved with the value 0. The local registers of a shoot are not saved (now).


method40

public void method40()

method41

public void method41()

method42

public void method42()

method43

public void method43()

method44

public void method44()

min

public static float min(float a,
                        float b)

newInstance

protected Node newInstance()
Description copied from class: Node
This method returns a new instance of the class of this node. This method has to be implemented in every concrete subclass.

Overrides:
newInstance in class RGG
Returns:
new instance of class of this node

normal

public static float normal(float mu,
                           float sigma)
Returns a pseudorandom number which is distributed according to a normal distribution with mean value mu and standard deviation sigma.

Parameters:
mu - mean value
sigma - standard deviation
Returns:
normally distributed random number

patternMatched

public void patternMatched(RGGProducer prod)
Invoked after a pattern of a rule has matched, but before the right-hand side of the rule is executed.

Parameters:
prod - the producer which is used for the right-hand side

random

public static float random()
Returns a pseudo-random number which is uniformly distributed between 0 and 1.

Returns:
pseudo-random number between 0 and 1

reset

protected void reset()
Description copied from class: RGG
This method can be invoked to reset the RGG to its initial state. The following steps are performed:
  1. If there is an instance of RGGRoot which is connected with the real root of the graph by a branch edge, then this instance is removed. A new instance of RGGRoot is created and connected with the real root by a branch edge.
  2. A new instance of Axiom is created and inserted in the graph by a successor edge from the RGGRoot instance. The result of this step is a graph containing an RGGRoot which has a single Axiom as its successor.
  3. The method RGG.init() is invoked. This invocation is surrounded by transformation boundaries (see Library.apply()).
This method is also invoked when a newly compiled RGG is instantiated.

Overrides:
reset in class RGG

round

public static int round(float x)

shutdown

protected void shutdown()
Description copied from class: RGG
This method is invoked when an RGG instance is unloaded within GroIMP. This happens to an old RGG instance after compilation when this old instance is to be replaced by the newly compiled RGG instance.
If this method is overriden, super.shutdown(); should be invoked.

Overrides:
shutdown in class RGG

sqr

public static float sqr(float x)

sqrt

public static float sqrt(float x)

startup

protected void startup()
Description copied from class: RGG
This method is invoked when an RGG instance is loaded within GroIMP. This happens after the compilation of its source code and after loading a project containing an RGG.
If this method is overridden, super.startup(); should be invoked at first.

Overrides:
startup in class RGG

sumdGenerator

public void sumdGenerator(VoidConsumer c)
This generator method yields void for every daughter shoot of the associated shoot of the currentNode.

Parameters:
c - a consumer

sumGenerator

public void sumGenerator(VoidConsumer c)
This generator method yields void for every shoot of the subtree starting at the associated shoot of the currentNode.

Parameters:
c - a consumer

sumpGenerator

public void sumpGenerator(VoidConsumer c)
This generator method yields void for every shoot in the path from the associated shoot of the currentNode downwards to the root.

Parameters:
c - a consumer

uniform

public static float uniform(float min,
                            float max)
Returns a pseudo-random number which is uniformly distributed between min and max.

Parameters:
min - minimum value
max - maximum value
Returns:
pseudo-random number between min and max