Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ protected boolean addAdditionalFiles(final String source) {
* @throws IOException
* @throws CoreException
*/
protected boolean addAddtionalFile(final File fileToBeAdded) throws IOException, CoreException {
public boolean addAddtionalFile(final File fileToBeAdded) throws IOException, CoreException {
final IFolder libFolder = this.project.getFolder(Constants.pathsForLibrariesInDevProject);
if (!libFolder.exists()) {
libFolder.create(true, true, null);
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

public class GeneratorClass {

private String packageName;
private Set<String> imports;
private String modifier;
private String className;
private List<GeneratorMethod> methods;
protected String packageName;
protected Set<String> imports;
protected String modifier;
protected String className;
protected List<GeneratorMethod> methods;
private File associatedFile;

public GeneratorClass() {
Expand Down Expand Up @@ -122,5 +122,4 @@ public String toString() {
classContent.append("}");
return classContent.toString();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@
import java.util.Map.Entry;
import java.util.Set;

import de.cognicrypt.utils.Utils;

public class GeneratorMethod {

private String modifier;
private String returnType;
private String name;
protected String modifier;
protected String returnType;
protected String name;
private List<Entry<String, String>> parameters;
private Set<String> exceptions;
private StringBuilder body;
private List<Entry<String, String>> variableDeclarations;
protected Set<String> exceptions;
protected StringBuilder body;
protected List<Entry<String, String>> variableDeclarations;
private List<Entry<String, String>> postCGVars;
private StringBuilder killStatements;
private int templateVariables;
Expand Down Expand Up @@ -190,5 +192,8 @@ public void addPostCGVars(Entry<String, String> postCGVar) {
public List<Entry<String, String>> getPostCGVars() {
return postCGVars;
}


public StringBuilder getKillStatements() {
return killStatements;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.util.List;

import crypto.rules.StateMachineGraph;
import crypto.rules.StateNode;
import crypto.rules.TransitionEdge;
import de.cognicrypt.utils.CrySLUtils;

Expand All @@ -30,9 +29,9 @@
*/
public class StateMachineGraphAnalyser {

private StateMachineGraph stateMachine;
private ArrayList<String> usedTransitions = new ArrayList<String>();
private ArrayList<List<TransitionEdge>> allTransitions;
protected StateMachineGraph stateMachine;
protected ArrayList<String> usedTransitions = new ArrayList<String>();
protected ArrayList<List<TransitionEdge>> allTransitions;

public StateMachineGraphAnalyser(StateMachineGraph stateMachine) {
this.stateMachine = stateMachine;
Expand All @@ -42,23 +41,20 @@ public StateMachineGraphAnalyser(StateMachineGraph stateMachine) {
// Current solution: Take every loop once.
// This solution does not distinguish between the two operates
// + and * of the crysl language
public ArrayList<List<TransitionEdge>> getTransitions() throws Exception {
public ArrayList<List<TransitionEdge>> getTransitions() {
allTransitions = new ArrayList<List<TransitionEdge>>();

//Collection<StateNode> nodes = stateMachine.getNodes();
List<TransitionEdge> edges = stateMachine.getEdges();
//Collection<StateNode> acceptingNodes = stateMachine.getAcceptingStates();

TransitionEdge initialTransition = stateMachine.getInitialTransition();
StateNode initialState = initialTransition.getLeft();
List<TransitionEdge> initialTransitions = (List<TransitionEdge>) stateMachine.getInitialTransition();
for (TransitionEdge initialTransition : initialTransitions) {

if (!initialState.getInit()) {
throw new Exception("No initial state found for state machine!");
}

List<TransitionEdge> transitions = new ArrayList<TransitionEdge>();
List<TransitionEdge> transitions = new ArrayList<TransitionEdge>();

visitNode(edges, initialTransition, transitions);
visitNode(edges, initialTransition, transitions);
}

return allTransitions;
}
Expand Down
2 changes: 2 additions & 0 deletions plugins/de.cognicrypt.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ Export-Package: boomerang;
com.google.common.collect,
sync.pds.solver,
wpds.impl",
com.google.common.base,
com.google.common.collect,
crypto;
uses:="ideal,
crypto.rules,
Expand Down
7 changes: 7 additions & 0 deletions plugins/de.cognicrypt.core/src/de/cognicrypt/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,11 @@ public static boolean isSubType(String typeOne, String typeTwo) {
}
return subTypes;
}

public static String retrieveOnlyClassName(String className) {
String[] values = className.split("\\.");
String value = values[values.length-1];
String[] names = value.split("\\$");
return names[names.length-1];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,11 @@ public void resourceChanged(IResourceChangeEvent event) {
&& (delta.getKind() == IResourceDelta.ADDED || delta.getKind() == IResourceDelta.CHANGED)) {
IProject project = (IProject) deltaResource;
try {
if (!CrySLBuilderUtils.hasCrySLBuilder(project) && CrySLBuilderUtils.hasCrySLFiles(project)) {
CrySLBuilderUtils.addCrySLBuilderToProject(project);
if(project.isOpen())
{
if (!CrySLBuilderUtils.hasCrySLBuilder(project) && CrySLBuilderUtils.hasCrySLFiles(project)) {
CrySLBuilderUtils.addCrySLBuilderToProject(project);
}
}
}
catch (CoreException e) {
Expand Down