Package application

Examples of application.GuideMichelin


        Thread.sleep((long) (Math.log(NB_PEERS) * 1000));
        System.out.println("\nTurn around after second stabilization");
        turnAround(tracker.getRandomPeer());

        // A GuideMichelin is created. It will use the Chord network
        GuideMichelin guideMichelin = new GuideMichelinImpl(tracker);

        // Some data are added to the {@link GuideMichelin}
        DataGenerator dataGenerator = new DataGenerator(10);
        Map<String, String> newData;

        for(int i = 0 ; i < 10 ; i++)
        {
            newData = dataGenerator.getNewData();
            for(Map.Entry<String, String> entry : newData.entrySet())
            {
                guideMichelin.put(entry.getKey(), entry.getValue(), 5);
            }
        }

        // The peers are listed again with the data they store
        Thread.sleep(2000);
        System.out.println("\nTurn around after adding data");
        turnAround(tracker.getRandomPeer());

        // Some data are requested from the GuideMichelin
        String[] restaurants = {"Le Bistrot Gourmand" , "Auberge de la Madone" , "toto"};

        for(String restaurant : restaurants)
        {
            System.out.println("\nRestaurant '" + restaurant + "' - Daily special: '" + guideMichelin.get(restaurant)
                               + "'");
        }

        System.out.println("TEST\n");

View Full Code Here


        Thread.sleep((long) (Math.log(NB_PEERS) * 1000));
        System.out.println("\nTurn around after second stabilization");
        turnAround(tracker.getRandomPeer());

        // A GuideMichelin is created. It will use the Chord network
        GuideMichelin guideMichelin = new GuideMichelinImpl(tracker);

        // Some data are added to the {@link GuideMichelin}
        DataGenerator dataGenerator = new DataGenerator(10);
        Map<String, String> newData;

        for(int i = 0 ; i < 10 ; i++)
        {
            newData = dataGenerator.getNewData();
            for(Map.Entry<String, String> entry : newData.entrySet())
            {
                guideMichelin.put(entry.getKey(), entry.getValue(), 5);
            }
        }

        // The peers are listed again with the data they store
        Thread.sleep(2000);
        System.out.println("\nTurn around after adding data");
        turnAround(tracker.getRandomPeer());

        // Some data are requested from the GuideMichelin
        String[] restaurants = {"Le Bistrot Gourmand" , "Auberge de la Madone" , "toto"};

        for(String restaurant : restaurants)
        {
            System.out.println("\nRestaurant '" + restaurant + "' - Daily special: '" + guideMichelin.get(restaurant)
                               + "'");
        }

        System.out.println("TEST\n");

        String[] restaurantsTest = {"L'Aphrodite" , "Jean-Francois Issautier" , "Le Mas Candille" , "Louis XV" ,
                "l'Hostellerie Jerome" , "Le Park 45" , "Le Bistrot Gourmand" , "Auberge de la Madone" ,
                "A la bonne cuillere" ,};


        for(String restaurant : restaurantsTest)
        {

            try
            {
                Peer p = guideMichelin.getPeer(restaurant);
                if(p.get(restaurant) == null) if(p.getReplicat(restaurant) == null)
                {
                    System.out.println("\nL'Objet '" + restaurant + " est pas dans la base\n");

                }else
View Full Code Here

        Thread.sleep((long) (Math.log(NB_PEERS) * 1000));
        System.out.println("\nTurn around after second stabilization");
        turnAround(tracker.getRandomPeer());

        // A GuideMichelin is created. It will use the Chord network
        GuideMichelin guideMichelin = new GuideMichelinImpl(tracker);

        // Some data are added to the {@link GuideMichelin}
        DataGenerator dataGenerator = new DataGenerator(10);
        Map<String, String> newData;

        for(int i = 0 ; i < 10 ; i++)
        {
            newData = dataGenerator.getNewData();
            for(Map.Entry<String, String> entry : newData.entrySet())
            {
                guideMichelin.put(entry.getKey(), entry.getValue(), 5);
            }
        }

        // The peers are listed again with the data they store
        Thread.sleep(2000);
        System.out.println("\nTurn around after adding data");
        turnAround(tracker.getRandomPeer());

        // Some data are requested from the GuideMichelin
        String[] restaurants = {"Le Bistrot Gourmand" , "Auberge de la Madone" , "toto"};

        for(String restaurant : restaurants)
        {
            System.out.println("\nRestaurant '" + restaurant + "' - Daily special: '" + guideMichelin.get(restaurant)
                               + "'");
        }

        System.out.println("TEST\n");

        String str = "";

        Map<String, String> restaurantsTest2 = new HashMap<String, String>();
        restaurantsTest2.put("Le Bistrot Gourmand", "Allouette");
        restaurantsTest2.put("Jean-Francois Issautier", "Poirreaux en sauce");
        restaurantsTest2.put("Le Mas Candille", "Candide sur pavé de saumon");
        restaurantsTest2.put("Le Park 45", "Le 45eme menu");

        System.out.println("Ancien Menus");
        str += "\n" + "/Ajoute des anciens menus\\";
        for(Map.Entry<String, String> restaurant : restaurantsTest2.entrySet())
        {
            System.out.println("Le restaurant : " + restaurant.getKey() + " a pour plat : " + guideMichelin.get
                    (restaurant.getKey()));

        }

        restaurantsTest2 = new HashMap<String, String>();
        restaurantsTest2.put("Chez Lulu", "Courgette crues");
        restaurantsTest2.put("Tata martine", "Potiron aux endives");
        restaurantsTest2.put("La grande gerbe", "Hamberger sauce ketchup");
        restaurantsTest2.put("Tata", "Yoyo");

        System.out.println("\n/***Ajouts des nouveaux menus***\\");


        for(Map.Entry<String, String> restaurant : restaurantsTest2.entrySet())
        {
            guideMichelin.put(restaurant.getKey(), restaurant.getValue());
        }

        System.out.println("\n/***Nouveaux menus stockés dans les pairs***\\");

        for(Map.Entry<String, String> restaurant : restaurantsTest2.entrySet())
        {
            System.out.println("Le restaurant de ma liste " + restaurant.getKey() + " a pour plat dans la guide " +
                               "Michelin :  " + guideMichelin.get(restaurant.getKey()));

        }


        System.out.println();
View Full Code Here

                    }
                }
                peer = peer.getSuccessor();
            }
        }
        GuideMichelin guideMichelin = new GuideMichelinImpl(TrackerImpl.this);

        Set cles = compteur.keySet();
        Iterator it = cles.iterator();
        while(it.hasNext())
        {
            String cle = (String) it.next();
            if(compteur.get(cle) < PeerImpl.REPLICATMAX + 1)
            {
                guideMichelin.put(trouveRestaurent(cle), cle, PeerImpl.REPLICATMAX);
            }

        }
    }
View Full Code Here

TOP

Related Classes of application.GuideMichelin

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.