net.ericaro.diezel.core.builder.TransitionInstance Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of diezel-maven-plugin Show documentation
Show all versions of diezel-maven-plugin Show documentation
An Embedded Domain Specific Language Parser Generator PLugin compiler
The newest version!
package net.ericaro.diezel.core.builder;
import java.util.Collection;
import edu.uci.ics.jung.graph.DirectedGraph;
/** Transitions are instanciated several times among the graph, therefore they are in reality "instances", and this class represent them
*
* @author eric
*
*/
public class TransitionInstance {
Transition prototype;
private DirectedGraph graph;
public TransitionInstance(Transition prototype, DirectedGraph graph) {
super();
this.prototype = prototype;
this.graph = graph;
}
public Collection extends Generic> getPush() {
return prototype.getPushes();
}
public Collection extends Generic> getPull() {
return prototype.getPulls();
}
public String getAlias() {
return prototype.getAlias();
}
public String getJavadoc() {
return prototype.getJavadoc();
}
public State getNextState() {
return graph.getDest(this);
}
public String getReturnType() {
return prototype.getReturnType();
}
public String getSignature() {
return prototype.getSignature();
}
public String toString(){
StringBuilder sb = new StringBuilder();
sb.append(graph.getSource(this).getName()).append(" -> ").append(getNextState().getName() ).append("[label=\"" +getAlias()+":"+getSignature() + "\"]");
return sb.toString();
}
}