Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
droplet-sequence-generator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pedatestcontrib
droplet-sequence-generator
Commits
eba56a3e
Commit
eba56a3e
authored
7 years ago
by
Peter Wagenhuber
Browse files
Options
Downloads
Patches
Plain Diff
leider sinnoser versuch mit dem sanitizen der sequenzen
parent
5801b504
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Nloc.java
+87
-7
87 additions, 7 deletions
src/Nloc.java
src/SequenceTuple.java
+38
-0
38 additions, 0 deletions
src/SequenceTuple.java
src/TestNloc.java
+14
-35
14 additions, 35 deletions
src/TestNloc.java
with
139 additions
and
42 deletions
src/Nloc.java
+
87
−
7
View file @
eba56a3e
...
...
@@ -16,8 +16,86 @@ public class Nloc {
this
.
dropletList
=
new
ArrayList
<
Droplet
>();
}
public
List
<
List
<
SequenceTuple
>>
getPossibleSequences
(
String
[]
modulesToVisit
)
throws
NoSuchModuleException
{
// public List<List<SequenceTuple>> sanitizeSequences(
// List<List<SequenceTuple>> possibleSequences) {
//
// List<List<SequenceTuple>> tmpSeqs =
// new ArrayList<List<SequenceTuple>>();
//
// for(List<SequenceTuple> seqTupList: possibleSequences) {
//
// List<SequenceTuple> tmpStl = new ArrayList<SequenceTuple>(seqTupList);
//
// for (SequenceTuple seqTup: seqTupList) {
//
// if (seqTup.getDroplet().getType() != DropletType.PAYLOAD) {
//
// List<Channel> hPath = seqTup.getPath();
//
// // generate sublist for comaparison containing the rest of the
// // sequence tuples
// List<SequenceTuple> compList =
// seqTupList.sublist(seqTupList.indexOf(seqTup),
// seqTupList.size() - 1);
//
// for (SequenceTuple compTuple: compList) {
// List<Channel> cPath = compTuple.getPath();
//
// if (seqTup.overlaps(compTuple)) {
// // check if path is the same
// // if so then merge the droplets to one
// // if not adjust the min and max position
// // if the adjustment is not possible remove the sequence
// if (hPath.equals(cPath)) {
// SequenceTuple newTup = SequenceTuple.merge(seqTup,compTuple);
// tmpStl.remove(seqTup);
// tmpStl.remove(compTuple);
// tmpStl.add(newTup);
// } // end paths are equal
// else {
// int hMin = seqTup.getMinPos();
// int hMax = seqTup.getMaxPos();
// int cMin = compTuple.getMaxPos();
// int cMax = compTuple.getMaxPos();
// if (hMin == hMax && cMin == cMax) {
// tmpStl.clear();
// } else if ((hMax - hMin) < (cMax - cMin)) {
// if (hMax < cMax) {
// compTuple.setMinPos(hMax + 1);
// } else {
// compTuple.setMaxPos(hMin - 1);
// }
// } else if ((hMax - hMin) > (cMax - cMin)) {
// if (cMax < hMax) {
// seqTup.setMinPos(cMax + 1);
// } else {
// seqTup.setMaxPos(cMin - 1);
// }
// } else if ((hMax - hMin) > (cMax - cMin)) {
// if (hMin == cMin) {
//
// } else if (hMin < cMin) {
// seqTup.setMaxPos(cMin - 1);
// } else {
// compTuple.setMaxPos(hMin - 1);
// }
// }
//
// } // end paths are not equal
//
// } // typles overlap
// } // end iter restlist
// } // payload droplet
// } // end iter sequence
// if (!tmpStl.isEmpty()) {
// tmpSeqs.add(tmpStl);
// }
// } // end iter possibleSequences
// return tmpSeqs;
// }
public
List
<
List
<
SequenceTuple
>>
getPossibleSequences
(
String
[]
modulesToVisit
)
throws
NoSuchModuleException
{
Droplet
payloadDroplet
=
new
Droplet
(
DropletType
.
PAYLOAD
,
"p"
);
...
...
@@ -25,12 +103,12 @@ public class Nloc {
List
<
List
<
Channel
>>
pathlist
=
this
.
getAllPaths
();
try
{
// Create initial list of possilbe sequences
List
<
Channel
>
moduleChanList
=
this
.
getModulesByName
(
Arrays
.
asList
(
modulesToVisit
));
List
<
Channel
>
payloadPath
=
this
.
getDesiredPath
(
moduleChanList
,
pathlist
);
SequenceTuple
plt
=
new
SequenceTuple
(
p
,
payloadPath
,
0
,
0
);
SequenceTuple
plt
=
new
SequenceTuple
(
payloadDroplet
,
payloadPath
,
0
,
0
);
List
<
SequenceTuple
>
s1
=
new
ArrayList
<
SequenceTuple
>();
s1
.
add
(
plt
);
...
...
@@ -38,6 +116,8 @@ public class Nloc {
List
<
Channel
>
bifurcationList
=
this
.
getBifurcationList
(
payloadPath
);
// actually compile list of sequences going through the bifurcations from
// "end" to "start"
for
(
int
i
=
bifurcationList
.
size
()
-
1
;
i
>=
0
;
--
i
)
{
Channel
currentBifurcation
=
bifurcationList
.
get
(
i
);
List
<
List
<
SequenceTuple
>>
tmpSeqs
=
new
ArrayList
<
List
<
SequenceTuple
>>();
...
...
@@ -50,6 +130,7 @@ public class Nloc {
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
return
sequences
;
}
public
void
addChannel
(
Channel
chan
)
{
...
...
@@ -284,7 +365,7 @@ public class Nloc {
int
newTupleMinPos
=
minPos
-
(
pathLenCurrDroplet
-
minPathLenNewDroplet
);
int
newTupleMaxPos
=
maxPos
-
(
pathLenCurrDroplet
-
m
in
PathLenNewDroplet
);
maxPos
-
(
pathLenCurrDroplet
-
m
ax
PathLenNewDroplet
);
tmpTuple
.
setMinPos
(
newTupleMinPos
);
tmpTuple
.
setMaxPos
(
newTupleMaxPos
);
...
...
@@ -297,7 +378,6 @@ public class Nloc {
possibleSequences
.
add
(
seqTupList
);
}
}
else
{
// TODO
if
(
dropletPath
.
contains
(
currentBifurcation
)
&&
prio
>
0
)
{
System
.
out
.
println
(
"NOT at last sequence tuple and "
);
System
.
out
.
println
(
"Adding header droplet(s) to: "
+
currentSeqTup
.
getDroplet
().
getName
()
+
": "
+
currentSeqTup
.
getMinPos
());
...
...
@@ -338,7 +418,7 @@ public class Nloc {
int
newTupleMinPos
=
minPos
-
(
pathLenCurrDroplet
-
minPathLenNewDroplet
);
int
newTupleMaxPos
=
maxPos
-
(
pathLenCurrDroplet
-
m
in
PathLenNewDroplet
);
maxPos
-
(
pathLenCurrDroplet
-
m
ax
PathLenNewDroplet
);
tmpTuple
.
setMinPos
(
newTupleMinPos
);
tmpTuple
.
setMaxPos
(
newTupleMaxPos
);
...
...
This diff is collapsed.
Click to expand it.
src/SequenceTuple.java
+
38
−
0
View file @
eba56a3e
...
...
@@ -22,6 +22,22 @@ public class SequenceTuple {
this
.
path
=
path
;
}
public
static
SequenceTuple
merge
(
SequenceTuple
first
,
SequenceTuple
second
)
{
int
min
,
max
;
if
(
first
.
getMinPos
()
<
second
.
getMinPos
())
{
min
=
second
.
getMinPos
();
}
else
{
min
=
first
.
getMinPos
();
}
if
(
first
.
getMaxPos
()
>
second
.
getMaxPos
())
{
max
=
second
.
getMaxPos
();
}
else
{
max
=
first
.
getMaxPos
();
}
return
new
SequenceTuple
(
new
Droplet
(
DropletType
.
HEADER
),
first
.
getPath
(),
min
,
max
);
}
public
int
getMinPos
()
{
return
minPos
;
}
...
...
@@ -54,4 +70,26 @@ public class SequenceTuple {
this
.
path
=
path
;
}
public
boolean
overlaps
(
SequenceTuple
other
)
{
int
max
,
min
;
int
otherMin
=
other
.
getMinPos
();
int
otherMax
=
other
.
getMaxPos
();
if
(
maxPos
>
otherMax
)
{
max
=
maxPos
;
}
else
{
max
=
otherMax
;
}
if
(
minPos
<
otherMin
)
{
min
=
minPos
;
}
else
{
min
=
otherMin
;
}
int
thisIntervalLen
=
maxPos
-
minPos
;
int
otherIntervalLen
=
otherMax
-
otherMin
;
int
overallIntervalLen
=
max
-
min
;
return
(
thisIntervalLen
+
otherIntervalLen
)
<=
overallIntervalLen
;
}
}
This diff is collapsed.
Click to expand it.
src/TestNloc.java
+
14
−
35
View file @
eba56a3e
...
...
@@ -16,41 +16,20 @@ public class TestNloc {
//Nloc nlSX = new Nloc(getNlocS7());
Nloc
nlSX
=
new
Nloc
(
getNlocS8
());
Droplet
p
=
new
Droplet
(
DropletType
.
PAYLOAD
,
"p"
);
List
<
List
<
SequenceTuple
>>
sequences
=
new
ArrayList
<
List
<
SequenceTuple
>>();
List
<
List
<
Channel
>>
pathlist
=
nlSX
.
getAllPaths
();
//try {
// List<Channel> chlist = nlSX.getModulesByName(Arrays.asList("ch1","ch3"));
// List<Channel> chlist = nlSX.getModulesByName(Arrays.asList("ch1"));
// System.out.println(nlSX.getHeaderPathlength(chlist));
//} catch(Exception e) {
// System.out.println( e.getMessage());
//}
String
[]
mtv
=
{
"m4"
,
"d1"
,
"m1"
,
"m3"
,
"h0"
,
"m5"
};
try
{
List
<
Channel
>
modulesToVisit
=
nlSX
.
getModulesByName
(
Arrays
.
asList
(
"m4"
,
"d1"
,
"m1"
,
"m3"
,
"h0"
,
"m5"
));
List
<
Channel
>
payloadPath
=
nlSX
.
getDesiredPath
(
modulesToVisit
,
pathlist
);
SequenceTuple
plt
=
new
SequenceTuple
(
p
,
payloadPath
,
0
,
0
);
List
<
SequenceTuple
>
s1
=
new
ArrayList
<
SequenceTuple
>();
s1
.
add
(
plt
);
sequences
.
add
(
s1
);
//TODO: for every bifurc calculate the list of sequences starting with
// single entry for payload droplet
List
<
Channel
>
bifurcationList
=
nlSX
.
getBifurcationList
(
payloadPath
);
//System.out.println(bifurcationList);
for
(
int
i
=
bifurcationList
.
size
()
-
1
;
i
>=
0
;
--
i
)
{
Channel
currentBifurcation
=
bifurcationList
.
get
(
i
);
List
<
List
<
SequenceTuple
>>
tmpSeqs
=
new
ArrayList
<
List
<
SequenceTuple
>>();
System
.
out
.
println
(
"Bif: "
+
currentBifurcation
.
getName
());
for
(
List
<
SequenceTuple
>
stl:
sequences
)
{
tmpSeqs
.
addAll
(
nlSX
.
getSequencesAtBifurcation
(
stl
,
currentBifurcation
));
printSequences
(
tmpSeqs
);
}
sequences
=
tmpSeqs
;
}
List
<
List
<
SequenceTuple
>>
sequences
=
nlSX
.
getPossibleSequences
(
mtv
);
printSequences
(
sequences
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
}
}
...
...
@@ -475,8 +454,8 @@ public class TestNloc {
// channel(name, psteps, hsteps)
Channel
ch1
=
new
Channel
(
"ch1"
,
1
,
1
);
Channel
ch2
=
new
Channel
(
"ch2"
,
3
,
3
);
Channel
ch3
=
new
Channel
(
"ch3"
,
1
,
1
);
Channel
ch2
=
new
Channel
(
"ch2"
,
7
,
7
);
Channel
ch3
=
new
Channel
(
"ch3"
,
4
,
4
);
Channel
ch4
=
new
Channel
(
"ch4"
,
1
,
1
);
Channel
ch5
=
new
Channel
(
"ch5"
,
1
,
1
);
Channel
ch6
=
new
Channel
(
"ch6"
,
1
,
1
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment