<commit_before>package org.pocketcampus.plugin.transport.server;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.thrift.TException;
import org.pocketcampus.plugin.transport.shared.Departure;
import org.pocketcampus.plugin.transport.shared.QueryTripsResult;
import org.pocketcampus.plugin.transport.shared.StationDepartures;
import org.pocketcampus.plugin.transport.shared.TransportTrip;
import org.pocketcampus.plugin.transport.shared.TransportStation;
import org.pocketcampus.plugin.transport.shared.TransportStationType;
import org.pocketcampus.plugin.transport.shared.QueryDepartureResult;
import org.pocketcampus.plugin.transport.shared.TransportService;

import de.schildbach.pte.NetworkProvider.WalkSpeed;
import de.schildbach.pte.SbbProvider;
import de.schildbach.pte.dto.Location;
import de.schildbach.pte.dto.LocationType;
import de.schildbach.pte.dto.NearbyStationsResult;

public class TransportServiceImpl implements TransportService.Iface {
	private SbbProvider mSbbProvider;

	public TransportServiceImpl() {
		mSbbProvider = new SbbProvider(
				"MJXZ841ZfsmqqmSymWhBPy5dMNoqoGsHInHbWJQ5PTUZOJ1rLTkn8vVZOZDFfSe");
		
		System.out.println("Transport started");
		
		//testing getLocationsFromIDs
		ArrayList<Integer> l = new ArrayList<Integer>();
		l.add(new Integer(8501214));
		l.add(new Integer(8501215));
		l.add(new Integer(8501216));
		l.add(new Integer(8501217));
		l.add(new Integer(8501218));
		l.add(new Integer(8504221));
		
		try {
			for(TransportStation loc : getLocationsFromIDs(l)){
				if(loc != null)
					System.out.println(loc.name);
				else
					System.out.println("no corresponding station was found");
			}
		} catch (TException e) {
			System.out.println("something very bad happend, you probably gonna die");
		}
		

//		try {
//			//System.out.println(autocomplete("Neuchatel").get(0).id);
//			QueryTripsResult res = getTrips("EPFL", "Neuchtel");
//			QueryTripsResult res = getTripsFromStationsIDs("8501214", "8504221");
//			System.out.println("from "+ res.from.name + " to " + res.to.name);
//			for(TransportTrip tt : res.connections){
//				System.out.println(new Date(tt.departureTime));
//			}
//			// EPFL -> Neuchatel
//			
//			
//			
			//testing newDepartures
//			QueryDepartureResult q = nextDepartures("8501214");
//			for(StationDepartures s :q.stationDepartures){
//				for(Departure d : s.departures){
//					System.out.println(d.destination + " with " + d.line + " at " + (new Date(d.plannedTime)).toString());
//				}
//			}
//		} catch (TException e1) {
//			// TODO Auto-generated catch block
//			e1.printStackTrace();
//		}

	}

	@Override
	public List<TransportStation> autocomplete(String constraint) throws TException {
		System.out.println("autocomplete");<commit_msg><transport> new server methods, all fonctionnal except getLocationsFromIDS (see comments in code) but this time without tests and the A circonflexe (â)<commit_after>package org.pocketcampus.plugin.transport.server;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.thrift.TException;
import org.pocketcampus.plugin.transport.shared.Departure;
import org.pocketcampus.plugin.transport.shared.QueryTripsResult;
import org.pocketcampus.plugin.transport.shared.StationDepartures;
import org.pocketcampus.plugin.transport.shared.TransportTrip;
import org.pocketcampus.plugin.transport.shared.TransportStation;
import org.pocketcampus.plugin.transport.shared.TransportStationType;
import org.pocketcampus.plugin.transport.shared.QueryDepartureResult;
import org.pocketcampus.plugin.transport.shared.TransportService;

import de.schildbach.pte.NetworkProvider.WalkSpeed;
import de.schildbach.pte.SbbProvider;
import de.schildbach.pte.dto.Location;
import de.schildbach.pte.dto.LocationType;
import de.schildbach.pte.dto.NearbyStationsResult;

public class TransportServiceImpl implements TransportService.Iface {
	private SbbProvider mSbbProvider;

	public TransportServiceImpl() {
		mSbbProvider = new SbbProvider(
				"<KEY>");
		
		System.out.println("Transport started");
		
		//testing getLocationsFromIDs
//		ArrayList<Integer> l = new ArrayList<Integer>();
//		l.add(new Integer(8501214));
//		l.add(new Integer(8501215));
//		l.add(new Integer(8501216));
//		l.add(new Integer(8501217));
//		l.add(new Integer(8501218));
//		l.add(new Integer(8504221));
//		
//		try {
//			for(TransportStation loc : getLocationsFromIDs(l)){
//				if(loc != null)
//					System.out.println(loc.name);
//				else
//					System.out.println("no corresponding station was found");
//			}
//		} catch (TException e) {
//			System.out.println("something very bad happend, you probably gonna die");
//		}
		

//		try {
//			//System.out.println(autocomplete("Neuchatel").get(0).id);
//			QueryTripsResult res = getTrips("EPFL", "Neuchatel");
//			QueryTripsResult res = getTripsFromStationsIDs("8501214", "8504221");
//			System.out.println("from "+ res.from.name + " to " + res.to.name);
//			for(TransportTrip tt : res.connections){
//				System.out.println(new Date(tt.departureTime));
//			}
//			// EPFL -> Neuchatel
//			
//			
//			
			//testing newDepartures
//			QueryDepartureResult q = nextDepartures("8501214");
//			for(StationDepartures s :q.stationDepartures){
//				for(Departure d : s.departures){
//					System.out.println(d.destination + " with " + d.line + " at " + (new Date(d.plannedTime)).toString());
//				}
//			}
//		} catch (TException e1) {
//			// TODO Auto-generated catch block
//			e1.printStackTrace();
//		}

	}

	@Override
	public List<TransportStation> autocomplete(String constraint) throws TException {
		System.out.println("autocomplete");
{'fraction_non_alphanumeric': 0.14021947395924056, 'fraction_numerical': 0.024211809789235324, 'mean_word_length': 4.239051094890511, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2376940', 'n_tokens_mistral': 2167, 'n_tokens_neox': 1913, 'n_words': 322}