Package model

Examples of model.Station


  public void searchScheduleByLineAndStation()
  {
    Timetable timetable1 = new Timetable();
   
    Line line1 = new Line();
    Station station1 = new Station();
   
    timetable1.setLine(line1);
    timetable1.setStation(station1);
    map.getTimetables().add(timetable1);
   
    assertEquals(1, map.searchSchedule(line1, station1).size());
   
    Timetable timetable2 = new Timetable();
    Line line2 = new Line();
    Station station2 = new Station();
   
    timetable2.setLine(line2);
    timetable2.setStation(station2);
    map.getTimetables().add(timetable2);
   
    Timetable timetable3 = new Timetable();
    Line line3 = new Line();
    Station station3 = new Station();
   
    timetable3.setLine(line3);
    timetable3.setStation(station3);
    map.getTimetables().add(timetable3);
   
View Full Code Here


  @Test
  public void searchScheduleByStation()
  {
    Timetable timetable1 = new Timetable()
    Line line1 = new Line();
    Station station1 = new Station();
   
    timetable1.setLine(line1);
    timetable1.setStation(station1);
    map.getTimetables().add(timetable1);
   
    assertEquals(1, map.searchSchedule(station1).size());
   
    Timetable timetable2 = new Timetable();
    Line line2 = new Line();
    Station station2 = new Station();
   
    timetable2.setLine(line2);
    timetable2.setStation(station2);
    map.getTimetables().add(timetable2);
   
    Timetable timetable3 = new Timetable();
    Line line3 = new Line();
    Station station3 = new Station();
   
    timetable3.setLine(line3);
    timetable3.setStation(station3);
    map.getTimetables().add(timetable3);
   
View Full Code Here

 
 
  @Test //test de maxMinCoordinates
  public void testMaxMinCoordinates(){
    LinkedList <Station> stations = new LinkedList<Station>();
    stations.add(new Station(5, "stat1", 0, 0, "ville1"));
    stations.add(new Station(6, "stat2", 5, 5, "ville1"));
    stations.add(new Station(7, "stat3", 6, -1, "ville2"));
   
    test.getMap().setStations(stations);
   
    double[][] maxmin = test.getMaxMinCoordinate();   
   
View Full Code Here

  public void testGetStationsNames(){
    String[] noms = new String[] {"Nom1", "Nom2", "Nom3"};
   
   
    LinkedList <Station> stations = new LinkedList<Station>();
    stations.add(new Station(5, noms[0], 0, 0, "ville1"));
    stations.add(new Station(6, noms[1], 5, 5, "ville1"));
    stations.add(new Station(7, noms[2], 6, -1, "ville2"));
   
    test.getMap().setStations(stations);
   
    assertArrayEquals(noms, test.getStationsNames());
  }
View Full Code Here

  @Test //test de getMaxStationNumber
  public void testGetMaxStationNumber(){
    String[] noms = new String[] {"Nom1", "Nom2", "Nom3"};
   
    LinkedList <Station> stations = new LinkedList<Station>();
    stations.add(new Station(5, noms[0], 0, 0, "ville1"));
    stations.add(new Station(6, noms[1], 5, 5, "ville1"));
    stations.add(new Station(7, noms[2], 6, -1, "ville2"));
   
    test.getMap().setStations(stations);
   
    assertEquals(7, test.getMaxStationNumber());
   
View Full Code Here

 
 
  @Test /* ajout d'une station à un horaire */
  public void setgetStation()
  {
    Station station = new Station(0, "station", 40, 50, "ville");
   
    timetable.setStation(station);
   
    assertEquals(station, timetable.getStation());
  }
View Full Code Here

    Choice period = new Choice();
    period.addItem("Semaine");
    period.addItem("Week-end");
   
    Line tempLine = new Line();
    Station tempStation = new Station();
    Period tempPeriod = new Period();
   
    //Crée un message contenant des chaînes de caractères et les listes déroulantes
    Object[] message = new Object[] { "Ligne : ", line,
        "Station : ", station, "Période : " , period};
   
    //Crée la pop-up contenant le message
    int r = JOptionPane.showConfirmDialog(null, message,
        "Modifier des horaires", JOptionPane.OK_CANCEL_OPTION);
   
    //Si l'utilisateur a cliqué sur le bouton "OK"
    if (r == JOptionPane.OK_OPTION) {
      tempLine.setName(line.getSelectedItem().toString());
      tempStation.setName(station.getSelectedItem().toString());
     
      if(period.getSelectedItem()=="Semaine")
        numberPeriod=0;
      else
        numberPeriod=1;
View Full Code Here

  /**
   * Lance une pop-up permettant de choisir une des lignes reliées
   * à la station si la station est reliée à une ou des lignes
   */
  public void selectLines(){
    Station toShow = this.station;

    String contenu = new String();
    contenu = "Sélectionner la ligne à afficher.\n";

    LinkedList<Line> lines = controller.getMap().searchLineOnStations(
        toShow);
    int size = lines.size();

    //Si la station est reliée à au moins une ligne
    if (size > 0) {
      Object objLines[] = new Object[size];

      for (int i = 0; i < size; i++)
        objLines[i] = lines.get(i).getName().toString();

      //Crée la pop-up contenant les boutons des lignes et une chaîne de caractères
      int option = JOptionPane.showOptionDialog(null, contenu,
          toShow.getName(), JOptionPane.PLAIN_MESSAGE,
          JOptionPane.CANCEL_OPTION, null, objLines, objLines[0]);

      //Si l'utilisateur a choisi une des lignes
      if (option >= 0) {
        Line converted = this.controller.getMap().convertToLine(
View Full Code Here

  }
 
 
  @Test //test de copyStation
  public void testCopyStation(){
    Station stat1 = new Station(0, "Nom1", 0, 0, "ville1");
    LinkedList <Station> stations = new LinkedList<Station>();
    stations.add(stat1);
    test.getMap().setStations(stations);
   
    assertEquals(stat1, test.copyStation(new Station(5684489, "Nom1", 6484, 84564984, "ville15456")));
  }
View Full Code Here

  /**
   * Lance la pop-up permettant de modifier les informations de la ligne sélectionnée
   */
  @Override
  public void alterPopup() {
    Station station1 = new Station();
    Station station2 = new Station();
   
    //Vérifie que la ligne existe bien
    temp=controller.copyLine(temp);
    if(temp==null)
    {
      errorPopup("noLine");
      return;
    }
    temp=new Line(temp);
   
    //Récupère la position de la ligne dans la liste de lignes
    positionInList=controller.positionInListLine(temp);
   
    //Champ de texte modifiable contenant le nom de la ligne
    JTextField name = new JTextField(temp.getName());
   
    //Liste déroulante contenant les types de transports possibles
    Choice transportType = new Choice();
    transportType.addItem(TransportType.BUS.toString());
    transportType.addItem(TransportType.METRO.toString());
    transportType.addItem(TransportType.TRAMWAY.toString());
    transportType.select(temp.getTransportType().toString());
   
    String[] stations = controller.getStationsNames();
   
    //Liste déroulante avec système d'auto-complétion contenant les
    //noms des stations
    JComboBox terminus1 = new JComboBox();
    AutoCompleteSupport support = AutoCompleteSupport.install(
            terminus1, GlazedLists.eventListOf(stations));
    terminus1.setSelectedItem(temp.getStations().get(0).getName());
   
    JComboBox terminus2 = new JComboBox();
    AutoCompleteSupport support2 = AutoCompleteSupport.install(
            terminus2, GlazedLists.eventListOf(stations));
    terminus2.setSelectedItem(temp.getStations().get(1).getName());
   
    //Message contenant le champ de texte et les 3 listes déroulantes
    Object[] message = new Object[] { name, transportType, terminus1, terminus2};
   
    //Lance la pop-up de modification contenant le message
    int r = JOptionPane.showConfirmDialog(null, message,
        "Modifiez les valeurs", JOptionPane.OK_CANCEL_OPTION);
   
    //Si l'utilisateur a cliqué sur le bouton "OK"
    if (r == JOptionPane.OK_OPTION) {
      String tempType = transportType.getSelectedItem();
      if(tempType=="BUS")
      temp.setTransportType(TransportType.BUS);
      else if(tempType=="METRO")
      temp.setTransportType(TransportType.METRO);
      else if(tempType=="TRAMWAY")
      temp.setTransportType(TransportType.TRAMWAY);
     
      //On remplace les informations avec les nouvelles
      temp.setName(name.getText());
      station1.setName(terminus1.getSelectedItem().toString());
      station2.setName(terminus2.getSelectedItem().toString());
      station1=controller.copyStation(station1);
      station2=controller.copyStation(station2);
     
      //On vérifie que les nouvelles stations sélectionnées
      //existent bien
View Full Code Here

TOP

Related Classes of model.Station

Copyright © 2018 www.massapicom. 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.