Skip to content
chiller87 edited this page Jun 18, 2015 · 1 revision

If you finished the implementation of your algorithm you have to export it and put it in the 'plugins' of the Vigral Software.

Lets say your implementation looks like this:

import java.util.ArrayList;

import de.chiller.vigral.algorithm.AbstractAlgorithm;
import de.chiller.vigral.graph.ElementState;
import de.chiller.vigral.graph.ElementType;
import de.chiller.vigral.graph.GraphElement;
import de.chiller.vigral.graph.Vertex;
import de.chiller.vigral.util.Pair;


public class MyAlgorithm extends AbstractAlgorithm {

	@Override
	public String getAlgorithmName() {
		String name = "My complex Algorithm";
		return name;
	}

	@Override
	public ArrayList<Pair<ElementType, String>> getRequirements() {
		return null;
	}

	@Override
	public void setRequirements(ArrayList<GraphElement> arg0) {
		
	}
	
	@Override
	public void perform() {
		
		int stepnr = 0;
		for(Vertex v : mGraph.getVertices()) {
			stepnr++;
			v.setState(ElementState.ACTIVE);
			addStep("Step "+ stepnr +": mark Node '"+ v.getLabel() +"' as active");
		}
		
		
		for(Vertex v : mGraph.getVertices()) {
			stepnr++;
			v.setState(ElementState.FINISHED_AND_NOT_RELEVANT);
			addStep(mGraph, "Step "+ stepnr +": mark Node '"+ v.getIdentifier() +"' as finished");
		}
		
	}
}

Now you want to add your algorithm to the vigral software. You first have to export your algorithm by rightclicking the source file (here: MyAlgorithm.java) in eclipse and hit 'Export'.

  • In the Export wizard you have to choose 'Java -> JAR file' and hit next.
  • In the 'JAR File Specification' dialog, you have to check 'Export generated class file and resources' and 'Compress the contents of the JAR file'. All other checkboxes should be unchecked.
  • The next thing you HAVE TO do, is to change the name of the JAR file to the name of the '.java' file, that you want to export, so in my case I have to choose the name 'MyAlgorithm.jar'.
  • By clicking 'Finish', the jar file should be created with your algorithm and all inner classes in it. This file you have to copy to the 'plugins' folder of the vigral software.

Thats it! You are done! Congratulations to your first implemented Vigral plugin!

Clone this wiki locally