Package servlet.utilities

Source Code of servlet.utilities.Paris_S

package servlet.utilities;

import java.util.List;

import pari.Pari;
import pari.PariHistorique;
import user.User;
import dao.DaoGareUIC;
import dao.DaoUser;
import externaldata.gareSelection.GareSelection;
import externaldata.theoricaltimefile.TheoricalTrainData;


public class Paris_S implements Comparable<Paris_S> {
  public String gare_dua = null;
  public String gare_uic = null;
  public String gare_nom = null;
  public String train_num = null;
  public String train_nom = null;
  public String arrivee_theorique = null;
  public String destination_uic = null;
  public String destination_nom = null;
  public int user_id = 0;
  public int mise = 0;
  public int min_retard = 0;
  public int gain_potentiel = 0;
  //TODO
  //public ? etat = ?;


  public Paris_S() {
    super();
  }


  public void update(List<GareSelection> gs, TheoricalTrainData ttd) {
    if(ttd != null) {
      gare_dua = ttd.stationDUA;
      if(gs != null && !gs.isEmpty()) {
        for(GareSelection g : gs) {
          if(g.DUA.equals(gare_dua)) {
            gare_uic = g.UIC;
            gare_nom = g.name;
            break;
          }
        }
      }
      train_num = ttd.num_TheoricalTrainData;
      train_nom = ttd.trainName;
      arrivee_theorique = ttd.arrivalTime;
      destination_uic = ttd.destinationUIC;
      destination_nom = new DaoGareUIC().findOne(destination_uic).name;
    }
  }

  public void update(List<GareSelection> gs, Pari p) {
    if(p != null) {
      user_id = p.user.getId_user();
      mise = p.montant;
      min_retard = p.retardEnMinutes;
      gain_potentiel = p.gainPossible;
      gare_dua = p.id_train.stationDUA;
      if(gs != null && !gs.isEmpty()) {
        for(GareSelection g : gs) {
          if(g.DUA.equals(gare_dua)) {
            gare_uic = g.UIC;
            gare_nom = g.name;
            break;
          }
        }
      }
      //TODO
      train_num = p.id_train.num_TheoricalTrainData;
      //train_nom = ttbd.trainName;
      arrivee_theorique = p.id_train.arrivalTime;
      //destination_uic = ttbd.destinationUIC;
      //destination_nom = new DaoGareUIC().findOne(destination_uic).name;
    }
  }

  public void update(List<GareSelection> gs, PariHistorique p) {
    if(p != null) {
      user_id = p.getId_owner();
      User u = new DaoUser().findWithId(user_id);
     
     
      mise = p.getMontant();
      min_retard = p.getMinRetard();
      gain_potentiel = p.getGain();
      gare_dua = p.getStationDUA();
      if(gs != null && !gs.isEmpty()) {
        for(GareSelection g : gs) {
          if(g.DUA.equals(gare_dua)) {
            gare_uic = g.UIC;
            gare_nom = g.name;
            break;
          }
        }
      }
      //TODO
      //train_num = p.id_train.num_TheoricalTrainData;
      //train_nom = ttbd.trainName;
      //arrivee_theorique = p.id_train.arrivalTime;
      //destination_uic = ttbd.destinationUIC;
      //destination_nom = new DaoGareUIC().findOne(destination_uic).name;
    }
  }


  @Override
  public int compareTo(Paris_S p) {
    return this.arrivee_theorique.compareTo(p.arrivee_theorique);
  }
}
TOP

Related Classes of servlet.utilities.Paris_S

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.