Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Groupe 6
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AILLET Gabriel
Groupe 6
Commits
22ca708c
Commit
22ca708c
authored
2 years ago
by
gabriel
Browse files
Options
Downloads
Patches
Plain Diff
final
parent
ad6d2204
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.classpath
+2
-0
2 additions, 0 deletions
.classpath
src/Classes/ReseauPetri.java
+19
-5
19 additions, 5 deletions
src/Classes/ReseauPetri.java
src/Classes/Transition.java
+4
-0
4 additions, 0 deletions
src/Classes/Transition.java
with
25 additions
and
5 deletions
.classpath
+
2
−
0
View file @
22ca708c
...
...
@@ -8,5 +8,7 @@
</classpathentry>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.junit.JUNIT_CONTAINER/5"
/>
<classpathentry
kind=
"src"
path=
"/test"
/>
<classpathentry
kind=
"lib"
path=
"/mapd-pne-code (1).zip_expanded/lib/javax.xml.bind.jar"
/>
<classpathentry
kind=
"lib"
path=
"/mapd-pne-code (1).zip_expanded/lib/pn-imta-initial-models-and-adapters.jar"
/>
<classpathentry
kind=
"output"
path=
"bin"
/>
</classpath>
This diff is collapsed.
Click to expand it.
src/Classes/ReseauPetri.java
+
19
−
5
View file @
22ca708c
...
...
@@ -11,6 +11,15 @@ public class ReseauPetri implements InterfaceReseauPetri{
this
.
placeList
=
new
LinkedList
<
Place
>();
this
.
transitionList
=
new
LinkedList
<
Transition
>();
}
public
LinkedList
<
Arc
>
getArcList
(){
return
this
.
arcList
;
}
public
LinkedList
<
Transition
>
getTransitionList
(){
return
this
.
transitionList
;
}
public
LinkedList
<
Place
>
getPlaceList
()
{
return
this
.
placeList
;
}
@Override
public
boolean
Fire
(
Transition
t
)
{
if
(
t
.
isActivable
())
{
...
...
@@ -42,7 +51,9 @@ public class ReseauPetri implements InterfaceReseauPetri{
@Override
public
boolean
Add
(
Arc
an
)
{
an
.
getTransition
().
addArcToList
(
an
);
return
this
.
arcList
.
add
(
an
);
}
@Override
...
...
@@ -55,11 +66,16 @@ public class ReseauPetri implements InterfaceReseauPetri{
@Override
public
boolean
Remove
(
Place
p
)
{
LinkedList
<
Arc
>
listArc
=
new
LinkedList
<
Arc
>();
for
(
int
i
=
0
;
i
<
this
.
arcList
.
size
();
i
++)
{
if
(
this
.
arcList
.
get
(
i
).
getPlace
().
equals
(
p
))
{
this
.
Remove
(
this
.
arcList
.
get
(
i
));
listArc
.
add
(
this
.
arcList
.
get
(
i
));
}
}
for
(
int
i
=
0
;
i
<
listArc
.
size
();
i
++){
this
.
Remove
(
listArc
.
get
(
i
));
}
return
this
.
placeList
.
remove
(
p
);
}
...
...
@@ -156,10 +172,8 @@ public class ReseauPetri implements InterfaceReseauPetri{
Place
p1
=
new
Place
(
1
,
0
);
Place
p2
=
new
Place
(
1
,
1
);
Transition
t1
=
new
Transition
(
0
);
ArcVideur
a1
=
new
ArcVideur
(
p1
,
t1
);
Arc
a2
=
new
Arc
(
1
,
p2
,
0
,
t1
);
t1
.
getArcList
().
add
(
a1
);
t1
.
getArcList
().
add
(
a2
);
Arc
a1
=
new
Arc
(
1
,
p1
,
1
,
t1
);
Arc
a2
=
new
Arc
(
2
,
p2
,
0
,
t1
);
t
.
Add
(
a1
);
t
.
Add
(
a2
);
t
.
Add
(
p1
);
...
...
This diff is collapsed.
Click to expand it.
src/Classes/Transition.java
+
4
−
0
View file @
22ca708c
...
...
@@ -27,6 +27,9 @@ public class Transition {
public
void
setArcList
(
LinkedList
<
Arc
>
arcList
)
{
this
.
arcList
=
arcList
;
}
public
void
addArcToList
(
Arc
a
)
{
this
.
arcList
.
add
(
a
);
}
/**
* @return the finalID
*/
...
...
@@ -36,6 +39,7 @@ public class Transition {
public
boolean
isActivable
()
{
for
(
int
i
=
0
;
i
<
this
.
arcList
.
size
();
i
++)
{
if
(
this
.
arcList
.
get
(
i
).
isActivable
()
==
false
)
{
System
.
out
.
print
(
arcList
.
get
(
i
).
getDestination
());
return
false
;
}
...
...
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