Example usage for java.util ArrayList toString

List of usage examples for java.util ArrayList toString

Introduction

In this page you can find the example usage for java.util ArrayList toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:com.zira.profile.GetProfile.java

private void logout() {
    if (Util.isNetworkAvailable(GetProfile.this)) {
        ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
        nameValuePairs.add(new BasicNameValuePair("useremail", prefs.getString("useremail", "")));
        Log.e("logout", nameValuePairs.toString());

        AsyncTaskForZira mTask = new AsyncTaskForZira(GetProfile.this, "Logout", nameValuePairs, true,
                "Please wait...");
        mTask.delegate = (AsyncResponseForZira) GetProfile.this;
        mTask.execute();//from w  w w .java  2  s.  c  o  m
    } else {
        Util.alertMessage(GetProfile.this, "Please check your internet connection");
    }

}

From source file:com.arainfor.thermostat.daemon.HvacMonitor.java

/**
 * This handles the callback for Thermometer changes.
 * @param thermometerChanged//from   ww w .ja  v  a  2s.  co m
 * @param value
 */
@Override
public synchronized void subjectChanged(Thermometer thermometerChanged, double value) {

    ArrayList<Temperature> temperatureList = TemperaturesList.getInstance().list();
    Iterator<Temperature> it = temperatureList.iterator();

    while (it.hasNext()) {
        Temperature temperature = it.next();
        if (temperature.getIndex() == thermometerChanged.getIndex()) {
            temperature.setValue(value);
            temperatureList.set(temperature.getIndex(), temperature);
            temperatureLogger.logMessage(temperatureList.toString());
            break;
        }
    }
}

From source file:fr.mobilit.neo4j.server.service.nantes.CycleRentTest.java

@BeforeClass
public void setUp() throws Exception {
    super.setUp(true);
    HttpClient client = new HttpClient();
    GetMethod get = null;/*from  w  ww .j  a v a 2  s  .  c  o m*/
    try {
        // we do the http call and parse the xml response
        get = new GetMethod(CycleRentImpl.IMPORT_URL);
        client.executeMethod(get);
        javax.xml.stream.XMLInputFactory factory = javax.xml.stream.XMLInputFactory.newInstance();
        javax.xml.stream.XMLStreamReader parser = factory.createXMLStreamReader(get.getResponseBodyAsStream());
        ArrayList<String> currentXMLTags = new ArrayList<String>();
        int depth = 0;
        while (true) {
            int event = parser.next();
            if (event == javax.xml.stream.XMLStreamConstants.END_DOCUMENT) {
                break;
            }
            switch (event) {
            case javax.xml.stream.XMLStreamConstants.START_ELEMENT:
                currentXMLTags.add(depth, parser.getLocalName());
                String tagPath = currentXMLTags.toString();
                // here we have a match, so we construct the POI
                if (tagPath.equals("[carto, markers, marker]")) {
                    numberOfStations++;
                }
                depth++;
                break;
            case javax.xml.stream.XMLStreamConstants.END_ELEMENT:
                depth--;
                currentXMLTags.remove(depth);
                break;
            default:
                break;
            }
        }
    } catch (Exception e) {
        throw new RuntimeException(e.getMessage(), e.getCause());
    } finally {
        get.releaseConnection();
    }
}

From source file:freightKt.KTFreight_v3.java

/**
 * Prft ob alle Services auch in den geplanten Touren vorkommen, d.h., ob sie auhc tatschslcih geplant wurden.
 * Falls nicht: log.Error und Ausgabe einer Datei: "#UnassignedServices.txt" mit den Service-Ids.
 * @param carriers//ww  w . ja  v a2s .c  om
 */

//TODO: Ausgabe der Anassigned Services in Run-Verzeichnis und dafrin der bersicht nur eine Nennung der Anzahl unassignedServices je Run 
//TODO: multiassigned analog.
private static void checkServiceAssignment(Carriers carriers) {
    for (Carrier c : carriers.getCarriers().values()) {
        ArrayList<CarrierService> assignedServices = new ArrayList<CarrierService>();
        ArrayList<CarrierService> multiassignedServices = new ArrayList<CarrierService>();
        ArrayList<CarrierService> unassignedServices = new ArrayList<CarrierService>();

        System.out.println("### Carrier: " + c.getId());
        //Erfasse alle einer Tour zugehrigen (-> stattfindenden) Services 
        for (ScheduledTour tour : c.getSelectedPlan().getScheduledTours()) {
            for (TourElement te : tour.getTour().getTourElements()) {
                if (te instanceof ServiceActivity) {
                    CarrierService assigService = ((ServiceActivity) te).getService();
                    if (!assignedServices.contains(assigService)) {
                        assignedServices.add(assigService);
                        System.out.println("Assigned Service: " + assignedServices.toString());
                    } else {
                        multiassignedServices.add(assigService);
                        log.error("Service wurde von dem Carrier " + c.getId().toString()
                                + " bereits angefahren: " + assigService.getId().toString());
                    }
                }
            }
        }

        //Nun prfe, ob alle definierten Service zugeordnet wurden
        for (CarrierService service : c.getServices()) {
            System.out.println("Service to Check: " + service.toString());
            if (!assignedServices.contains(service)) {
                System.out.println("Service not assigned: " + service.toString());
                unassignedServices.add(service);
                log.error("Service wird von Carrier " + c.getId().toString() + " NICHT bedient: "
                        + service.getId().toString());
            } else {
                System.out.println("Service was assigned: " + service.toString());
            }
        }

        //Schreibe die mehrfach eingeplanten Services in Datei
        if (!multiassignedServices.isEmpty()) {
            try {
                FileWriter writer = new FileWriter(new File(TEMP_DIR + "#MultiAssignedServices.txt"), true);
                writer.write("#### Multi-assigned Services of Carrier: " + c.getId().toString()
                        + System.getProperty("line.separator"));
                for (CarrierService s : multiassignedServices) {
                    writer.write(s.getId().toString() + System.getProperty("line.separator"));
                }
                writer.flush();
                writer.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        //Schreibe die nicht eingeplanten Services in Datei
        if (!unassignedServices.isEmpty()) {
            try {
                FileWriter writer = new FileWriter(new File(TEMP_DIR + "#UnassignedServices.txt"), true);
                writer.write("#### Unassigned Services of Carrier: " + c.getId().toString()
                        + System.getProperty("line.separator"));
                for (CarrierService s : unassignedServices) {
                    writer.write(s.getId().toString() + System.getProperty("line.separator"));
                }
                writer.flush();
                writer.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    } //for(carriers)

}

From source file:nz.co.fortytwo.signalk.processor.FullExportProcessor.java

@Override
public String getSubscriptionDetails() {
    ArrayList<String> subDetails = new ArrayList<>();
    for (Subscription s : manager.getSubscriptions(wsSession)) {
        if (routeId.equals(s.getRouteId())) {
            subDetails.add(s.toString());
        }/*  ww w.j  a  va  2  s  .  co m*/
    }
    return subDetails.toString();
}

From source file:MDRevealer.ResistanceTests.java

public static void do_tests(ArrayList<Bacterium> bacteriacollection, File rt_input, int i)
        throws FileNotFoundException, XMLStreamException {
    // Put together the actual test
    ArrayList<HashMap<String, String>> tests = parse_test(rt_input);
    ArrayList<String> bacteria = new ArrayList<String>();
    HashMap<String, String> condition = new HashMap<String, String>();
    String drug = "null";
    String value = "null";
    String read_type = "null";
    String comparison = "null";
    String condition_status = "null";
    ArrayList<Integer> conditions_passed = new ArrayList<Integer>();
    ArrayList<Integer> required_conditions = new ArrayList<Integer>();
    int sub_conditions_passed = 0;
    int number_required = 1;
    String cond = "null";
    String ri_value = "null";
    String ri_drug = "null";
    String ri_type = "null";
    for (int step = 0; step < tests.size(); step++) {
        if (tests.get(step).containsKey("condition_over")) {
            for (String bacterium : bacteria) {
                if (bacteriacollection.get(i).getName().toUpperCase().contains(bacterium.toUpperCase())
                        || (bacterium.equals("Generic") && bacteriacollection.get(i).getGeneric() == true)
                        || bacterium.equals("Any")) {
                    if ((read_type.equals("Call") && !cond.equals("failed")) || (read_type.equals("MIC")
                            && sub_conditions_passed >= number_required && number_required != 0)) {
                        // NullPointerErrors will be the death of me...
                        if (conditions_passed.toString().equals(null)) {
                            conditions_passed.add(Integer.parseInt(condition.get("number")));
                        } else if (!conditions_passed.toString().contains(condition.get("number"))) {
                            conditions_passed.add(Integer.parseInt(condition.get("number")));
                        }//ww w .j  a  v  a 2 s.  co  m
                    }
                }
            }
            sub_conditions_passed = 0;
            number_required = 1;
        }
        if (tests.get(step).containsKey("test_name")) {
            // Reset everything
            bacteria = new ArrayList<String>();
            drug = "null";
            value = "null";
            read_type = "null";
            comparison = "null";
            condition_status = "null";
            conditions_passed = new ArrayList<Integer>();
            required_conditions = new ArrayList<Integer>();
            sub_conditions_passed = 0;
            number_required = 0;
            cond = "null";
        } else if (tests.get(step).containsKey("bacterium")) {
            bacteria.add(tests.get(step).get("bacterium"));
        } else if (tests.get(step).containsKey("default") && tests.get(step).containsKey("number")) {
            condition = tests.get(step);
            cond = tests.get(step).get("default");
            if (tests.get(step).containsKey("number_required")) {
                number_required = Integer.parseInt(tests.get(step).get("number_required"));
            }
        } else if (tests.get(step).containsKey("name")) {
            drug = tests.get(step).get("name");
        } else if (tests.get(step).containsKey("value") && tests.get(step).containsKey("read_type")) {
            value = tests.get(step).get("value");
            read_type = tests.get(step).get("read_type");
            if (read_type.equals("MIC")) {
                comparison = tests.get(step).get("comparison");
            }
        } else if (tests.get(step).containsKey("condition_status")) {
            condition_status = tests.get(step).get("condition_status");

            // Finally do the actual tests
            for (int j = 0; j < bacteriacollection.get(i).drugSize(); j++) {
                for (String bacterium : bacteria) {
                    if (bacteriacollection.get(i).getName().toUpperCase().contains(bacterium.toUpperCase())
                            || (bacterium.equals("Generic") && bacteriacollection.get(i).getGeneric() == true)
                            || bacterium.equals("Any")) {
                        if (bacteriacollection.get(i).getDrug(j).equals(drug)) {
                            if (read_type.equals("Call")) {
                                if ((bacteriacollection.get(i).getCall(j).equals(value))) {
                                    if (condition_status.equals("failed")) {
                                        cond = "failed";
                                    } else if (condition_status.equals("+")) {
                                        sub_conditions_passed++;
                                    } else if (condition_status.equals("-")) {
                                        sub_conditions_passed--;
                                    } else if (condition_status.equals("passed")) {
                                        cond = "passed";
                                    }
                                }
                            } else if (read_type.equals("MIC")) {
                                switch (comparison) {
                                case "greater_than":
                                    if (bacteriacollection.get(i).getMIC(j) > Double.parseDouble(value)) {
                                        if (condition_status.equals("failed")) {
                                            cond = "failed";
                                        } else if (condition_status.equals("+")) {
                                            sub_conditions_passed++;
                                        } else if (condition_status.equals("-")) {
                                            sub_conditions_passed--;
                                        } else if (condition_status.equals("passed")) {
                                            cond = "passed";
                                        }
                                    }
                                    break;
                                case "less_than":
                                    if (bacteriacollection.get(i).getMIC(j) < Double.parseDouble(value)) {
                                        if (condition_status.equals("failed")) {
                                            cond = "failed";
                                        } else if (condition_status.equals("+")) {
                                            sub_conditions_passed++;
                                        } else if (condition_status.equals("-")) {
                                            sub_conditions_passed--;
                                        } else if (condition_status.equals("passed")) {
                                            cond = "passed";
                                        }
                                    }
                                    break;
                                case "greater_than_equal":
                                    if (bacteriacollection.get(i).getMIC(j) >= Double.parseDouble(value)) {
                                        if (condition_status.equals("failed")) {
                                            cond = "failed";
                                        } else if (condition_status.equals("+")) {
                                            sub_conditions_passed++;
                                        } else if (condition_status.equals("-")) {
                                            sub_conditions_passed--;
                                        } else if (condition_status.equals("passed")) {
                                            cond = "passed";
                                        }
                                    }
                                    break;
                                case "less_than_equal":
                                    if (bacteriacollection.get(i).getMIC(j) <= Double.parseDouble(value)) {
                                        if (condition_status.equals("failed")) {
                                            cond = "failed";
                                        } else if (condition_status.equals("+")) {
                                            sub_conditions_passed++;
                                        } else if (condition_status.equals("-")) {
                                            sub_conditions_passed--;
                                        } else if (condition_status.equals("passed")) {
                                            cond = "passed";
                                        }
                                    }
                                    break;
                                default:
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        } else if (tests.get(step).containsKey("required_condition")) {
            for (String bacterium : bacteria) {
                if (bacteriacollection.get(i).getName().toUpperCase().contains(bacterium.toUpperCase())
                        || (bacterium.equals("Generic") && bacteriacollection.get(i).getGeneric() == true)
                        || bacterium.equals("Any")) {
                    if (!required_conditions.toString().contains(condition.get("number"))) {
                        required_conditions.add(Integer.parseInt(tests.get(step).get("required_condition")));
                    }
                }
            }
        } else if (tests.get(step).containsKey("required_if")) {
            ri_value = tests.get(step - 1).get("value");
            ri_type = tests.get(step - 1).get("read_type");
            ri_drug = tests.get(step - 1).get("drug");
            for (int j = 0; j < bacteriacollection.get(i).drugSize(); j++) {
                for (String bacterium : bacteria) {
                    if (bacteriacollection.get(i).getName().contains(bacterium)
                            || (bacterium.equals("Generic") && bacteriacollection.get(i).getGeneric() == true)
                            || bacterium.equals("Any")) {
                        if (bacteriacollection.get(i).getDrug(j).equals(ri_drug)) {
                            if (ri_type.equals("Call")) {
                                if ((bacteriacollection.get(i).getCall(j).equals(ri_value))) {
                                    required_conditions
                                            .add(Integer.parseInt(tests.get(step).get("required_if")));
                                }
                            } else if (ri_type.equals("MIC")) {
                                switch (comparison) {
                                case "greater_than":
                                    if (bacteriacollection.get(i).getMIC(j) > Double.parseDouble(value)) {
                                        required_conditions
                                                .add(Integer.parseInt(tests.get(step).get("required_if")));
                                    }
                                    break;
                                case "less_than":
                                    if (bacteriacollection.get(i).getMIC(j) < Double.parseDouble(value)) {
                                        required_conditions
                                                .add(Integer.parseInt(tests.get(step).get("required_if")));
                                    }
                                    break;
                                case "greater_than_equal":
                                    if (bacteriacollection.get(i).getMIC(j) >= Double.parseDouble(value)) {
                                        required_conditions
                                                .add(Integer.parseInt(tests.get(step).get("required_if")));
                                    }
                                    break;
                                case "less_than_equal":
                                    if (bacteriacollection.get(i).getMIC(j) <= Double.parseDouble(value)) {
                                        required_conditions
                                                .add(Integer.parseInt(tests.get(step).get("required_if")));
                                    }
                                    break;
                                default:
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        } else if (tests.get(step).containsKey("result")) {
            ArrayList<Integer> common_conditions = (ArrayList<Integer>) CollectionUtils
                    .retainAll(conditions_passed, required_conditions);
            if (common_conditions.toString().equals(required_conditions.toString())
                    && conditions_passed.size() > 0) {
                if (tests.get(step).get("result").equals("Carb")) {
                    bacteriacollection.get(i).setCarb(true);
                } else if (tests.get(step).get("result").equals("ESBL")) {
                    bacteriacollection.get(i).setESBL("true");
                } else if (tests.get(step).get("result").equals("VRE")) {
                    bacteriacollection.get(i).setVRE(true);
                } else if (tests.get(step).get("result").equals("MRSA")) {
                    bacteriacollection.get(i).setOxa(true);
                } else {
                    bacteriacollection.get(i).setCustom(tests.get(step).get("result"));
                }
            }
        }
    }
}

From source file:ss.udapi.sdk.services.HttpServices.java

public ServiceRequest getSession(String url, boolean compressionEnabled) throws Exception {

    this.compressionEnabled = compressionEnabled;
    List<RestItem> loginRestItems = null;
    ServiceRequest loginResp = new ServiceRequest();

    CloseableHttpClient httpClient = null;
    try {//from ww w  .  j  av  a  2s . c  om

        logger.info("Retrieving connection actions from url: " + url);

        // this is only to check whether the URL format is correct
        new URL(url);

        HttpGet httpGet = new HttpGet(url);
        if (compressionEnabled == true) {
            httpGet.setHeader("Accept-Encoding", "gzip");
        }

        httpClient = HttpClients.custom().setKeepAliveStrategy(requestTimeout).build();
        ResponseHandler<String> responseHandler = getResponseHandler(401);

        // Call the end-point using connectivity details we've prepared above
        // and get the list of end-points we have access to.
        String responseBody = httpClient.execute(httpGet, responseHandler);

        loginRestItems = JsonHelper.toRestItems(responseBody);
        ArrayList<String> names = new ArrayList<String>();
        for (RestItem item : loginRestItems) {
            names.add(item.getName());
        }

        logger.debug("Retrieved connection actions: " + names.toString());

        loginResp.setServiceRestItems(loginRestItems);
        return loginResp;

    } catch (MalformedURLException urlEx) {
        logger.error("malformed URL: " + url);
        throw urlEx;
    } catch (ClientProtocolException protEx) {
        logger.error("Invalid Client Protocol: " + protEx.getCause());
        throw protEx;
    } catch (IOException ioEx) {
        logger.error("Communication error: to URL [" + url + "]");
        throw ioEx;
    } finally {

        try {
            if (httpClient != null)
                httpClient.close();
        } catch (IOException ex) {
            // Can safely be ignored, either the server closed the
            // connection or we didn't open it so there's nothing to do.
        }
    }
}

From source file:com.hp.test.framework.Utlis.java

public static Map<String, List<String>> GetCountsrunsWise(ArrayList runs, String path) {
    String string = "";

    Map<String, List<String>> Run_counts = new HashMap<String, List<String>>();
    for (int count = 0; count < runs.size(); count++) {
        Boolean runhasData = false;
        String file = path + "\\" + runs.get(count) + "\\pieChart.js";

        //reading   
        try {//  w w w .  j  a  va 2s  . co m
            InputStream ips = new FileInputStream(file);
            InputStreamReader ipsr = new InputStreamReader(ips);
            BufferedReader br = new BufferedReader(ipsr);
            String line;
            ArrayList<String> ar = new ArrayList<String>();
            while ((line = br.readLine()) != null) {
                runhasData = true;
                if (line.contains("var data")) {
                    // System.out.println(line);
                    String tem_ar[] = line.split("=");
                    //System.out.println(tem_ar[1]);
                    String temp_ar1[] = tem_ar[1].split(",");
                    String counts = "";
                    for (int i = 0; i < temp_ar1.length; i++) {
                        temp_ar1[i] = temp_ar1[i].replace("[", "");
                        temp_ar1[i] = temp_ar1[i].replace("]", "");
                        temp_ar1[i] = temp_ar1[i].replace("'", "");
                        String temp = temp_ar1[i];
                        ar.add(temp);
                        counts = counts + temp;
                        // System.out.println(temp_ar1[i]);

                    }
                    string += line + "\n";
                    Run_counts.put(runs.get(count).toString(), ar);
                    log.info("counts run wise-->" + runs.get(count) + "***" + ar.toString());
                    break;
                }
            }
            br.close();
        } catch (Exception e) {
            log.error(e.toString());

        }
        if (!runhasData) {
            ArrayList<String> ar = new ArrayList<String>();
            ar.add("Passed");
            ar.add("0");
            ar.add("Failed");
            ar.add("0");
            ar.add("Skipped");
            ar.add("0;");

            Run_counts.put(runs.get(count).toString(), ar);
            log.info("has NO*******  data for " + runs.get(count));
        }
    }
    return Run_counts;

}

From source file:com.nuance.expertassistant.ReadExcelFile.java

public HashMap<String, ArrayList<HashMap<String, String>>> evaluateFromRatingDB(String ProjectID) {
    HashMap<String, ArrayList<HashMap<String, String>>> EvalMap = new HashMap<String, ArrayList<HashMap<String, String>>>();
    HashMap<String, HashMap<String, String>> QAList = new HashMap<String, HashMap<String, String>>();

    try {/*w  ww .  j  a  v  a 2s. com*/
        QAList = QueryDB.fetchQAList(ProjectID);
        Iterator it = QAList.entrySet().iterator();
        while (it.hasNext()) {
            Map.Entry pair1 = (Map.Entry) it.next();

            HashMap<String, String> ratedResponses = (HashMap<String, String>) pair1.getValue();

            String Question = pair1.getKey().toString();

            Iterator it2 = ratedResponses.entrySet().iterator();

            ArrayList<HashMap<String, String>> responseArray4Question = new ArrayList<HashMap<String, String>>();

            while (it2.hasNext()) {
                Map.Entry pair2 = (Map.Entry) it2.next();
                System.out.println(Question + " = " + pair2.getKey());

                /**
                 * ***********************************
                 */
                HashMap<String, String> queryAnalysis = new HashMap<String, String>();

                System.out.println(" The QueryList String is " + Question);
                System.out.println(" The ExpectedResultList String is " + pair2.getKey());

                queryAnalysis.put("Query", Question);
                queryAnalysis.put("ExpectedResult", pair2.getKey().toString());
                queryAnalysis.put("UserRating", pair2.getValue().toString());
                queryAnalysis.put("GoldResponses", String.valueOf(ratedResponses.size()));
                queryAnalysis.put("Found", "NO");
                queryAnalysis.put("Rank", "-1");
                queryAnalysis.put("PassageLength", "-1");
                queryAnalysis.put("numResponses", "-1");

                ArrayList<Integer> resultArray = new ArrayList<Integer>();

                resultArray = retrieveAnswers(ProjectID, Question, pair2.getKey().toString());

                System.out.println("Result Array" + resultArray.toString());

                if (resultArray.get(0) == 1) {
                    queryAnalysis.put("Found", "YES");
                    queryAnalysis.put("Rank", resultArray.get(1).toString());
                    queryAnalysis.put("PassageLength", resultArray.get(2).toString());
                    queryAnalysis.put("numResponses", resultArray.get(3).toString());

                }

                responseArray4Question.add(queryAnalysis);

                /**
                 * ************************************
                 */
            }

            System.out.println("*************************************");
            System.out.println("**************EVALUTE****************");
            System.out.println("*************************************");

            for (int i = 0; i < responseArray4Question.size(); i++) {
                System.out.println("" + responseArray4Question.get(i).get("Query"));
                System.out.println("" + responseArray4Question.get(i).get("ExpectedResult"));
                System.out.println("" + responseArray4Question.get(i).get("UserRating"));
                System.out.println("" + responseArray4Question.get(i).get("GoldResponses"));
                System.out.println("" + responseArray4Question.get(i).get("Found"));
                System.out.println("" + responseArray4Question.get(i).get("Rank"));
                System.out.println("" + responseArray4Question.get(i).get("PassageLength"));

            }

            EvalMap.put(Question, responseArray4Question);

        }

    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }

    System.out.println("*************************************");
    System.out.println("**************Print EvalMap****************");
    System.out.println("*************************************");

    Iterator it = EvalMap.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry pair = (Map.Entry) it.next();
        ArrayList<HashMap<String, String>> responseArray = (ArrayList<HashMap<String, String>>) pair.getValue();

        for (int i = 0; i < responseArray.size(); i++) {

            System.out.println("" + responseArray.get(i).get("Query"));
            System.out.println("" + responseArray.get(i).get("ExpectedResult"));
            System.out.println("" + responseArray.get(i).get("Found"));
            System.out.println("" + responseArray.get(i).get("Rank"));
            System.out.println("" + responseArray.get(i).get("PassageLength"));
        }
    }

    System.out.println("*************************************");
    System.out.println("**************Print[ed] EvalMap****************");
    System.out.println("*************************************");

    return EvalMap;
}

From source file:com.nuance.expertassistant.ReadExcelFile.java

public ArrayList<HashMap<String, String>> readExcelFile(String ProjectID, String filename) {
    try {//  w w  w .  j av  a  2 s  .co m
        Workbook workbook = Workbook
                .getWorkbook(new File("/usr/local/Nuance/MultiModalFramework/uploadedFiles/" + filename));
        Sheet sheet = workbook.getSheet(0);

        ArrayList<HashMap<String, String>> EvalArray = new ArrayList<HashMap<String, String>>();

        System.out.println(" The number of rows are :" + sheet.getRows());
        System.out.println(" The number of coloumn are :" + sheet.getColumns());

        int numrows = sheet.getRows();
        //int numcols = sheet.getColumns();

        for (int i = 1; i < numrows; i++) {

            HashMap<String, String> queryAnalysis = new HashMap<String, String>();

            System.out.println(" The QueryList String is " + sheet.getCell(0, i).getContents());
            System.out.println(" The ExpectedResultList String is " + sheet.getCell(1, i).getContents());

            queryAnalysis.put("Query", sheet.getCell(0, i).getContents());
            queryAnalysis.put("ExpectedResult", sheet.getCell(1, i).getContents());
            queryAnalysis.put("Found", "NO");
            queryAnalysis.put("Rank", "-1");
            queryAnalysis.put("PassageLength", "-1");

            ArrayList<Integer> resultArray = new ArrayList<Integer>();

            resultArray = retrieveAnswers(ProjectID, sheet.getCell(0, i).getContents(),
                    sheet.getCell(1, i).getContents());

            System.out.println("Result Array" + resultArray.toString());

            if (resultArray.get(0) == 1) {
                queryAnalysis.put("Found", "YES");
                queryAnalysis.put("Rank", resultArray.get(1).toString());
                queryAnalysis.put("PassageLength", resultArray.get(2).toString());
            }

            EvalArray.add(queryAnalysis);

        }

        System.out.println("*************************************");
        System.out.println("**************EVALUTE****************");
        System.out.println("*************************************");

        for (int i = 0; i < EvalArray.size(); i++) {
            System.out.println("" + EvalArray.get(i).get("Query"));
            System.out.println("" + EvalArray.get(i).get("ExpectedResult"));
            System.out.println("" + EvalArray.get(i).get("Found"));
            System.out.println("" + EvalArray.get(i).get("Rank"));
            System.out.println("" + EvalArray.get(i).get("PassageLength"));

        }

        return EvalArray;

    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }

}