Esempio n. 1
0
        public Problem(XPathNavigator navigator)
        {
            List <Constraint> constraintList = new List <Constraint>();
            List <string>     imageList      = new List <string>();

            // Get the name
            navigator.MoveToChild("name", "");
            name = navigator.Value;

            // Get the ID
            navigator.MoveToNext("ID", "");
            id = navigator.ValueAsInt;

            // Get the description
            navigator.MoveToNext("problemDescription", "");
            description = fixFormatting(navigator.Value);

            // Get the monetaryIncentive
            navigator.MoveToNext("monetaryIncentive", "");
            monetaryIncentive = navigator.ValueAsDouble;


            // Get the heat leak
            navigator.MoveToNext("heatLeak", "");
            heatLeak = navigator.ValueAsDouble;

            // Get the support mode
            navigator.MoveToNext("supportMode", "");
            switch (navigator.Value)
            {
            case "Compression":
                SupportMode = SupportMode.COMPRESSION;
                break;

            case "Tension":
                SupportMode = SupportMode.TENSION;
                break;
            }

            // Get the number of supports
            navigator.MoveToNext("strutNumber", "");
            supportNumber = navigator.ValueAsInt;

            navigator.MoveToNext("images", "");
            problemImageCollection = new ProblemImageCollection(navigator.Clone());


            // Get the constraint list
            navigator.MoveToNext("constraints", "");
            navigator.MoveToFirstChild();
            do
            {
                Constraint constraint = new Constraint(navigator.Clone());
                constraintList.Add(constraint);
            } while (navigator.MoveToNext());
            constraints = new Constraint[constraintList.Count];
            constraintList.CopyTo(constraints);
        }
Esempio n. 2
0
 public Problem(
     string name,
     int id,
     string description,
     double incentive,
     double heatLeak,
     SupportMode supportMode,
     int supportNumber,
     ProblemImageCollection imageCollection,
     Constraint[] constraints)
 {
     this.name                   = name;
     this.id                     = id;
     this.description            = description;
     this.monetaryIncentive      = incentive;
     this.heatLeak               = heatLeak;
     this.supportMode            = supportMode;
     this.supportNumber          = supportNumber;
     this.problemImageCollection = imageCollection;
     this.constraints            = constraints;
 }