|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectFramework.Plane2D
Framework.LSystem
public class Framework.LSystem
This class is a solution to the 2010-2011 Lindenmayer System assignment found here.
| Field Summary | |
|---|---|
java.lang.String |
axiom
the initiator (axiom) of the fractal |
java.lang.String |
definition
Holds the characters defining the fractals as a sequence of drawing commands for the Turtle |
double |
delta
The angle the heading of the turtle is modified by at each turn |
double |
distance
The distance or length of each line segment(decreases with each generation). |
int |
factor
the factor used to decrease the distance with each generation |
double |
heading
The initial angle of the Turtle in degrees |
java.lang.String |
keys
holds the characters for which productions exist |
int |
n
The number of generations to propagate. |
java.lang.String |
name
The name of this instance of the LSystem object |
java.lang.String[] |
productions
The array of productions (generators) that replace their respective key in each generation |
double |
xPos
The initial x position of the turtle |
double |
yPos
The initial y position of the turtle |
| Fields inherited from interface Framework.Drawable |
|---|
palette, random |
| Constructor Summary | |
|---|---|
Framework.LSystem(java.awt.Dimension appDimen,
java.lang.String name,
java.lang.String axiom,
java.lang.String keys,
java.lang.String[] productions,
double heading,
double distance,
double delta,
int thickness,
int factor,
int numSides,
int n,
double xPos,
double yPos)
Constructor for LSystem curve: one key |
|
| Method Summary | |
|---|---|
void |
draw(java.awt.image.BufferedImage drawTo)
Draws itself to the parameterized BufferedImage. |
boolean |
finished()
Sets the status of the rendering to completed. |
java.lang.String |
generate(int n)
Recursive method used to propagate the definition of the PFC |
java.awt.Color |
getBackgroundColor()
Merely returns the background color for this Drawable. |
java.lang.String |
getDefinition()
Accessor method to return the String definition of the fractal. |
double |
getDelta()
Accessor method to return the angle the Turtle is to change with each turn. |
double |
getDistance()
Accessor method to return the length of the line segment to be drawn. |
java.lang.String |
getName()
Accessor method return the name of the Koch object. |
java.lang.String |
replaceEmAll(java.lang.String str)
Applies multiple productions in the development of the next generation |
void |
setCompleted()
Sets the status of the rendering to completed. |
void |
setMouseEvent(java.awt.event.MouseEvent e)
Allows all implementers to react to mouse events passed from the content class. |
| Methods inherited from class Framework.Plane2D |
|---|
scrX, scrY |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public java.lang.String name
public java.lang.String axiom
public java.lang.String keys
public java.lang.String definition
public java.lang.String[] productions
public double heading
public double xPos
public double yPos
public double distance
public double delta
public int factor
public int n
| Constructor Detail |
|---|
public Framework.LSystem(java.awt.Dimension appDimen,
java.lang.String name,
java.lang.String axiom,
java.lang.String keys,
java.lang.String[] productions,
double heading,
double distance,
double delta,
int thickness,
int factor,
int numSides,
int n,
double xPos,
double yPos)
appDimen - the Dimension object defining the size of the appletname - the name of the Koch curveaxiom - the initial (generation 0) curve (the initiator in Koch
parlance)keys - the String containing the keys. Koch curve only has one
key but other L-Systems have multiple keysproductions - the array of productions. Koch curve only has one
production but keep as an array of String for future
developmentheading - the initial heading of the drawing pen (turtle) in
degrees. 0 degrees is east. Positive is Counterclockwise.distance - the length of the line to draw in pixels when moving the
turtle forward (the F command)delta - the change in the turtle's heading when executing + or -
command. + is counterclockwise and - is clockwisethickness - the thickness of the line drawn by the penfactor - the reduction ratio applied to distance after each
generationnumSides - the number of sides in the production. This aids in the
rendering animation.n - the number of generations to propagate the curvexPos - the initial x position (column) of the turtleyPos - the initial y position (row) of the turtle| Method Detail |
|---|
public java.lang.String generate(int n)
n - the generation number
public java.lang.String replaceEmAll(java.lang.String str)
str - the current definition
public java.awt.Color getBackgroundColor()
Framework.Drawablethis Drawable.
getBackgroundColor in interface Framework.DrawableColor of the background for
this Drawable.public void draw(java.awt.image.BufferedImage drawTo)
Framework.DrawableBufferedImage.
draw in interface Framework.DrawabledrawTo - a BufferedImage to draw to.public java.lang.String getName()
public java.lang.String getDefinition()
public double getDelta()
public double getDistance()
public void setMouseEvent(java.awt.event.MouseEvent e)
Framework.Drawable
setMouseEvent in interface Framework.Drawablee - The MouseEvent that the object is to respond
to.public boolean finished()
Framework.Drawable
finished in interface Framework.Drawablepublic void setCompleted()
Framework.Drawable
setCompleted in interface Framework.Drawable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||