Nantes Université
Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
J
java-tp2
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Service d'assistance
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Leo LEMAIRE
java-tp2
Validations
56f72ce1
Vérifiée
Valider
56f72ce1
rédigé
il y a un an
par
Leo LEMAIRE
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
TP3
parent
19b4e70c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
app/src/main/java/tube/Control.java
+35
-21
35 ajouts, 21 suppressions
app/src/main/java/tube/Control.java
app/src/main/java/tube/Path.java
+5
-2
5 ajouts, 2 suppressions
app/src/main/java/tube/Path.java
avec
40 ajouts
et
23 suppressions
app/src/main/java/tube/Control.java
+
35
−
21
Voir le fichier @
56f72ce1
package
tube
;
package
tube
;
import
java.util.List
;
import
javax.swing.JOptionPane
;
import
javax.swing.JOptionPane
;
import
tube.gui.TubeView
;
import
tube.gui.TubeView
;
...
@@ -38,25 +40,37 @@ public class Control {
...
@@ -38,25 +40,37 @@ public class Control {
* show an itinerary between two stations.
* show an itinerary between two stations.
* -----------------------------------------------------------
* -----------------------------------------------------------
*/
*/
public
void
showItinerary
(
int
x
,
int
y
){
public
void
showItinerary
(
int
x
,
int
y
){
String
station
=
tv
.
findClosestStation
(
x
,
y
);
String
station
=
tv
.
findClosestStation
(
x
,
y
);
System
.
out
.
println
(
"USER ACTION: station selection = "
+
station
);
System
.
out
.
println
(
"USER ACTION: station selection = "
+
station
);
TermList
sel
=
new
TermList
();
TermList
sel
=
new
TermList
();
if
(
begin
==
null
)
{
if
(
begin
==
null
)
{
begin
=
station
;
begin
=
station
;
sel
.
add
(
begin
);
sel
.
add
(
begin
);
tv
.
show
(
sel
);
tv
.
show
(
sel
);
}
}
else
if
(
end
==
null
)
{
else
if
(
end
==
null
)
{
end
=
station
;
end
=
station
;
TermList
selection
=
null
;
TermList
selection
=
new
TermList
();
if
(
selection
==
null
)
{
JOptionPane
.
showMessageDialog
(
tv
,
"No path has been found."
);
Path
path
=
new
Path
(
net
);
sel
=
null
;
List
<
String
>
fPath
=
path
.
getPath
(
begin
,
end
);
begin
=
null
;
end
=
null
;
if
(
fPath
==
null
)
}
selection
=
null
;
tv
.
show
(
selection
);
else
{
}
for
(
String
st
:
fPath
){
}
selection
.
add
(
st
);
}
}
if
(
selection
==
null
)
{
JOptionPane
.
showMessageDialog
(
tv
,
"No path has been found."
);
sel
=
null
;
begin
=
null
;
end
=
null
;
}
tv
.
show
(
selection
);
}
}
}
}
This diff is collapsed.
Cliquez pour l'agrandir.
app/src/main/java/tube/Path.java
+
5
−
2
Voir le fichier @
56f72ce1
...
@@ -21,9 +21,11 @@ public class Path {
...
@@ -21,9 +21,11 @@ public class Path {
for
(
Step
step
:
net
.
steps
){
for
(
Step
step
:
net
.
steps
){
String
nextS
=
step
.
getNext
(
current
);
String
nextS
=
step
.
getNext
(
current
);
if
(
nextS
==
null
)
continue
;
if
(
nextS
==
null
)
continue
;
if
(!
visited
.
contains
(
nextS
))
continue
;
if
(
visited
.
contains
(
nextS
))
continue
;
double
alpha
=
tbv
.
angle
(
nextS
,
current
,
goal
);
if
(
nextS
.
equals
(
goal
))
return
nextS
;
double
alpha
=
tbv
.
angle
(
current
,
nextS
,
goal
);
if
(
alpha
<
angMin
){
if
(
alpha
<
angMin
){
System
.
out
.
println
(
nextS
+
":"
+
alpha
);
angMin
=
alpha
;
angMin
=
alpha
;
next
=
nextS
;
next
=
nextS
;
}
}
...
@@ -40,6 +42,7 @@ public class Path {
...
@@ -40,6 +42,7 @@ public class Path {
System
.
out
.
println
(
current
);
System
.
out
.
println
(
current
);
if
(
current
.
equals
(
end
))
return
visited
;
if
(
current
.
equals
(
end
))
return
visited
;
String
next
=
getNextStation
(
current
,
end
,
visited
);
String
next
=
getNextStation
(
current
,
end
,
visited
);
System
.
out
.
println
(
next
);
if
(
next
==
null
)
return
null
;
if
(
next
==
null
)
return
null
;
current
=
next
;
current
=
next
;
}
}
...
...
This diff is collapsed.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter