@@ -0,0 +1,2572 @@
+package com.routeme.predictionio;%0A%0Aimport java.io.IOException;%0Aimport java.util.Map;%0Aimport java.util.Random;%0Aimport java.util.concurrent.ExecutionException;%0A%0Aimport com.google.common.collect.ImmutableMap;%0A%0Aimport io.prediction.EventClient;%0A%0Apublic class PredictionIOClient %7B%0A    private final String accessKey = %22aw90ujBL5FynPicxaYnMmAxnTaOXWdCSFD2KtcBsszfHZ4h-j2EP6Wm5woRfZjNX%22;%0A    private EventClient eventClient;%0A    Random rand = new Random();%0A    Map%3CString, Object%3E emptyProperty = ImmutableMap.of();%0A%0A    public PredictionIOClient() %7B%0A        eventClient = new EventClient(accessKey);%0A    %7D%0A%0A    public void closeEventClient() %7B%0A        eventClient.close();%0A    %7D%0A%0A    public EventClient getEventClient() %7B%0A        return eventClient;%0A    %7D%0A%0A    public void setEventClient(EventClient eventClient) %7B%0A        this.eventClient = eventClient;%0A    %7D%0A%0A    public void addUsersToClient(int numberOfUsers) %7B%0A        for (int user = 1; user %3C= numberOfUsers; user++) %7B%0A            System.out.println(%22Add user %22 + user);%0A            try %7B%0A                eventClient.setUser(%22%22 + user, emptyProperty);%0A            %7D catch (ExecutionException %7C InterruptedException %7C IOException e) %7B%0A                System.out.println(%22Failed to add user %22 + user + %22 to client because of %22 + e.getMessage());%0A            %7D%0A        %7D%0A    %7D%0A%0A    public void addRoutesToClient(int numberOfRoutes) %7B%0A        for (int route = 1; route %3C= numberOfRoutes; route++) %7B%0A            System.out.println(%22Add item %22 + route);%0A            try %7B%0A                eventClient.setItem(%22%22 + route, emptyProperty);%0A            %7D catch (ExecutionException %7C InterruptedException %7C IOException e) %7B%0A                System.out.println(%22Failed to add route %22 + route + %22 to client because of %22 + e.getMessage());%0A            %7D%0A        %7D%0A    %7D%0A%0A    public void randomRouteTakes(int numberOfUsers, int numberOfRoutes) %7B%0A        for (int user = 1; user %3C= numberOfUsers; user++) %7B%0A            int routeCounter = 1;%0A            while (routeCounter %3C= numberOfRoutes) %7B%0A                int route = rand.nextInt(numberOfRoutes) + 1;%0A                System.out.println(%22User %22 + user + %22 takes route %22 + route);%0A                try %7B%0A                    eventClient.userActionItem(%22take%22, %22%22 + user, %22%22 + route, emptyProperty);%0A                %7D catch (ExecutionException %7C InterruptedException %7C IOException e) %7B%0A                    System.out.println(%22User %22 + user + %22failed to take route %22 + route + %22 because of %22%0A                            + e.getMessage());%0A                %7D%0A            %7D%0A        %7D%0A    %7D%0A%0A%7D%0A

Implement PredictionIOClient with quick dummy import of users and routes