Class Behavior

java.lang.Object
  |
  +--Behavior

public class Behavior
extends java.lang.Object

An image generator with state entirely parameterized by time and a pixel function.


Field Summary
(package private)  ELMatrix currentValue
           
(package private)  boolean dirty
          True when currentValue is out of sync with expression.
(package private)  ELExpression expression
           
(package private)  java.lang.String expressionCode
           
(package private)  int lastEnvironmentHash
           
(package private)  int numGenerations
           
(package private)  int numMutations
           
 
Constructor Summary
Behavior(ELExpression e, int width, int height, int numGenerations)
           
Behavior(GeneticParameters gp, int width, int height)
           
 
Method Summary
 void environmentChanged()
          Invoke to tell the behavior that its environment has been mutated and it should redraw if necessary.
 void evaluate()
           
 void evaluate(ELEnvironment environment)
          Evaluates the expression.
 Behavior free()
          Deallocates resources consumed by this behavior.
 boolean isBoring()
          Returns true if this behavior is boring.
 boolean sameExpression(Behavior b)
          Returns true if both behaviors share an expression.
 void setExpression(ELExpression e)
           
 void setRandomExpression(GeneticParameters gp)
          Sets this behavior to a new, non-boring expression.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

expression

ELExpression expression

currentValue

ELMatrix currentValue

dirty

boolean dirty
True when currentValue is out of sync with expression.

lastEnvironmentHash

int lastEnvironmentHash

numMutations

int numMutations

numGenerations

int numGenerations

expressionCode

java.lang.String expressionCode
Constructor Detail

Behavior

public Behavior(GeneticParameters gp,
                int width,
                int height)
Parameters:
gp - The parameters that should be used to generate the initial expression.

Behavior

public Behavior(ELExpression e,
                int width,
                int height,
                int numGenerations)
Method Detail

setRandomExpression

public void setRandomExpression(GeneticParameters gp)
Sets this behavior to a new, non-boring expression.

setExpression

public void setExpression(ELExpression e)

isBoring

public boolean isBoring()
Returns true if this behavior is boring.

free

public Behavior free()
Deallocates resources consumed by this behavior.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

evaluate

public void evaluate()

evaluate

public void evaluate(ELEnvironment environment)
Evaluates the expression.

sameExpression

public boolean sameExpression(Behavior b)
Returns true if both behaviors share an expression.

environmentChanged

public void environmentChanged()
Invoke to tell the behavior that its environment has been mutated and it should redraw if necessary. This will automatically trigger re-evaluation and redraw on the invoking thread.