Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TP-Java-Rendu
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hepia_2022-2023
Java
TP-Java-Rendu
Commits
86c3056b
Commit
86c3056b
authored
2 years ago
by
alec.schmidt
Browse files
Options
Downloads
Patches
Plain Diff
refactored ContactsController class name because tanguy said so
parent
a36c624f
Branches
part2
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
hepia/Main.java
+5
-7
5 additions, 7 deletions
hepia/Main.java
hepia/utils/ContactController.java
+5
-5
5 additions, 5 deletions
hepia/utils/ContactController.java
hepia/utils/Famille.java
+0
-1
0 additions, 1 deletion
hepia/utils/Famille.java
with
10 additions
and
13 deletions
hepia/Main.java
+
5
−
7
View file @
86c3056b
package
hepia
;
package
hepia
;
import
hepia.utils.Amis
;
import
hepia.utils.Amis
;
import
hepia.utils.Contact
s
;
import
hepia.utils.Contact
Controller
;
import
hepia.utils.Professionel
;
import
hepia.utils.Professionel
;
public
class
Main
{
public
class
Main
{
...
@@ -9,7 +9,7 @@ public class Main {
...
@@ -9,7 +9,7 @@ public class Main {
// Makeshift code as example
// Makeshift code as example
// New contact with random values
// New contact
"Amis"
with random values
Amis
test
=
new
Amis
();
Amis
test
=
new
Amis
();
test
.
setName
(
"Contact1"
);
test
.
setName
(
"Contact1"
);
test
.
addFirstName
(
"Prenom1"
);
test
.
addFirstName
(
"Prenom1"
);
...
@@ -18,17 +18,15 @@ public class Main {
...
@@ -18,17 +18,15 @@ public class Main {
test
.
addMail
(
"test1@address.com"
);
test
.
addMail
(
"test1@address.com"
);
test
.
addSocial
(
"MrContact"
);
test
.
addSocial
(
"MrContact"
);
test
.
addPhone
(
"0227865425"
);
test
.
addPhone
(
"0227865425"
);
//test.setJob("Ingénieur Informaticien");
// Let's add the contact to our phone book
// Let's add the contact to our phone book
Contact
s
contacts
=
new
Contact
s
();
Contact
Controller
contacts
=
new
Contact
Controller
();
contacts
.
append
(
test
);
contacts
.
append
(
test
);
// Was it correctly added ?
// Was it correctly added ?
contacts
.
printContacts
();
contacts
.
printContacts
();
// Alright
// let's add another contact, but this time a "Professionnel"
// let's add another
Professionel
test2
=
new
Professionel
();
Professionel
test2
=
new
Professionel
();
test2
.
setName
(
"Contact2"
);
test2
.
setName
(
"Contact2"
);
test2
.
addFirstName
(
"Prenom1"
);
test2
.
addFirstName
(
"Prenom1"
);
...
@@ -55,7 +53,7 @@ public class Main {
...
@@ -55,7 +53,7 @@ public class Main {
// contacts.printContacts();
// contacts.printContacts();
// Search a contact based on a string. The method will scan every possible entry and returns a list of contacts containing the string.
// Search a contact based on a string. The method will scan every possible entry and returns a list of contacts containing the string.
Contact
s
search
=
contacts
.
search
(
"Prenom1"
);
Contact
Controller
search
=
contacts
.
search
(
"Prenom1"
);
search
.
printContacts
();
search
.
printContacts
();
}
}
}
}
This diff is collapsed.
Click to expand it.
hepia/utils/Contact
s
.java
→
hepia/utils/Contact
Controller
.java
+
5
−
5
View file @
86c3056b
package
hepia.utils
;
package
hepia.utils
;
import
java.util.Scanner
;
import
java.util.Scanner
;
public
class
Contact
s
{
public
class
Contact
Controller
{
private
Contact
[]
contacts
;
private
Contact
[]
contacts
;
public
Contact
s
()
{
public
Contact
Controller
()
{
this
.
contacts
=
new
Contact
[
0
];
this
.
contacts
=
new
Contact
[
0
];
}
}
public
Contact
s
(
int
size
)
{
public
Contact
Controller
(
int
size
)
{
this
.
contacts
=
new
Contact
[
size
];
this
.
contacts
=
new
Contact
[
size
];
}
}
...
@@ -145,9 +145,9 @@ public class Contacts {
...
@@ -145,9 +145,9 @@ public class Contacts {
System
.
out
.
println
(
"***END***\n"
);
System
.
out
.
println
(
"***END***\n"
);
}
}
public
Contact
s
search
(
String
s
)
public
Contact
Controller
search
(
String
s
)
{
{
Contact
s
result
=
new
Contact
s
();
Contact
Controller
result
=
new
Contact
Controller
();
for
(
Contact
contact
:
this
.
contacts
)
{
for
(
Contact
contact
:
this
.
contacts
)
{
if
(
contact
instanceof
Professionel
)
if
(
contact
instanceof
Professionel
)
...
...
This diff is collapsed.
Click to expand it.
hepia/utils/Famille.java
+
0
−
1
View file @
86c3056b
...
@@ -16,7 +16,6 @@ public class Famille extends Contact{
...
@@ -16,7 +16,6 @@ public class Famille extends Contact{
this
.
relation
=
"Uninitialized"
;
this
.
relation
=
"Uninitialized"
;
}
}
public
String
toString
()
{
public
String
toString
()
{
return
"=====================================\n"
+
return
"=====================================\n"
+
"Name : "
+
this
.
getName
()
+
"\n"
+
"Name : "
+
this
.
getName
()
+
"\n"
+
...
...
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