Creating a new Membrane Algorithm

We assume that you have already installed your desired development environment and downloaded the cm2membranepackingalgorithm library.

Now it is time to choose a name for your new algorithm class and to create a new java file for it. If you are working with a development toolkit such as Eclipse, you should create a new java project first.
As soon as this is done, you will need to import the cm2membranepackingalgorithm library so that you can use it.

Importing the Library

If you are using Eclipse or other development tools, you will have to copy the cm2membranepackingalgorithm.jar into your project directory. It has to be in the same folder your java file is in.

Add the library to the classpath of the project. In Eclipse you can do that by right-clicking on the jar-file and choosing "add to build path".

If you don't use any development environment, just copy the library into the same directory your java file is in.

NOTE: When you compile your class later on, do not forget to add the library to the classpath, or else the resources will not be found. Call the compiler like this later on:

javac MyMembraneAlgorithm.java
-classpath cm2membranepackingalgorithm.jar

All you need to do now is to import the package into your class. Modern development tools will do that automatically when needed, otherwise you can add the following line to the top of your java file:

import cm2membranepackingalgorithm.*;

Making your class a Membrane Algorithm

In order to make your class into a MembraneAlgorithm that can be used by this program your class needs to inherit from MembraneAlgorithm and implement all of the methods defined in the
MembraneAlgorithmInterface (see javadoc) Once again, if you should be working with a development tool, this will be done automatically. After implementing all this methods, your class should look like this:

import java.awt.Component;

import cm2membranepackingalgorithm.*;


public class MyMembraneAlgorithm extends MembranePackingAlgorithm {

    public boolean buildAndShowGui() {
       
        return false;
    }

    public void fillWithLipids() throws Exception {
       

    }

    public String getFullInformation() {
       
        return null;
    }

    public String getName() {
       
        return null;
    }

    public Component getRuntimeControlPanel() {
       
        return null;
    }

    public String getShortInformation() {
   
        return null;
    }

    public String getStringRepresentationOfSetupParameters() {
       
        return null;
    }

    public boolean overrideExistingLipids() {
       
        return false;
    }

    public void stopAlgorithm() {

    }

    public boolean supportsAbsoluteValues() {
        return true;
    }

    public boolean supportsMicrodomains() {
       
        return false;
    }

}

These are all methods the interface needs in order to accept and run your algorithm. Their purposes and what you should do with them is described in the Overriding the Methods section.

Some other provided methods and objects that you will need are described in Essential Methods and Objects

Munkaw Chaos Girl