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
d09f8f40
Commit
d09f8f40
authored
8 years ago
by
Peter Wagenhuber
Browse files
Options
Downloads
Patches
Plain Diff
pfadgenerierung mit 2 verschiedenen nlocs
parent
b04668f6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
build/dsgen.jar
+0
-0
0 additions, 0 deletions
build/dsgen.jar
build/nloc/Nloc.class
+0
-0
0 additions, 0 deletions
build/nloc/Nloc.class
src/Nloc.java
+73
-31
73 additions, 31 deletions
src/Nloc.java
with
73 additions
and
31 deletions
build/dsgen.jar
+
0
−
0
View file @
d09f8f40
No preview for this file type
This diff is collapsed.
Click to expand it.
build/nloc/Nloc.class
+
0
−
0
View file @
d09f8f40
No preview for this file type
This diff is collapsed.
Click to expand it.
src/Nloc.java
+
73
−
31
View file @
d09f8f40
...
...
@@ -6,6 +6,78 @@ import java.util.Stack;
public
class
Nloc
{
public
static
void
main
(
String
[]
args
)
{
Channel
p0
=
getNloc0
();
List
<
List
<
Channel
>>
pathlist
=
getAllPaths
(
p0
,
new
ArrayList
<
Channel
>());
printPaths
(
pathlist
);
}
public
static
void
printPaths
(
List
<
List
<
Channel
>>
pathlist
)
{
System
.
out
.
println
(
"Number of paths found: "
+
pathlist
.
size
());
for
(
List
<
Channel
>
p
:
pathlist
)
{
for
(
Channel
ch
:
p
)
{
System
.
out
.
print
(
"ID: "
+
ch
.
getID
()
+
" "
);
}
System
.
out
.
println
(
""
);
}
}
public
static
List
<
List
<
Channel
>>
getAllPaths
(
Channel
chan
,
List
<
Channel
>
path
)
{
List
<
List
<
Channel
>>
pl
=
new
ArrayList
<
List
<
Channel
>>();
getAllPathsRecursive
(
chan
,
path
,
pl
);
return
pl
;
}
public
static
void
getAllPathsRecursive
(
Channel
chan
,
List
<
Channel
>
path
,
List
<
List
<
Channel
>>
pathlist
)
{
path
.
add
(
chan
);
if
(
chan
.
getChildren
().
size
()
==
0
)
{
pathlist
.
add
(
path
);
}
else
{
for
(
Channel
ch
:
chan
.
getChildren
())
{
getAllPathsRecursive
(
ch
,
new
ArrayList
<
Channel
>(
path
),
pathlist
);
}
}
}
public
static
Channel
getNloc0
()
{
Channel
chan0
=
new
Channel
(
6
,
6
);
Channel
chan1
=
new
Channel
(
8
,
8
);
Channel
chan2
=
new
Channel
(
9
,
9
);
Channel
chan3
=
new
Channel
(
11
,
12
);
Channel
chan4
=
new
Channel
(
19
,
21
);
Channel
chan5
=
new
Channel
(
5
,
5
);
Channel
chan6
=
new
Channel
(
8
,
8
);
Channel
chan7
=
new
Channel
(
9
,
10
);
Channel
chan8
=
new
Channel
(
25
,
28
);
Module
m0
=
new
Module
(
"m0"
,
22
,
10
);
Module
m1
=
new
Module
(
"m1"
,
10
,
10
);
Pump
p0
=
new
Pump
();
Sink
s0
=
new
Sink
();
p0
.
addChild
(
chan0
);
chan0
.
addChild
(
chan1
);
chan1
.
addChild
(
chan2
);
chan1
.
addChild
(
chan3
);
chan2
.
addChild
(
chan4
);
chan3
.
addChild
(
chan5
);
chan5
.
addChild
(
m0
);
m0
.
addChild
(
chan6
);
chan4
.
addChild
(
chan7
);
chan6
.
addChild
(
chan7
);
chan7
.
addChild
(
m1
);
m1
.
addChild
(
chan8
);
chan8
.
addChild
(
s0
);
return
p0
;
}
public
static
Channel
getNloc3
()
{
Channel
chan0
=
new
Channel
(
6
,
6
);
Channel
chan1
=
new
Channel
(
8
,
8
);
Channel
chan2
=
new
Channel
(
9
,
9
);
...
...
@@ -46,36 +118,6 @@ public class Nloc {
chan9
.
addChild
(
chan10
);
chan10
.
addChild
(
s0
);
List
<
List
<
Channel
>>
pathlist
=
getAllPaths
(
p0
,
new
ArrayList
<
Channel
>());
printPaths
(
pathlist
);
}
public
static
void
printPaths
(
List
<
List
<
Channel
>>
pathlist
)
{
System
.
out
.
println
(
"Number of paths found: "
+
pathlist
.
size
());
for
(
List
<
Channel
>
p
:
pathlist
)
{
for
(
Channel
ch
:
p
)
{
System
.
out
.
print
(
"ID: "
+
ch
.
getID
()
+
" "
);
}
System
.
out
.
println
(
""
);
}
}
public
static
List
<
List
<
Channel
>>
getAllPaths
(
Channel
chan
,
List
<
Channel
>
path
)
{
List
<
List
<
Channel
>>
pl
=
new
ArrayList
<
List
<
Channel
>>();
getAllPathsRecursive
(
chan
,
path
,
pl
);
return
pl
;
}
public
static
void
getAllPathsRecursive
(
Channel
chan
,
List
<
Channel
>
path
,
List
<
List
<
Channel
>>
pathlist
)
{
path
.
add
(
chan
);
if
(
chan
.
getChildren
().
size
()
==
0
)
{
pathlist
.
add
(
path
);
}
else
{
for
(
Channel
ch
:
chan
.
getChildren
())
{
getAllPathsRecursive
(
ch
,
new
ArrayList
<
Channel
>(
path
),
pathlist
);
}
}
return
p0
;
}
}
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