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

found out problem stated in issue #3

parent 13b5c101
No related branches found
No related tags found
No related merge requests found
......@@ -70,7 +70,7 @@ public class Nloc {
public List<BFTableEntry> initializeBifTable(List<Channel> desiredPath) {
List<BFTableEntry> bftable = new ArrayList<BFTableEntry>();
ListIterator<Channel> iter = path.listIterator();
ListIterator<Channel> iter = desiredPath.listIterator();
while(iter.hasNext()) {
Channel current = iter.next();
if (current.isBifurcation()) {
......@@ -142,14 +142,15 @@ public class Nloc {
return allInSink;
}
public List<Channel> getDesiredPath(List<Channel> modules,
public List<List<Channel>> getDesiredPath(List<Channel> modules,
List<List<Channel>> pathlist) throws NlocStructureException {
List<Channel> found = new ArrayList<Channel>();
List<List<Channel>> found = new ArrayList<List<Channel>>();
for (List<Channel> path : pathlist) {
if (path.containsAll(modules) && found.isEmpty()) {
found = path;
} else if (path.containsAll(modules) && !found.isEmpty()) {
throw new NlocStructureException("Paths are not unique!");
//if (path.containsAll(modules) && found.isEmpty()) {
if (path.containsAll(modules)) {
found.add(path);
//} else if (path.containsAll(modules) && !found.isEmpty()) {
// throw new NlocStructureException("Paths are not unique!");
}
}
if (found.isEmpty()) {
......
......@@ -8,25 +8,29 @@ import java.util.Arrays;
public class TestNloc {
// TODO: @peda find new algorithm
public static void main(String[] args) {
Nloc nlS1 = new Nloc(getNlocS1());
Nloc nlS2 = new Nloc(getNlocS2());
Nloc nlS6 = new Nloc(getNlocS6());
//Nloc nlSX = new Nloc(getNlocS1());
//Nloc nlSX = new Nloc(getNlocS2());
Nloc nlSX = new Nloc(getNlocS6());
List<List<Channel>> pathlist = nlS2.getAllPaths();
List<List<Channel>> pathlist = nlSX.getAllPaths();
try {
List<Channel> modulesToVisit = nlSX.getModulesByName(Arrays.asList("m4","m1","m3","h0","m5"));
List<List<Channel>> payloadPaths = nlSX.getDesiredPath(modulesToVisit, pathlist);
printPaths(pathlist);
Pump pump = nlS2.getPump();
Channel ch = nlS2.getModuleByName("ch26");
List<List<Channel>> pathlist1 = nlS2.getAllPathsFromTo(pump, ch);
Pump pump = nlSX.getPump();
Channel ch = nlSX.getModuleByName("ch15");
List<List<Channel>> pathlist1 = nlSX.getAllPathsFromTo(pump, ch);
printPaths(pathlist1);
printPaths(pathlist);
printPaths(payloadPaths);
//printPaths(pathlist1);
} catch (Exception e) {
System.out.println( e.getMessage());
}
}
public static void printPath(List<Channel> path) {
......@@ -259,8 +263,8 @@ public class TestNloc {
Channel ch7 = new Channel("ch7",1,1);
Channel ch8 = new Channel("ch8",1,1);
Channel ch9 = new Channel("ch9",1,1);
Channel ch10 = new Channel("ch10",1,1);
Channel ch11 = new Channel("ch11",3,3);
Channel ch10 = new Channel("ch10",3,3);
Channel ch11 = new Channel("ch11",1,1);
Channel ch12 = new Channel("ch12",1,1);
Channel ch13 = new Channel("ch13",1,1);
Channel ch14 = new Channel("ch14",3,3);
......
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