1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| using System;
namespace STEP_DOS {
public class DonneesSTEP {
// attributs
private string designation;
private string abbreviation;
private double val_min;
private double val_max;
private double val_analyse;
// constructeurs
public DonneesSTEP(string Des, string Abb, double v_min, double v_max, double v_anal) {
Initialise(Des, Abb, v_min, v_max, v_anal);
}
public DonneesSTEP(DonneesSTEP ds) {
Initialise(ds);
}
// méthode
public void Initialise(string Des, string Abb, double v_min, double v_max, double v_anal) {
this.designation = Des;
this.abbreviation = Abb;
this.val_max = v_max;
this.val_min = v_min;
if (v_anal < v_min || v_anal > v_max) {
throw new Exception("Valeur invalide");
} else this.val_analyse = v_anal;
}
public void Initialise(DonneesSTEP ds) {
designation = ds.designation;
abbreviation = ds.abbreviation;
val_min = ds.val_min;
val_max = ds.val_max;
val_analyse = ds.val_analyse;
}
// propriétés
public string Designation {
get { return designation; }
set { designation = value; }
}
public string Abbreviation {
get { return abbreviation; }
set { abbreviation = value; }
}
public double Val_min {
get { return val_min; }
set { val_min = value; }
}
public double Val_max {
get { return val_max; }
set { val_max = value; }
}
public double Val_analyse {
get { return val_analyse; }
set { // val_max =< val_alal >= val_min
if (value < val_min || value > val_max) {
throw new Exception("Valeur (" + value + ") invalide");
}
val_analyse = value;
}
}
public void Identifie() {
Console.WriteLine("[{0}, {1}, {2}, {3}, {4}]", designation, abbreviation, val_min, val_max, val_analyse);
}
}
} |
Partager