"depot M213"

This commit is contained in:
JunkJumper
2020-05-03 14:24:13 +02:00
parent 1408744dbb
commit e5983242c6
136 changed files with 161184 additions and 0 deletions

102
TDUML/journey/Point.java Executable file
View File

@ -0,0 +1,102 @@
package journey;
public class Point
{
//attributs
private double x;
private double y;
public List<Trajet> trajet = new ArrayList<Trajet> ();
//constructeurs
public Point()
{
x = 0;
y = 0;
}
public Point(double x, double y)
{
this.x = x;
this.y = y;
}
//methode d'instance
public String toString()
{
return "(X = " + this.x + " - Y = " + this.y + ")";
}
public double getDistance(Point p)
{
double result;
result = Math.sqrt(Math.pow(this.x - p.x, 2) + Math.pow(this.y - p.y, 2));
return result;
}
//accesseur en lecture
public double getX() {
return x;
}
public double getY() {
return y;
}
public Point projX()
{
return new Point(this.x, 0.);
}
public Point projY()
{
return new Point(0., this.y);
}
public boolean equals (Object obj)
{
Point p = (Point)obj;
if (this.x == p.x && this.y == p.y)
return true;
else return false;
}
public Point clone()
{
return new Point(this.x, this.y);
}
public void getLocation()
{
System.out.println("x = " + this.x + " , y = " + this.y + ".");
}
public void setLocation(Point p)
{
p.x = this.x;
p.y = this.y;
}
public void setLocation(double x, double y)
{
x = this.x;
y = this.y;
}
public void translate(int dx, int dy)
{
this.x = this.x+dx;
this.y = this.y+dy;
}
//getters and setters
public void setX(double x) {
this.x = x;
}
public void setY(double y) {
this.y = y;
}
}

32
TDUML/journey/Trajet.java Executable file
View File

@ -0,0 +1,32 @@
package journey;
public class Trajet {
private String nom;
private Integer nombrePoints;
private int tabDistance[];
public int getTabDistance[]() {
return this.tabDistance[];
}
public void setTabDistance[](final int value) {
this.tabDistance[] = value;
}
public String getNom() {
return this.nom;
}
public void setNom(final String value) {
this.nom = value;
}
public Integer getNombrePoints() {
return this.nombrePoints;
}
public void sommeDistance() {
}
}