Skip to content
Snippets Groups Projects
Commit 5801b504 authored by Peter Wagenhuber's avatar Peter Wagenhuber
Browse files

sequences listen generrierung von testtreiber nach Nloc.java verschoben

parent f67f1cd9
No related branches found
No related tags found
No related merge requests found
......@@ -16,10 +16,42 @@ public class Nloc {
this.dropletList = new ArrayList<Droplet>();
}
// public void addChannel(Channel chan) {
// chanlist.add(chan);
// }
//
public List<List<SequenceTuple>>
getPossibleSequences(String[] modulesToVisit) throws NoSuchModuleException {
Droplet payloadDroplet = new Droplet(DropletType.PAYLOAD,"p");
List<List<SequenceTuple>> sequences = new ArrayList<List<SequenceTuple>>();
List<List<Channel>> pathlist = this.getAllPaths();
try {
List<Channel> moduleChanList =
this.getModulesByName(Arrays.asList(modulesToVisit));
List<Channel> payloadPath = this.getDesiredPath(moduleChanList, pathlist);
SequenceTuple plt = new SequenceTuple(p,payloadPath,0,0);
List<SequenceTuple> s1 = new ArrayList<SequenceTuple>();
s1.add(plt);
sequences.add(s1);
List<Channel> bifurcationList = this.getBifurcationList(payloadPath);
for (int i = bifurcationList.size() - 1; i >= 0; --i) {
Channel currentBifurcation = bifurcationList.get(i);
List<List<SequenceTuple>> tmpSeqs = new ArrayList<List<SequenceTuple>>();
for (List<SequenceTuple> stl: sequences) {
tmpSeqs.addAll(
this.getSequencesAtBifurcation(stl, currentBifurcation));
}
sequences = tmpSeqs;
}
} catch (Exception e) {
System.out.println( e.getMessage());
}
}
public void addChannel(Channel chan) {
chanlist.add(chan);
}
......@@ -133,17 +165,20 @@ public class Nloc {
return found;
}
public Channel getModuleByName(String name) {
public Channel getModuleByName(String name) throws NoSuchModuleException {
Channel found = null;
for (Channel ch: chanlist) {
if (ch.getName().equals(name)) {
found = ch;
}
}
if (found == null) throw new NoSuchModuleException(name);
return found;
}
public List<Channel> getModulesByName(List<String> names) {
public List<Channel> getModulesByName(List<String> names)
throws NoSuchModuleException {
List<Channel> ret = new ArrayList<Channel>();
for (String name : names) {
Channel ch = getModuleByName(name);
......@@ -179,9 +214,6 @@ public class Nloc {
}
}
//public List<List<SequenceTuple>> getSequencesAtBifurcation(
// List<SequenceTuple> seqTup, SequenceTuple currentSeqTup,
// Channel currentBifurcation) {
public List<List<SequenceTuple>> getSequencesAtBifurcation(
List<SequenceTuple> seqTup, Channel currentBifurcation) {
......
package nloc;
public class NoSuchModuleException extends Exception {
public NoSuchModuleException () {
super();
}
public NoSuchModuleException (String message) {
super(message);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment