Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pyAmak - noyau
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
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SMAC
AMAK
Python
PyAMAK
pyAmak - noyau
Commits
c472376e
Commit
c472376e
authored
4 years ago
by
shinedday
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
https://gitlab.com/be-pyamak/pyamak-noyau
parents
0c4f6a36
63db7c8c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pyAmakCore/classes/communicating_agent.py
+11
-4
11 additions, 4 deletions
pyAmakCore/classes/communicating_agent.py
pyAmakCore/tests/test_communicating_agent/test_mail.py
+4
-3
4 additions, 3 deletions
pyAmakCore/tests/test_communicating_agent/test_mail.py
with
15 additions
and
7 deletions
pyAmakCore/classes/communicating_agent.py
+
11
−
4
View file @
c472376e
...
@@ -17,10 +17,11 @@ class Mail:
...
@@ -17,10 +17,11 @@ class Mail:
Class message
Class message
"""
"""
def
__init__
(
self
,
id_sender
:
int
,
id_receiver
:
int
,
message
:
Any
)
->
None
:
def
__init__
(
self
,
id_sender
:
int
,
id_receiver
:
int
,
message
:
Any
,
sending_date
:
int
)
->
None
:
self
.
__id_sender
=
id_sender
self
.
__id_sender
=
id_sender
self
.
__id_receiver
=
id_receiver
self
.
__id_receiver
=
id_receiver
self
.
__message
=
message
self
.
__message
=
message
self
.
__sending_date
=
sending_date
def
get_id_sender
(
self
):
def
get_id_sender
(
self
):
"""
"""
...
@@ -40,6 +41,12 @@ class Mail:
...
@@ -40,6 +41,12 @@ class Mail:
"""
"""
return
self
.
__message
return
self
.
__message
def
get_sending_date
(
self
):
"""
return sending_date
"""
return
self
.
__sending_date
class
Mailbox
:
class
Mailbox
:
"""
"""
...
@@ -72,7 +79,7 @@ class Mailbox:
...
@@ -72,7 +79,7 @@ class Mailbox:
"""
"""
this method is called to send a message
this method is called to send a message
"""
"""
mail
=
Mail
(
self
.
__owner_id
,
id_receiver
,
message
)
mail
=
Mail
(
self
.
__owner_id
,
id_receiver
,
message
,
self
.
__amas
.
get_cycle
()
)
for
agent
in
self
.
__amas
.
get_agents
():
for
agent
in
self
.
__amas
.
get_agents
():
if
agent
.
get_id
()
==
id_receiver
:
if
agent
.
get_id
()
==
id_receiver
:
...
@@ -106,12 +113,12 @@ class CommunicatingAgent(Agent):
...
@@ -106,12 +113,12 @@ class CommunicatingAgent(Agent):
Override of phase 1 agent so he read mail before he perceive
Override of phase 1 agent so he read mail before he perceive
this is the first phase of a cycle
this is the first phase of a cycle
"""
"""
self
.
_
read_mails
()
self
.
read_mails
()
self
.
on_perceive
()
self
.
on_perceive
()
self
.
compute_criticality
()
self
.
compute_criticality
()
self
.
_next_phase
()
self
.
_next_phase
()
def
_
read_mails
(
self
)
->
None
:
def
read_mails
(
self
)
->
None
:
"""
"""
method that open all mail in the mailbox
method that open all mail in the mailbox
"""
"""
...
...
This diff is collapsed.
Click to expand it.
pyAmakCore/tests/test_communicating_agent/test_mail.py
+
4
−
3
View file @
c472376e
...
@@ -15,17 +15,18 @@ class TestMail(TestCase):
...
@@ -15,17 +15,18 @@ class TestMail(TestCase):
"""
"""
Test mail init
Test mail init
"""
"""
mail
=
Mail
(
1
,
5
,
None
)
mail
=
Mail
(
1
,
5
,
None
,
0
)
self
.
assertEqual
(
mail
.
get_id_sender
(),
1
)
self
.
assertEqual
(
mail
.
get_id_sender
(),
1
)
self
.
assertEqual
(
mail
.
get_id_receiver
(),
5
)
self
.
assertEqual
(
mail
.
get_id_receiver
(),
5
)
self
.
assertEqual
(
mail
.
get_message
(),
None
)
self
.
assertEqual
(
mail
.
get_message
(),
None
)
self
.
assertEqual
(
mail
.
get_sending_date
(),
0
)
mail
=
Mail
(
255
,
0
,
"
test
"
)
mail
=
Mail
(
255
,
0
,
"
test
"
,
12
)
self
.
assertEqual
(
mail
.
get_id_sender
(),
255
)
self
.
assertEqual
(
mail
.
get_id_sender
(),
255
)
self
.
assertEqual
(
mail
.
get_id_receiver
(),
0
)
self
.
assertEqual
(
mail
.
get_id_receiver
(),
0
)
self
.
assertEqual
(
mail
.
get_message
(),
"
test
"
)
self
.
assertEqual
(
mail
.
get_message
(),
"
test
"
)
self
.
assertEqual
(
mail
.
get_sending_date
(),
12
)
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
main
()
main
()
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