Advanced Use

To write a new fractal for jfract environment is quit simple. we need to create an object that inherits from the AbstractFractalBean object. Abstract fractal bean implements for you the way to be included in Jfract container. Only two methods needs to be implemented to become a fractal. This two methods comes from the Interface FractalComputer here is the code of this interface :


package org.jfract.util;

/**
 * the interface used to compute the compute the loop of the fractal
 */
public interface FractalComputer
{
    /**
     * Compute the result for a point in x,y
     */
    public int computeFractal (double x, double y);
    /**
     * give the default location in term of
     * x, y, zoom
     */
    public Location getDefaultLocation();
}

The default location is the way you want to begin the location. Location is an ojbject to represent the zoom factor, the (x, y) position of the center is the value of the center of the screen.

A location of (xCenter = 0, yCenter = 0, zoom = 1) means that the most left point on screen get the double value 1 for x calculation and most top point on screen get the double 1 for y calculation.

So now let's implement a Julia fractal.

Here is the mathematical definition of a julia set J(c) defined for Complex C :

Let Sc the mathematical suite defined as : Zn+1 = Zn^² + c and Z0 = Zc:

if the |Zn| < +infitiny for each n then Zc belongs to Jc.

we say that Z is going to ifinity if it becomes bigger than a big value. it is because it will be unstable for a such value.

Now let's implements J(0 + 0i) :


package org.jfract.samples;

import org.jfract.abstractBeans.AbstractFractalBean;
import org.jfract.util.Location;
import org.jfract.math.Complex;

public class JuliaSetSample extends AbstractFractalBean
{

    /**
     * The static variable for the max modulo
     * meaning that it goes to infinity
     */
    static final double MAX = 1000;

    /**
     * the iteration in the loop
     */
    private int iter = 255;
    /**
     * the complex in the definition
     */
    private Complex C = new Complex (0, 0);


    /**
     * define the setter for iteration number
     * you have to define it if you want to be
     * able to edit it
     */
    public int getIter()
    {
        return iter;
    }

    /**
     * define also the setter
     */
    public void setIter(int iter)
    {
        this.iter = iter;
    }

    /**
     * Compute the result for a point in x,y
     */
    public int computeFractal(double x, double y)
    {
        Complex Z = new Complex(x, y);
        int count = 0;
        while (Z.mod2() > MAX && count < iter)
        {
            Z=Z.pow(2).add(C);
            count++;
        }
        //System.out.println("count" + count);
        return count;

    }

    /**
     * give the default location in term of
     * x, y, zoom
     */
    public Location getDefaultLocation()
    {
        return new Location (0,0,.5);
    }
}

We use the Complex object to implements J(0,0).

For each (x,y) we define Zc as Zc = x + y*i and compute a value wich correspond to the color. when the point belongs to the julia set the loop will go to the maximum iteration. the more the iteration number is higher the more delailled the picture will be.

for the iter variable we define a getter and a setter as the JavaBeans specifications.

Here it is we got a fractal implementation !! it is quite simple :)).

Jfract home path has several folders here is the description of each :

Folder Description
beans/src The source path for your java code working with jfract kernel. put here your jfract.xml file.
html The html files for the description of your beans.
docs Your in it !
exec The execution directory of the project here you can find the conf.properties file. if not exits jfract will create it. if incorrect just delete its
images The pictures you will produce from jFrcat. you can edit its with another soft such as photoshop.
movies The generated movies from the jfract project.
tempMovie This folder is a tempory directory to generate jpeg pictures for movie generation.
beansSer The serialized beans made with jfract.
lib The java libraries needed including jfract_impl.jar wich is the produced jar from your java code.

Create a file named JuliaSetSample.html where you describe the bean.

Add your example to jfract by creating a "jfract.xml" in the beans/src folder from jfract home as follow :


<jfract>
	<propertyEditor>
		<property type="java.awt.Color" code="org.jfract.beanEditor.delagate.ColorEditor"/>
		<property type="[Ljava.awt.Color;" code="org.jfract.beanEditor.delagate.ColorArrayEditor"/>
		<property type="java.lang.String" code="org.jfract.beanEditor.delagate.TypeEditor"/>
		<property type="org.jfract.math.ComplexPolynome" code="org.jfract.beanEditor.delagate.ComplexPolynomeEditor"/>
	</propertyEditor>
	<beans>
		<bean name="JuliaSetSample" code="org.jfract.samples.JuliaSetSample">
			<properties>
				<publish propertyName="iter"/>
			</properties>
			<descriptor file="JuliaSetSample.html"/>
			<movieInterPol>
				<moving>
					<var name="location" object="org.jfract.util.MovieDeltaParam" MethodName="getLocationDiff"/>
				</moving>
				<fixed>
					<var name="iter"/>
				</fixed>
			</movieInterPol>
		</bean>
	</beans>
</jfract>

Here is a description of the different tags :

Tag Name Description
Jfract The top node for the jfract.xml file.
 Jfract/propertyEditor The list of the property editor
Jfract/propertyEditor/property The code code of property editor registered for the object class type
jfract/beans The list of your bean
jfract/beans/bean The bean with name name the code code. the name must be the name of the javaObject.
jfract/beans/bean/methods A list of the published void method () that you call from jFtact Gui.
jfract/beans/bean/properties/publish Publish the method with name methodName. the method will appear as a Jbutton in the Gui.
jfract/beans/bean/properties A list of the edited properties that you can edit in jFtact Gui.
jfract/beans/bean/properties/publish Publish the property with name propertyName the first letter of the name sould be in minor case. it have to be an instance variable with a getter and a setter in the java code. the variable can be members of super classes.
jfract/beans/bean/descriptor The html file file you defined for the description.
jfract/beans/bean/movieInterpole The description for the movie interpolation.
jfract/beans/bean/movieInterpole/moving The list of variables that migth have variation.
jfract/beans/bean/movieInterpole/moving/var The variable of name name should be computed with the class object and the method methodName.
jfract/beans/bean/movieInterpole/fixed The list of varaible that should not have variations
jfract/beans/bean/movieInterpole/fixed/var The variable of name name should not be different.

Once you created the xml description file just copy JuliaSetSample.java to the beans directory then prompt ant from your jfract home directory.

After a while the Gui will starts :

Now you did your first implementation of a jfract fractal sample. It is not so much interresting for the moment because we cannot edit the Complex C of the equation definition.

In this part we will learn to create an editor to edit object values. for the example of Julia set it could cool if the Complex value C should be edited directly from jfract.

To do that it's quite simple just create a object inheriting from AbstractJBeanEditorDelegate Object. To do that you should be a good friend of java swing. have a look on http://java.sun.com/docs/books/tutorial/uiswing/components/components.html to get a good tutorial for the swing technolologies.

Here is the the code of Complex editor : ComplexEditor.java.

You will also need to add a getter and a setter for the c value defined above. your jfract.xml configuration must also change to add the the ComplexEditor for the class ComplexEditor.

Jfract gives you some editor for these objects :

Java Object jfract editor object
java.lang.String org.jfract.beanEditor.delagate.TypeEditor
java.awt.Color org.jfract.beanEditor.delagate.ColorEditor
[Ljava.awt.Color; org.jfract.beanEditor.delagate.ColorArrayEditor
org.jfract.math.Complex org.jfract.beanEditor.delagate.ComplexEditor
org.jfract.math.ComplexPolynome org.jfract.beanEditor.delagate.ComplexPolynomeEditor

But has you see you can define new ones to edit what ever you want.

The simple type (int, double, boolean, ...) are editable as default with jfract.

to register these property editors and add the editable property just add these lines to jfract.xml :

 

<jfract>
	<propertyEditor>
		<property type="java.awt.Color" code="org.jfract.beanEditor.delagate.ColorEditor"/>
		<property type="[Ljava.awt.Color;" code="org.jfract.beanEditor.delagate.ColorArrayEditor"/>
		<property type="java.lang.String" code="org.jfract.beanEditor.delagate.TypeEditor"/>
		<property type="org.jfract.math.ComplexPolynome" code="org.jfract.beanEditor.delagate.ComplexPolynomeEditor"/>
		<property type="org.jfract.math.Complex" code="org.jfract.beanEditor.delagate.ComplexEditor"/>
	</propertyEditor>
	<beans>
		<bean name="JuliaSetSample" code="org.jfract.samples.JuliaSetSample">
			<properties>
				<publish propertyName="iter"/>
				<publish propertyName="c"/>
				<publish propertyName="color"/>
				<publish propertyName="zoomFactor"/>
			</properties>
			<descriptor file="JuliaSetSample.html"/>
			<movieInterPol>
				<moving>
					<var name="location" object="org.jfract.util.MovieDeltaParam" MethodName="getLocationDiff"/>
				</moving>
				<fixed>
					<var name="iter"/>
				</fixed>
			</movieInterPol>
		</bean>
	</beans>
</jfract>

Note that we did add color and zoom factor wich are members of AbstractFractalBean.

You can add your own implementations for your object by implementing AbstractJBeanEditorDelegate.

now restart jfract with ant :

Jfract let you build some movies from two different views from a fractal. to do that you're completly free. For example in the julia set defined above you can define a translation from a complex C0 to a Complex C1 with a defined number of frame for the movie.

The rule to do that is quite simple define a class with a static method with 3 arguments returnin an array of object :

public static Complex[] getComplexDiff (Complex C0, Complex C1, int frameNumber) {}

in a general form the method has this signature :

public static Your_object[] compute (Your_Object o0, Your_Object o1, int frameNumber) {}

this method must return an Array of length frameNumber wich represents the your interpolation and must be static.

So now let's implement the complex interpolation :

 

package org.jfract.samples;

import org.jfract.math.Complex;

public class MovieDelta
{
    public static Complex[] getComplexDiff (Complex c0, Complex c1, int frameNumber)
    {
        Complex[] ret = new Complex [frameNumber];
        //compute the vector representing the progression
        double deltaRe = (c1.getRe() - c0.getRe())/(frameNumber - 1);
        double deltaIm = (c1.getIm() - c0.getIm())/(frameNumber - 1);
        for (int i = 0; i < frameNumber; i++)
        {
          ret[i] = new Complex(c0.getRe() + deltaRe * i, c0.getIm() + deltaIm * i);
        }
        return ret;
    }
}

Now we're able to compute an interpolation from a complex from another and generate a Julia fractal movie.

Then add this interpolation to jfract.xml.


<jfract>
	<propertyEditor>
		<property type="java.awt.Color" code="org.jfract.beanEditor.delagate.ColorEditor"/>
		<property type="[Ljava.awt.Color;" code="org.jfract.beanEditor.delagate.ColorArrayEditor"/>
		<property type="java.lang.String" code="org.jfract.beanEditor.delagate.TypeEditor"/>
		<property type="org.jfract.math.ComplexPolynome" code="org.jfract.beanEditor.delagate.ComplexPolynomeEditor"/>
		<property type="org.jfract.math.Complex" code="org.jfract.beanEditor.delagate.ComplexEditor"/>
	</propertyEditor>
	<beans>
		<bean name="JuliaSetSample" code="org.jfract.samples.JuliaSetSample">
			<properties>
				<publish propertyName="iter"/>
				<publish propertyName="c"/>
				<publish propertyName="color"/>
				<publish propertyName="zoomFactor"/>
			</properties>
			<descriptor file="JuliaSetSample.html"/>
			<movieInterPol>
				<moving>
					<var name="location" object="org.jfract.util.MovieDeltaParam" MethodName="getLocationDiff"/>
					<var name="c" object="org.jfract.samples.MovieDelta" MethodName="getComplexDiff"/>
				</moving>
				<fixed>
					<var name="iter"/>
				</fixed>
			</movieInterPol>
		</bean>
	</beans>
</jfract>

Restart JFract with ant and choose a first value for your interpolation, for example choose the first value as J(-.5 + 0i) and the second as J(.25 + 0i). set the c value to the first value then repaint the fractal. Serialize your bean by clicking on the save button, choose a name such as Julia0 to generate Julia0.ser in the serialized bean list. then change the c value with editor defined above to the second choosen value. Serialize the new bean with save button and name it Julia1.ser.

then go to the movie panel. in the bottom list you should see two serialized beans you did produce.

add the fisrt then the second in the JTable above with the up arrow. the trash let you remove items from the JTable if you did a mistake. define the number of fram by clicking in the rigth column and setting the number of frame wanted.

then choose your configuration. don't set a two big frame rate a frame rate of 15 Frames/ s is produce quit good results. set a name for your file such as julia it will produce a movie called julia.mov.

Then generate.

be patient or cancel the process.

after a while double click on the movie generated :

Here we are. I hope at this step you're beginning to see the interrest of the JFract project.

Jfract gives you some interpolation for these objects but you are allowed to redefine interpolation as yoy like. The only thing you have to do is respecting the rules for the object interpolation and define the movieIterpol tag corectly in jfract.xml.

Java Object Description jfract interpolation object and method
org.jfract.math.Complex Going from C0 to C1 through C1 - C0 direction org.jfract.util.MovieDeltaParam / getComplexDiff()
org.jfract.util.Location Going from L0 to L1 with a geomitrical suite. org.jfract.util.MovieDeltaParam / getLocationDiff()
org.jfract.math.ComplexPolynome Going from P0 to P1 through P0 - P1 direction in a R^n vector space org.jfract.util.MovieDeltaParam / getPolyDiff()
[Ljava.awt.Color; Set all color same from the most bigger array org.jfract.util.MovieDeltaParam / getColorDiff()
int get an interpolation i1 - i0 org.jfract.util.MovieDeltaParam / getIntDiff()
double get an interpolation d1 - d0 org.jfract.util.MovieDeltaParam / getDoubleDiff()

 

If you want to define a special interpolation just return the array of the object interpolation without caring obout the two different objects. For example if we want to define a special movie for the julia set like a trajectory neer the limit of the mandelbrot set.

Define the interpolation without carring about the two complex passed as argument

here is the code of this implementation :


package org.jfract.util;

import org.jfract.math.Complex;

public class MovieSpecialInterpol
{
        /**
     * compute the diff beetwen two complex
     */
    public static Complex[] getMandelTraj (Complex c0, Complex c1, int frameNumber)
    {
        Complex[] ret = new Complex [frameNumber];
        double d = -.5;
        double delta = (double).7/ (frameNumber - 1);
        for (int i = 0; i < frameNumber; i++)
        {
            int count = 20;
            Complex C = new Complex(d + delta * i, 0);
            while (count == 20)
            {
                C.setIm(C.getIm() + .01);
                Complex Z0 = new Complex (0, 0);
                Complex Z1 = Z0;
                count = 0;
                while (Z1.mod() < 1000 && count < 20)
                {
                    Z1=Z0;
                    Z0=Z1.pow(2).add(C);
                    count++;
                    //System.out.println(count);
                }
            }
            ret[i] = new Complex(C.getRe(), C.getIm() - .05);
            System.out.println(C);
        }
        return ret;
    }

    public static void main(String[] args)
    {
         getMandelTraj (null, null, 20);
    }
}
 

With the JBeanFactory object you can include your java object in the JFract container easyly. You just have to follow rules to define your constructor and implements the JBeanableGetable interface.

For example if we want to manage a JFrame componant from the jfrcat interface it is quit simple to do so. We need to write two differents class a main class with a main method and an object inherited from JFrame :


import org.jfract.beanEditor.*;
import org.jfract.WrongBeanException;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.apache.log4j.Category;

import javax.swing.*;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.ParserConfigurationException;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import java.io.FileInputStream;

public class FactoryTest
{
    public static void main (String[] args )
    {
        //load the descriptor
        //load the xml document
        Document descriptionDoc = null;
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        dbf.setNamespaceAware(true);
        DocumentBuilder db = null;
        //create a DocumentBuilder
        try
        {
            db = dbf.newDocumentBuilder();
        }
        catch (ParserConfigurationException e)
        {
            e.printStackTrace();
        }
        //parse the input file to get a Document object
        try
        {
            descriptionDoc = db.parse(new InputSource(new FileInputStream("jfract.xml")));
        }
        catch (SAXException e)
        {
            e.printStackTrace();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        JFrame frame = new JFrame("test");
        frame.getContentPane().setLayout(new BorderLayout());

        frame.getContentPane().add(JBeanFactory.getJBeanDefaultPanel(new Frame4Jfract() ,  null, descriptionDoc), BorderLayout.CENTER);
        frame.setSize(450, 300);
        frame.addWindowListener(new WindowAdapter()
        {
            /**
             * Invoked when a window has been closed.
             */
            public void windowClosing(WindowEvent e)
            {
                System.exit(0);
            }
        });
        frame.show();

    }
}

 


import org.jfract.beanEditor.JBeanableGetable;
import org.jfract.beanEditor.JBeanFactory;
import org.jfract.beanEditor.JBeanable;
import org.jfract.WrongBeanException;

import javax.swing.*;

public class Frame4Jfract extends JFrame implements JBeanableGetable
{
    private JBeanable jBeanable;

    public JBeanable getJBeanable()
    {
        return jBeanable;
    }

    public Frame4Jfract ()
    {
        super();
        try
        {
            jBeanable = JBeanFactory.getDefaultJbeanableImpl(this);
        }
        catch (WrongBeanException e)
        {
            e.printStackTrace();
        }
    }
}

In the class Frame4Jfract we just follow the rule for the constructor defined above the method getJBeanable () comes from the JBeanableGetable interface. you need to define a member of type JBeanable which is the return value of the getJBeanable () method.

define the jfract.xml :


<jfract>
	<propertyEditor>
		<property type="java.awt.Color" code="org.jfract.beanEditor.delagate.ColorEditor"/>
		<property type="[Ljava.awt.Color;" code="org.jfract.beanEditor.delagate.ColorArrayEditor"/>
		<property type="java.lang.String" code="org.jfract.beanEditor.delagate.TypeEditor"/>
		<property type="org.jfract.math.ComplexPolynome" code="org.jfract.beanEditor.delagate.ComplexPolynomeEditor"/>
		<property type="org.jfract.math.Complex" code="org.jfract.beanEditor.delagate.ComplexEditor"/>
	</propertyEditor>
	<beans>
		<bean name="Frame4Jfract" code="Frame4Jfract">
			<properties>
				<publish propertyName="size"/>
				<publish propertyName="visible"/>
				<publish propertyName="title"/>
			</properties>
		</bean>
	</beans>
</jfract>

 

So now let's start the FactoryTest main class with all the needed librarie see JFract_home/docs/samples for the bat file.

call JBeanFactory.bat from the folder jfract_home/docs/samples in a command window then the JFract editor comes...

Just change the title value or the visible value to play with the frame. The kernel of JFract use the reflexion Api to invoke method, setter or getter on the properties.

We can modify a little the Frame4JFract class to define two methods with the signature void method(). Foe example defining a method to add a button ans a method to remove the last button add.

just add two methods in Frame4JFract class


    private Vector button_vector = new Vector();

    public void addButton ()
    {
        JButton button = new JButton(new Integer(button_vector.size()).toString() );
        button_vector.add(button);
        getContentPane().add(button);
        validate();
    }

    public void removeButton ()
    {
        getContentPane().remove((JButton)button_vector.elementAt(0));
        button_vector.remove(0);
        validate();
        repaint();
    }

add also the methods in jfract.xml


	<beans>
		<bean name="Frame4Jfract" code="Frame4Jfract">
			<methods>
				<publish methodName="addButton"/>
				<publish methodName="removeButton"/>
			</methods>
			<properties>
				<publish propertyName="size"/>
				<publish propertyName="visible"/>
				<publish propertyName="title"/>
			</properties>
		</bean>
	</beans>

Then restart the sample :

This example is not so interresting but the goals is to have a look on the way to include java object into JFract Implementation. Every kind of java object can be included in the JFract container since you implements JBeanableGetable and you define the constructor correctly. You just have to adapt your code without changing the functionnality of your object.

Let use the description above to write a general class able to connect to a database and ask for queries. The difference from the previous example is that you will implements both interfarces : BeanPanelManagable and JBeanableGetable.



import org.jfract.beanEditor.JBeanable;
import org.jfract.beanEditor.JBeanableGetable;
import org.jfract.beanEditor.JBeanFactory;
import org.jfract.beanEditor.BeanPanelManagable;
import org.jfract.WrongBeanException;

import javax.swing.*;
import java.awt.event.MouseEvent;
import java.awt.*;
import java.sql.*;

public class JDBCConnector implements BeanPanelManagable, JBeanableGetable
{
    public String getUser()
    {
        return user;
    }

    public String getPassWord()
    {
        return passWord;
    }

    public String getDriver()
    {
        return driver;
    }

    public String getUrl()
    {
        return url;
    }

    public String getRequest()
    {
        return request;
    }

        public void setUrl(String url)
    {
        this.url = url;
    }

    public void setDriver(String driver)
    {
        this.driver = driver;
    }

    public void setPassWord(String passWord)
    {
        this.passWord = passWord;
    }

    public void setUser(String user)
    {
        this.user = user;
    }

    public void setRequest(String request)
    {
        this.request = request;
    }

    private JBeanable jBeanable;
    private String url = "jdbc:mysql://localhost/xps";
    private String driver = "org.gjt.mm.mysql.Driver";
    private String passWord = "toto";
    private String user = "toto";
    private Connection con = null;

    private String request = "select * from xps_perflog";
    private JTextField textReq;

    public JBeanable getJBeanable()
    {
        return jBeanable;
    }

    public  JDBCConnector()
    {
        try
        {
            jBeanable = JBeanFactory.getJbeanableImpl(this);
        }
        catch (WrongBeanException e)
        {
            e.printStackTrace();
        }
        textReq = new JTextField();
    }

    /**
     * init the connections
     */
    public void initConnection()
    {
        try
        {
            Class.forName(driver).newInstance();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        try
        {
            con = DriverManager.getConnection(url, user, passWord);
        }
        catch (SQLException e)
        {
            e.printStackTrace();
        }
    }

    /**
     * get the result in the TextField
     */
    public void getResultSet()
    {
        ResultSet rs = null;
        ResultSetMetaData meta = null;

        try
        {
            Statement stmt = con.createStatement();
            rs = stmt.executeQuery(request);
            meta = rs.getMetaData();

            StringBuffer buffer = new StringBuffer();
            for (int i = 1; i < meta.getColumnCount() + 1; i++)
            {
                buffer.append(meta.getColumnName(i) + "\t");
            }
            buffer.append("\r\n");
            while (rs.next())
            {
                for (int i = 1; i < meta.getColumnCount() + 1; i++)
                {
                    buffer.append(rs.getString(i) + "\t");
                }
                buffer.append("\r\n");
            }
            textReq.setText(buffer.toString());
        }
        catch (SQLException e)
        {
            e.printStackTrace();
        }
    }

    /**
     * Invoked when the mouse has been clicked on a component.
     */
    public void mouseClicked(MouseEvent e)
    {
    }

    /**
     * Invoked when a mouse button has been pressed on a component.
     */
    public void mousePressed(MouseEvent e)
    {
    }

    /**
     * Invoked when a mouse button has been released on a component.
     */
    public void mouseReleased(MouseEvent e)
    {
    }

    /**
     * Invoked when the mouse enters a component.
     */
    public void mouseEntered(MouseEvent e)
    {
    }

    /**
     * Invoked when the mouse exits a component.
     */
    public void mouseExited(MouseEvent e)
    {
    }

    /**
     * Define here the way you put the componant
     * in the BeanPanel container Object
     */
    public void initComponant()
    {
        jBeanable.getJBean().getPanelBeanContainer().setLayout(new BorderLayout());
        jBeanable.getJBean().getPanelBeanContainer().add(textReq, BorderLayout.CENTER);
    }

    /**
     * redraw bean used to refresh the BeanPanel
     */
    public void reDrawBean()
    {
    }

    /**
     * Draw the bean in the BeanPanel
     */
    public void drawBean(Graphics g)
    {
    }


}

Then add the connector to jfract.xml

 

<jfract>
	<propertyEditor>
		<property type="java.awt.Color" code="org.jfract.beanEditor.delagate.ColorEditor"/>
		<property type="[Ljava.awt.Color;" code="org.jfract.beanEditor.delagate.ColorArrayEditor"/>
		<property type="java.lang.String" code="org.jfract.beanEditor.delagate.TypeEditor"/>
		<property type="org.jfract.math.ComplexPolynome" code="org.jfract.beanEditor.delagate.ComplexPolynomeEditor"/>
		<property type="org.jfract.math.Complex" code="org.jfract.beanEditor.delagate.ComplexEditor"/>
	</propertyEditor>
	<beans>
		<bean name="Frame4Jfract" code="Frame4Jfract">
			<methods>
				<publish methodName="addButton"/>
				<publish methodName="removeButton"/>
			</methods>
			<properties>
				<publish propertyName="size"/>
				<publish propertyName="visible"/>
				<publish propertyName="title"/>
			</properties>
		</bean>
		<bean name="JDBCConnector" code="JDBCConnector">
			<methods>
				<publish methodName="getResultSet"/>
				<publish methodName="initConnection"/>
			</methods>
			<properties>
				<publish propertyName="user"/>
				<publish propertyName="driver"/>
				<publish propertyName="passWord"/>
				<publish propertyName="request"/>
			</properties>
		</bean>

	</beans>
</jfract>

Call JDBC.bat from the folder jfract_home/docs/samples in a command window then the JFract editor comes...

Now you're able to connect to every database on the netWork :)).

If you want to define a new strange attractor such as the ikeda map attractor you will have to extends the AbstractPointAttractor class and implements the MapPointAttractor interface for defining the next pointDouble from the current one. The MapointAttractor use the class PointDouble to represent a point in any R^n space.

Here is the definition of the ikeda map attractor :

f(x, y) =(R + C2(x cos t - y sin t), C2 (x sin t + y cos t))

where t = C1 - C3/(1 + x² + y²) and R C1, C2, C3 are fixed parameters.

Let choose R = .9, C1=.4, C2=.9 and C3 = 6.

Here is the code of the ikeda attractor :


import org.jfract.beanEditor.*;
import org.jfract.*;
import org.jfract.abstractBeans.AbstractPointAttractor;
import org.jfract.util.Location;

import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.event.*;
import java.util.Vector;

import org.jfract.math.PointDouble;

/**
 * the henon attractor
 */
public class Ikeda  extends AbstractPointAttractor
{
    public Ikeda()
    {
        setSize (1500);
    }

    /**
     * get the default location
     */
    public Location getDefaultLocation()
    {
        return new Location (0, 0, .5);
    }

    public double getR()
    {
        return R;
    }

    public void setR(double r)
    {
        R = r;
        stopAnimate();
        animate();
    }

    public void setC1(double c1)
    {
        C1 = c1;
        stopAnimate();
        animate();
    }

    public void setC2(double c2)
    {
        C2 = c2;
        stopAnimate();
        animate();
    }

    public void setC3(double c3)
    {
        C3 = c3;
        stopAnimate();
        animate();
    }

    public double getC1()
    {
        return C1;
    }

    public double getC2()
    {
        return C2;
    }

    public double getC3()
    {
        return C3;
    }

    private double R = 1.4;
    private double C1 = .4;
    private double C2 = .9;
    private double C3 = 6;

    public PointDouble getNextPoint(PointDouble point)
    {

        double t = C1 - C3 * (1 + point.values[0]*point.values[0] + point.values[1]*point.values[1] );

        //if unstable
        if (java.lang.Math.max (point.values[0],point.values[1]) > 1000)
        {
            //set to 0,0,0
            point.values[0] = 0;
            point.values[1] = 0;
        }
        return new PointDouble(new double[] {R + C2 *(point.values[0] * Math.cos(t)  - point.values[1] * Math.sin(t) ) , C2 *(point.values[0] * Math.sin(t)  + point.values[1] * Math.cos(t) )});
    }

    /**
     * get the first point of the iteration
     * it should be a stable point
     */
    public PointDouble getFirstPoint()
    {
        return new PointDouble(new double[] {.54, .54});
    }

    /**
     * get the projection on x,y
     */
    public double[] getProjection(PointDouble point)
    {
        return new double[] {point.values[0], point.values[1] };
    }
}
;

Now iclude it in the Jfract.xml and run ikeda.bat in the docs/samples directory from jfract_home directory.