All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.ericaro.diezel.core.builder.DiezelLanguage Maven / Gradle / Ivy

The newest version!
package net.ericaro.diezel.core.builder;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;


import edu.uci.ics.jung.graph.DirectedGraph;

public class DiezelLanguage  implements Compilable{

	String header ;
	String expression; // the regexp defining the workfow
	String packageName; // global conf: the target package name
	String guideBaseName = "Guide";
	List rootTypes = new ArrayList(); // the root state generics, always usefull to start with
	List transitions = new ArrayList();
	//List states = new ArrayList();

	// result of compilation
	transient DirectedGraph graph; // graph computed from the expression expression
	transient State start, end;
	
	DiezelLanguage() {
		super();
	}

	public String getExpression() {
		return expression;
	}


	public String getPackageName() {
		return packageName;
	}


	public String getGuideName() {
		return guideBaseName;
	}


	public String getHeader() {
		return header;
	}



	public List getTransitions() {
		return transitions;
	}
	public Collection getStates(){
		return graph.getVertices();
	}
	
	public DirectedGraph getGraph() {
		return graph;
	}

	/**
	 *   print the current graph in a graphviz format.
	 */
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("digraph {\n");
		for (State s : graph.getVertices()) 
			sb.append(s.toString()).append(";\n");
		
		for (TransitionInstance t: graph.getEdges()) 
			sb.append(t.toString()).append(";\n");
		sb.append("}\n");
		return sb.toString();
	}

	
	
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy