Example usage for java.util HashMap entrySet

List of usage examples for java.util HashMap entrySet

Introduction

In this page you can find the example usage for java.util HashMap entrySet.

Prototype

Set entrySet

To view the source code for java.util HashMap entrySet.

Click Source Link

Document

Holds cached entrySet().

Usage

From source file:edu.cornell.mannlib.vitro.webapp.controller.grefine.JSONReconcileServlet.java

private JSONObject runSearch(HashMap<String, JSONObject> currMap) throws ServletException {
    JSONObject qJson = new JSONObject();

    try {/*www. j av  a 2 s . c o  m*/

        for (Map.Entry<String, JSONObject> entry : currMap.entrySet()) {
            JSONObject resultAllJson = new JSONObject();
            String key = entry.getKey();
            JSONObject json = entry.getValue();
            String queryVal = json.getString("query");

            // System.out.println("query: " + json.toString());

            // continue with properties list
            String searchType = null;
            int limit = 10; // default
            String typeStrict = "should"; // default
            ArrayList<String[]> propertiesList = new ArrayList<String[]>();

            if (json.has("type")) {
                searchType = json.getString("type");
            }
            if (json.has("limit")) {
                limit = json.getInt("limit");
            }
            if (json.has("type_strict")) { // Not sure what this variable
                // represents. Skip for now.
                typeStrict = json.getString("type_strict");
            }
            if (json.has("properties")) {
                JSONArray properties = json.getJSONArray("properties");
                for (int i = 0; i < properties.length(); i++) {
                    String[] pvPair = new String[2];
                    JSONObject jsonProperty = properties.getJSONObject(i);
                    String pid = jsonProperty.getString("pid");
                    String v = jsonProperty.getString("v");
                    if (pid != null && v != null) {
                        pvPair[0] = pid;
                        pvPair[1] = v;
                        propertiesList.add(pvPair);
                    }
                }
            }

            // begin search
            JSONArray resultJsonArr = new JSONArray();

            SearchQuery query = getQuery(queryVal, searchType, limit, propertiesList);
            SearchResponse queryResponse = null;
            if (query != null) {
                SearchEngine search = ApplicationUtils.instance().getSearchEngine();
                queryResponse = search.query(query);
            } else {
                log.error("Query for a search was null");
            }

            SearchResultDocumentList docs = null;
            if (queryResponse != null) {
                docs = queryResponse.getResults();
            } else {
                log.error("Query response for a search was null");
            }

            if (docs != null) {

                List<SearchResult> results = new ArrayList<SearchResult>();
                for (SearchResultDocument doc : docs) {
                    try {
                        String uri = doc.getStringValue(VitroSearchTermNames.URI);
                        String name = doc.getStringValue(VitroSearchTermNames.NAME_RAW);

                        SearchResult result = new SearchResult(name, uri);

                        // populate result for Google Refine
                        JSONObject resultJson = new JSONObject();
                        resultJson.put("score", doc.getFirstValue("score"));
                        String modUri = result.getUri().replace("#", "%23");
                        resultJson.put("id", modUri);
                        resultJson.put("name", result.getLabel());

                        Collection<Object> rdfTypes = doc.getFieldValues(VitroSearchTermNames.RDFTYPE);
                        JSONArray typesJsonArr = new JSONArray();
                        if (rdfTypes != null) {

                            for (Object rdfType : rdfTypes) {

                                // e.g.
                                // http://aims.fao.org/aos/geopolitical.owl#area
                                String type = (String) rdfType;
                                int lastIndex2 = type.lastIndexOf('/') + 1;
                                String typeName = type.substring(lastIndex2);
                                typeName = typeName.replace("#", ":");
                                JSONObject typesJson = new JSONObject();
                                typesJson.put("id", type);
                                typesJson.put("name", typeName);
                                typesJsonArr.put(typesJson);

                            }
                        }

                        resultJson.put("type", typesJsonArr);
                        resultJson.put("match", "false");
                        resultJsonArr.put(resultJson);

                    } catch (Exception e) {
                        log.error("problem getting usable individuals from search " + "hits" + e.getMessage());
                    }
                }
            } else {
                log.error("Docs for a search was null");
            }
            resultAllJson.put("result", resultJsonArr);
            qJson.put(key, resultAllJson);
            // System.out.println("results: " + qJson.toString());
        }

    } catch (JSONException ex) {
        log.error("JSONException: " + ex);
        throw new ServletException("JSONReconcileServlet JSONException: " + ex);
    } catch (SearchEngineException ex) {
        log.error("JSONException: " + ex);
        throw new ServletException("JSONReconcileServlet SearchEngineException: " + ex);
    }

    return qJson;
}

From source file:Interface.Caruser.Pendingrequest.java

public void populatecartypecombobox() {
    HashMap<String, Integer> cartype = new HashMap<String, Integer>();
    cartype.put("Nisaan Rogue", 6);
    cartype.put("Nisaan Chevrolet", 4);
    cartype.put("Versa", 2);
    cartype.put("Ford Fiesta", 4);
    cartype.put("Toyota corolla", 5);
    cartype.put("Honda Civic", 3);
    cartype.put("GMC Canyon", 2);
    cartype.put("Chevrolet silverado", 4);

    cartypesjComboBox.removeAllItems();//w ww. j ava 2s.  c om

    Set set = cartype.entrySet();
    Iterator iterator = set.iterator();
    while (iterator.hasNext()) {
        Map.Entry mentry = (Map.Entry) iterator.next();
        cartypesjComboBox.addItem(mentry.getKey());
    }
}

From source file:net.dahanne.gallery.g2.java.client.business.G2Client.java

public int createNewAlbum(String galleryUrl, int parentAlbumName, String albumName, String albumTitle,
        String albumDescription) throws GalleryConnectionException {
    int newAlbumName = 0;

    List<NameValuePair> nameValuePairsFetchImages = new ArrayList<NameValuePair>();
    nameValuePairsFetchImages.add(CREATE_ALBUM_CMD_NAME_VALUE_PAIR);
    nameValuePairsFetchImages.add(new BasicNameValuePair("g2_form[set_albumName]", "" + parentAlbumName));
    nameValuePairsFetchImages.add(new BasicNameValuePair("g2_form[newAlbumName]", albumName));
    nameValuePairsFetchImages.add(new BasicNameValuePair("g2_form[newAlbumTitle]", albumTitle));
    nameValuePairsFetchImages.add(new BasicNameValuePair("g2_form[newAlbumDesc]", albumDescription));

    HashMap<String, String> properties = sendCommandToGallery(galleryUrl, nameValuePairsFetchImages, null);
    for (Entry<String, String> entry : properties.entrySet()) {
        if (entry.getKey().equals(ALBUM_NAME)) {
            newAlbumName = new Integer(entry.getValue()).intValue();
        }/*from ww w.  j a va2s .c o m*/
    }
    return newAlbumName;
}

From source file:com.enonic.cms.business.portal.instruction.PostProcessInstructionExecutorImpl.java

private String executeRenderWindowInstruction(RenderWindowInstruction instruction,
        PostProcessInstructionContext context) {
    WindowKey portletWindowKey = new WindowKey(instruction.getPortletWindowKey());

    String[] params = instruction.getParams();

    parseParamsForPostProcessInstructions(params, context);

    HashMap<String, String> map = createParamsMap(params);

    WindowRenderer windowRenderer = windowRendererFactory
            .createPortletRenderer(context.getWindowRendererContext());

    RequestParameters portletParams = new RequestParameters();

    for (Map.Entry<String, String> entry : map.entrySet()) {
        portletParams.addParameterValue(entry.getKey(), entry.getValue());
    }/*from   ww w.j  a v a  2 s. co  m*/

    RenderedWindowResult renderedWindowResult = windowRenderer.renderWindowInline(portletWindowKey,
            portletParams);

    return renderedWindowResult.getContent();
}

From source file:edu.utsa.sifter.som.MainSOM.java

void somStats(final SifterConfig conf, final SelfOrganizingMap som, final ArrayList<ArrayList<Long>> clusters,
        final Writer somJS) throws IOException {
    somJS.write("{\"width\":" + som.width() + ", \"height\":" + som.height() + ", \n\"cells\":[\n");

    int numZero = 0;
    int numWith = 0;
    int totalWith = 0;
    long totalSSD = 0;
    int maxNum = 0;
    double maxSSD = 0;
    double maxStd = 0;

    for (int i = 0; i < som.numCells(); ++i) {
        final ArrayList<Long> cluster = clusters.get(i);
        if (cluster.size() == 0) {
            ++numZero;/*w ww  . j  a  va  2  s . c o m*/
        } else {
            ++numWith;
            totalWith += cluster.size();
        }
        totalSSD += som.getStats(i).sumSqrDistance();

        maxNum = Math.max(maxNum, cluster.size());
        maxSSD = Math.max(maxSSD, som.getStats(i).sumSqrDistance());
        maxStd = Math.max(maxStd, som.getStats(i).stdDev());

        somJS.write("{\"topTerms\":[");
        final java.util.Vector<String> topTerms = som.getStats(i).getTopTerms();
        for (int j = 0; j < Conf.NUM_TOP_CELL_TERMS; ++j) {
            if (j != 0) {
                somJS.write(", ");
            }
            somJS.write("\"");
            somJS.write(StringEscapeUtils.escapeEcmaScript(topTerms.get(j)));
            somJS.write("\"");
        }
        somJS.write("], ");
        somJS.write("\"num\":" + cluster.size() + ", \"stdDev\":" + som.getStats(i).stdDev() + ", \"ssd\":"
                + som.getStats(i).sumSqrDistance());
        somJS.write(", \"region\":" + som.getStats(i).getRegion());
        if (i + 1 == som.numCells()) {
            somJS.write("}\n");
        } else {
            somJS.write("},\n");
        }
    }
    somJS.write("], \"numZero\":" + numZero + ", \"numWith\":" + numWith);
    somJS.write(", \"totalWith\":" + totalWith + ", \"avgNum\":"
            + (numWith == 0 ? 0 : (double) totalWith / numWith));
    somJS.write(", \"numOutliers\":" + getNumOutliers());
    somJS.write(", \"ssd\":" + totalSSD + ", \"numRegions\":" + som.getNumRegions());
    somJS.write(", \"maxCellNum\":" + maxNum + ", \"maxCellSSD\":" + maxSSD + ", \"maxCellStd\":" + maxStd
            + ",\n\"regionColors\":[");
    for (int i = 0; i < som.getNumRegions(); ++i) {
        if (i > 0) {
            somJS.write(", ");
        }
        somJS.write(Integer.toString(som.getRegionColor(i)));
    }
    somJS.write("],\n\"regionMap\":[");
    final ArrayList<Set<Integer>> regionMap = som.getRegionMap();
    for (int i = 0; i < regionMap.size(); ++i) {
        if (i > 0) {
            somJS.write(", ");
        }
        somJS.write("[");
        final Set<Integer> adjMap = regionMap.get(i);
        int j = 0;
        for (Integer adj : adjMap) {
            if (j > 0) {
                somJS.write(", ");
            }
            somJS.write(Integer.toString(adj));
            ++j;
        }
        somJS.write("]");
    }
    somJS.write("],\n");

    somJS.write("\"cellTermDiffs\":[\n");
    for (int i = 0; i < som.numCells(); ++i) {
        final HashMap<Integer, Integer> diffs = som.getCellTermDiffs(i);
        if (i != 0) {
            somJS.write(",\n");
        }
        somJS.write("{");
        int j = 0;
        for (Map.Entry<Integer, Integer> pair : diffs.entrySet()) {
            if (j != 0) {
                somJS.write(", ");
            }
            ++j;
            somJS.write("\"");
            somJS.write(Integer.toString(pair.getKey()));
            somJS.write("\": \"");
            int val = pair.getValue();
            if (val < 0) {
                somJS.write("-");
                val = -1 * val;
            }
            somJS.write(Terms.get(val));
            somJS.write("\"");
        }
        somJS.write("}");
    }
    somJS.write("]\n");
    somJS.write("}\n");
}

From source file:com.yahoo.ycsb.db.PostgreSQLJsonbClient.java

private OrderedFieldInfo getFieldInfo(HashMap<String, ByteIterator> values) {
    String fieldKeys = "";
    List<String> fieldValues = new ArrayList();
    int count = 0;
    for (Map.Entry<String, ByteIterator> entry : values.entrySet()) {
        fieldKeys += entry.getKey();//ww w .j av a2  s .  com
        if (count < values.size() - 1) {
            fieldKeys += ",";
        }
        fieldValues.add(count, entry.getValue().toString());
        count++;
    }

    return new OrderedFieldInfo(fieldKeys, fieldValues);
}

From source file:eumetsat.pn.common.ISO2JSON.java

private JSONObject convert(Document xmlDocument) throws XPathExpressionException, IOException {
    String expression = null;/*from  w  w w .  ja v  a  2 s  . c  o  m*/
    String result = null;
    XPath xPath = XPathFactory.newInstance().newXPath();
    JSONObject jsonObject = new JSONObject();

    String xpathFileID = "//*[local-name()='fileIdentifier']/*[local-name()='CharacterString']";
    String fileID = xPath.compile(xpathFileID).evaluate(xmlDocument);
    log.trace("{} >>> {}", xpathFileID, fileID);
    if (fileID != null) {
        jsonObject.put(FILE_IDENTIFIER_PROPERTY, fileID);
    }

    expression = "//*[local-name()='hierarchyLevelName']/*[local-name()='CharacterString']";
    JSONArray list = new JSONArray();
    NodeList nodeList = (NodeList) xPath.compile(expression).evaluate(xmlDocument, XPathConstants.NODESET);
    for (int i = 0; i < nodeList.getLength(); i++) {
        list.add(nodeList.item(i).getFirstChild().getNodeValue());
    }
    if (list.size() > 0) {
        JSONObject hierarchies = parseThemeHierarchy((String) jsonObject.get(FILE_IDENTIFIER_PROPERTY), list);
        hierarchies.writeJSONString(writer);
        jsonObject.put("hierarchyNames", hierarchies);
        log.trace("{} >>> {}", expression, jsonObject.get("hierarchyNames"));
    }

    // Get Contact info
    String deliveryPoint = "//*[local-name()='address']//*[local-name()='deliveryPoint']/*[local-name()='CharacterString']";
    String city = "//*[local-name()='address']//*[local-name()='city']/*[local-name()='CharacterString']";
    String administrativeArea = "//*[local-name()='address']//*[local-name()='administrativeArea']/*[local-name()='CharacterString']";
    String postalCode = "//*[local-name()='address']//*[local-name()='postalCode']/*[local-name()='CharacterString']";
    String country = "//*[local-name()='address']//*[local-name()='country']/*[local-name()='CharacterString']";
    String email = "//*[local-name()='address']//*[local-name()='electronicMailAddress']/*[local-name()='CharacterString']";

    StringBuilder addressString = new StringBuilder();
    StringBuilder emailString = new StringBuilder();

    appendIfResultNotNull(xPath, xmlDocument, addressString, deliveryPoint);

    result = xPath.compile(postalCode).evaluate(xmlDocument);
    if (result != null) {
        addressString.append("\n").append(result.trim());
    }

    result = xPath.compile(city).evaluate(xmlDocument);
    if (result != null) {
        addressString.append(" ").append(result.trim());
    }

    result = xPath.compile(administrativeArea).evaluate(xmlDocument);
    if (result != null) {
        addressString.append("\n").append(result.trim());
    }

    result = xPath.compile(country).evaluate(xmlDocument);
    if (result != null) {
        addressString.append("\n").append(result.trim());
    }

    result = xPath.compile(email).evaluate(xmlDocument);
    if (result != null) {
        emailString.append(result.trim());
    }

    HashMap<String, String> map = new HashMap<>();
    map.put("address", addressString.toString());
    map.put("email", emailString.toString());
    jsonObject.put("contact", map);
    log.trace("contact: {}", Arrays.toString(map.entrySet().toArray()));

    // add identification info
    String abstractStr = "//*[local-name()='identificationInfo']//*[local-name()='abstract']/*[local-name()='CharacterString']";
    String titleStr = "//*[local-name()='identificationInfo']//*[local-name()='title']/*[local-name()='CharacterString']";
    String statusStr = "//*[local-name()='identificationInfo']//*[local-name()='status']/*[local-name()='MD_ProgressCode']/@codeListValue";
    String keywords = "//*[local-name()='keyword']/*[local-name()='CharacterString']";

    HashMap<String, Object> idMap = new HashMap<>();

    result = xPath.compile(titleStr).evaluate(xmlDocument);
    if (result != null) {
        idMap.put("title", result.trim());
    }

    result = xPath.compile(abstractStr).evaluate(xmlDocument);
    if (result != null) {
        idMap.put("abstract", result.trim());
    }

    result = xPath.compile(statusStr).evaluate(xmlDocument);
    if (result != null) {
        idMap.put("status", result.trim());
    }

    list = new JSONArray();
    nodeList = (NodeList) xPath.compile(keywords).evaluate(xmlDocument, XPathConstants.NODESET);
    for (int i = 0; i < nodeList.getLength(); i++) {
        list.add(nodeList.item(i).getFirstChild().getNodeValue());
    }

    if (list.size() > 0) {
        idMap.put("keywords", list);
    }

    jsonObject.put("identificationInfo", idMap);
    log.trace("idMap: {}", idMap);

    // get thumbnail product
    String browseThumbnailStr = "//*[local-name()='graphicOverview']//*[local-name()='MD_BrowseGraphic']//*[local-name()='fileName']//*[local-name()='CharacterString']";
    result = xPath.compile(browseThumbnailStr).evaluate(xmlDocument);
    if (result != null) {
        idMap.put("thumbnail", result.trim());
        log.trace("thumbnail: {}", result);
    }

    // add Geo spatial information
    String westBLonStr = "//*[local-name()='extent']//*[local-name()='geographicElement']//*[local-name()='westBoundLongitude']/*[local-name()='Decimal']";
    String eastBLonStr = "//*[local-name()='extent']//*[local-name()='geographicElement']//*[local-name()='eastBoundLongitude']/*[local-name()='Decimal']";
    String northBLatStr = "//*[local-name()='extent']//*[local-name()='geographicElement']//*[local-name()='northBoundLatitude']/*[local-name()='Decimal']";
    String southBLatStr = "//*[local-name()='extent']//*[local-name()='geographicElement']//*[local-name()='southBoundLatitude']/*[local-name()='Decimal']";

    // create a GeoJSON envelope object
    HashMap<String, Object> latlonMap = new HashMap<>();
    latlonMap.put("type", "envelope");

    JSONArray envelope = new JSONArray();
    JSONArray leftTopPt = new JSONArray();
    JSONArray rightDownPt = new JSONArray();

    result = xPath.compile(westBLonStr).evaluate(xmlDocument);
    if (result != null) {
        leftTopPt.add(Double.parseDouble(result.trim()));
    }

    result = xPath.compile(northBLatStr).evaluate(xmlDocument);
    if (result != null) {
        leftTopPt.add(Double.parseDouble(result.trim()));
    }

    result = xPath.compile(eastBLonStr).evaluate(xmlDocument);
    if (result != null) {
        rightDownPt.add(Double.parseDouble(result.trim()));
    }

    result = xPath.compile(southBLatStr).evaluate(xmlDocument);
    if (result != null) {
        rightDownPt.add(Double.parseDouble(result.trim()));
    }

    envelope.add(leftTopPt);
    envelope.add(rightDownPt);

    latlonMap.put("coordinates", envelope);
    jsonObject.put("location", latlonMap);

    DOMImplementationLS domImplementation = (DOMImplementationLS) xmlDocument.getImplementation();
    LSSerializer lsSerializer = domImplementation.createLSSerializer();
    String xmlString = lsSerializer.writeToString(xmlDocument);

    jsonObject.put("xmldoc", xmlString);

    return jsonObject;
}

From source file:com.clustercontrol.ws.collect.CollectEndpoint.java

public HashMapInfo getEventDataMap(ArrayList<String> facilityIdList) throws HinemosUnknown {
    HashMapInfo ret = new HashMapInfo();
    HashMap<String, ArrayListInfo> map = new HashMap<>();
    HashMap<String, ArrayList<EventDataInfo>> map1 = new CollectControllerBean()
            .getEventDataMap(facilityIdList);
    for (Entry<String, ArrayList<EventDataInfo>> e : map1.entrySet()) {
        ArrayListInfo list = new ArrayListInfo();
        list.setList3(e.getValue());/* w  w  w  .  java  2s  . com*/
        map.put(e.getKey(), list);
    }
    ret.setMap7(map);
    return ret;
}

From source file:com.microsoft.windowsazure.mobileservices.authentication.LoginManager.java

/**
 * Normalizes the parameters to add it to the Url
 *
 * @param parameters list of the parameters.
 * @return the parameters to add to the url.
 *///from   w  w w  .j  a va  2  s . c  o m
private String normalizeParameters(HashMap<String, String> parameters) {

    String result = "";

    if (parameters != null && parameters.size() > 0) {
        for (Map.Entry<String, String> parameter : parameters.entrySet()) {

            if (result == "") {
                result = "?";
            } else {
                result += "&";
            }

            result += parameter.getKey() + "=" + parameter.getValue();
        }
    }

    return result;
}

From source file:com.ibm.bi.dml.runtime.controlprogram.parfor.opt.PerfTestTool.java

/**
 * //from   w  ww.ja  v a2  s  .  c om
 * @param dirname
 * @return
 * @throws IOException
 * @throws DMLUnsupportedOperationException
 */
@SuppressWarnings("all")
private static HashMap<Integer, Long> writeResults(String dirname)
        throws IOException, DMLUnsupportedOperationException {
    HashMap<Integer, Long> map = new HashMap<Integer, Long>();
    int count = 1;
    int offset = (MODEL_INTERCEPT ? 1 : 0);
    int cols = MODEL_MAX_ORDER + offset;

    for (Entry<Integer, HashMap<Integer, LinkedList<Double>>> inst : _results.entrySet()) {
        int instID = inst.getKey();
        HashMap<Integer, LinkedList<Double>> instCF = inst.getValue();

        for (Entry<Integer, LinkedList<Double>> cfun : instCF.entrySet()) {
            int tDefID = cfun.getKey();
            long ID = IDHandler.concatIntIDsToLong(instID, tDefID);
            LinkedList<Double> dmeasure = cfun.getValue();

            PerfTestDef def = _regTestDef.get(tDefID);
            LinkedList<Double> dvariable = generateSequence(def.getMin(), def.getMax(), NUM_SAMPLES_PER_TEST);
            int dlen = dvariable.size();
            int plen = def.getInternalVariables().length;

            //write variable data set
            CSVWriter writer1 = new CSVWriter(new FileWriter(dirname + count + "_in1.csv"), ',',
                    CSVWriter.NO_QUOTE_CHARACTER);
            if (plen == 1) //one dimensional function
            {
                //write 1, x, x^2, x^3, ...
                String[] sbuff = new String[cols];
                for (Double val : dvariable) {
                    for (int j = 0; j < cols; j++)
                        sbuff[j] = String.valueOf(Math.pow(val, j + 1 - offset));
                    writer1.writeNext(sbuff);
                }
            } else // multi-dimensional function
            {
                //write 1, x,y,z,x^2,y^2,z^2, xy, xz, yz, xyz

                String[] sbuff = new String[(int) Math.pow(2, plen) - 1 + plen + offset - 1];
                //String[] sbuff = new String[plen+offset];
                if (offset == 1)
                    sbuff[0] = "1";

                //init index stack
                int[] index = new int[plen];
                for (int i = 0; i < plen; i++)
                    index[i] = 0;

                //execute test 
                double[] buff = new double[plen];
                while (index[0] < dlen) {
                    //set buffer values
                    for (int i = 0; i < plen; i++)
                        buff[i] = dvariable.get(index[i]);

                    //core writing
                    for (int i = 1; i <= plen; i++) {
                        if (i == 1) {
                            for (int j = 0; j < plen; j++)
                                sbuff[offset + j] = String.valueOf(buff[j]);
                            for (int j = 0; j < plen; j++)
                                sbuff[offset + plen + j] = String.valueOf(Math.pow(buff[j], 2));
                        } else if (i == 2) {
                            int ix = 0;
                            for (int j = 0; j < plen - 1; j++)
                                for (int k = j + 1; k < plen; k++, ix++)
                                    sbuff[offset + 2 * plen + ix] = String.valueOf(buff[j] * buff[k]);
                        } else if (i == plen) {
                            //double tmp=1;
                            //for( int j=0; j<plen; j++ )
                            //   tmp *= buff[j];
                            //sbuff[offset+2*plen+plen*(plen-1)/2] = String.valueOf(tmp);
                        } else
                            throw new DMLUnsupportedOperationException(
                                    "More than 3 dims currently not supported.");

                    }

                    //for( int i=0; i<plen; i++ )   
                    //   sbuff[offset+i] = String.valueOf( buff[i] );

                    writer1.writeNext(sbuff);

                    //increment indexes
                    for (int i = plen - 1; i >= 0; i--) {
                        if (i == plen - 1)
                            index[i]++;
                        else if (index[i + 1] >= dlen) {
                            index[i]++;
                            index[i + 1] = 0;
                        }
                    }
                }
            }
            writer1.close();

            //write measure data set
            CSVWriter writer2 = new CSVWriter(new FileWriter(dirname + count + "_in2.csv"), ',',
                    CSVWriter.NO_QUOTE_CHARACTER);
            String[] buff2 = new String[1];
            for (Double val : dmeasure) {
                buff2[0] = String.valueOf(val);
                writer2.writeNext(buff2);
            }
            writer2.close();

            map.put(count, ID);
            count++;
        }
    }

    return map;
}