Example usage for java.util.regex Pattern quote

List of usage examples for java.util.regex Pattern quote

Introduction

In this page you can find the example usage for java.util.regex Pattern quote.

Prototype

public static String quote(String s) 

Source Link

Document

Returns a literal pattern String for the specified String .

Usage

From source file:com.asakusafw.runtime.stage.directio.AbstractNoReduceDirectOutputMapper.java

@Override
protected void runInternal(Context context) throws IOException, InterruptedException {
    if (context.nextKeyValue() == false) {
        if (log.isDebugEnabled()) {
            log.debug(MessageFormat.format("There are not input for directly output Mapper {0}@{1}", //$NON-NLS-1$
                    getClass().getName(), context.getTaskAttemptID()));
        }/*from  w  w w  .ja va2s.co m*/
    } else {
        if (log.isDebugEnabled()) {
            log.debug(MessageFormat.format("Start setup directly output Mapper {0}@{1}", //$NON-NLS-1$
                    getClass().getName(), context.getTaskAttemptID()));
        }
        DirectDataSourceRepository repository = HadoopDataSourceUtil.loadRepository(context.getConfiguration());
        String arguments = context.getConfiguration().get(StageConstants.PROP_ASAKUSA_BATCH_ARGS, ""); //$NON-NLS-1$
        VariableTable variables = new VariableTable(VariableTable.RedefineStrategy.IGNORE);
        variables.defineVariables(arguments);

        String path = variables.parse(rawBasePath, false);
        String sourceId = repository.getRelatedId(path);
        OutputAttemptContext outputContext = BridgeOutputFormat.createContext(context, sourceId);
        DataFormat<? super T> format = ReflectionUtils.newInstance(dataFormatClass, context.getConfiguration());
        DirectDataSource datasource = repository.getRelatedDataSource(path);
        String basePath = repository.getComponentPath(path);
        String unresolvedResourcePath = rawResourcePath.replaceAll(Pattern.quote("*"), //$NON-NLS-1$
                String.format("%04d", context.getTaskAttemptID().getTaskID().getId())); //$NON-NLS-1$
        String resourcePath = variables.parse(unresolvedResourcePath);
        DataDefinition<? super T> definition = SimpleDataDefinition.newInstance(dataType, format);

        if (log.isDebugEnabled()) {
            log.debug(MessageFormat.format("Open mapper output (id={0}, basePath={1}, resourcePath={2})", //$NON-NLS-1$
                    sourceId, basePath, resourcePath));
        }

        Counter counter = new Counter();
        int records = 0;
        try (ModelOutput<? super T> output = datasource.openOutput(outputContext, definition, basePath,
                resourcePath, counter)) {
            do {
                output.write(context.getCurrentValue());
                records++;
            } while (context.nextKeyValue());
        } finally {
            if (log.isDebugEnabled()) {
                log.debug(MessageFormat.format("Start cleanup directly output Mapper {0}@{1}", //$NON-NLS-1$
                        getClass().getName(), context.getTaskAttemptID()));
            }
        }
        org.apache.hadoop.mapreduce.Counter recordCounter = context.getCounter(TaskCounter.MAP_OUTPUT_RECORDS);
        recordCounter.increment(records);
        Constants.putCounts(context, sourceId, outputId, 1, records, counter.get());
    }
}

From source file:jeplus.util.RelativeDirUtil.java

/**
 * Get the relative path from one file to another, specifying the directory separator. If one of the provided resources does not exist,
 * it is assumed to be a file unless it ends with '/' or '\'.
 *
 * @param targetPath targetPath is calculated to this file
 * @param basePath basePath is calculated from this file
 * @param pathSeparator directory separator. The platform default is not assumed so that we can test Unix behaviour when running on
 * Windows (for example)/*from  www.  j av  a2 s  .c o  m*/
 * @return
 */
public static String getRelativePath(String targetPath, String basePath, String pathSeparator) {

    // Normalize the paths
    String normalizedTargetPath = FilenameUtils.normalizeNoEndSeparator(targetPath);
    String normalizedBasePath = FilenameUtils.normalizeNoEndSeparator(basePath);
    // Undo the changes to the separators made by normalization
    switch (pathSeparator) {
    case "/":
        normalizedTargetPath = FilenameUtils.separatorsToUnix(normalizedTargetPath);
        normalizedBasePath = FilenameUtils.separatorsToUnix(normalizedBasePath);
        break;
    case "\\":
        normalizedTargetPath = FilenameUtils.separatorsToWindows(normalizedTargetPath);
        normalizedBasePath = FilenameUtils.separatorsToWindows(normalizedBasePath);
        break;
    default:
        throw new IllegalArgumentException("Unrecognised dir separator '" + pathSeparator + "'");
    }

    String[] base = normalizedBasePath.split(Pattern.quote(pathSeparator));
    String[] target = normalizedTargetPath.split(Pattern.quote(pathSeparator));

    // First get all the common elements. Store them as a string,
    // and also count how many of them there are.
    StringBuilder common = new StringBuilder();

    int commonIndex = 0;
    while (commonIndex < target.length && commonIndex < base.length
            && target[commonIndex].equals(base[commonIndex])) {
        common.append(target[commonIndex]).append(pathSeparator);
        commonIndex++;
    }

    if (commonIndex == 0) {
        // No single common path element. This most
        // likely indicates differing drive letters, like C: and D:.
        // These paths cannot be relativized.
        throw new PathResolutionException("No common path element found for '" + normalizedTargetPath
                + "' and '" + normalizedBasePath + "'");
    }

    // The number of directories we have to backtrack depends on whether the base is a file or a dir
    // For example, the relative path from
    //
    // /foo/bar/baz/gg/ff to /foo/bar/baz
    // 
    // ".." if ff is a file
    // "../.." if ff is a directory
    //
    // The following is a heuristic to figure out if the base refers to a file or dir. It's not perfect, because
    // the resource referred to by this path may not actually exist, but it's the best I can do
    boolean baseIsFile = true;

    File baseResource = new File(normalizedBasePath);

    if (baseResource.exists()) {
        baseIsFile = baseResource.isFile();

    } else if (basePath.endsWith(pathSeparator)) {
        baseIsFile = false;
    }

    StringBuilder relative = new StringBuilder();

    if (base.length != commonIndex) {
        int numDirsUp = baseIsFile ? base.length - commonIndex - 1 : base.length - commonIndex;

        for (int i = 0; i < numDirsUp; i++) {
            relative.append("..").append(pathSeparator);
        }
    }
    // deal with current folder (targetPath and basePath are the same)
    if (normalizedTargetPath.length() <= common.length()) {
        relative.append(".");
    } else {
        relative.append(normalizedTargetPath.substring(common.length()));
    }
    return relative.append(pathSeparator).toString();
}

From source file:io.wcm.testing.mock.jcr.MockSession.java

RangeIterator listChildren(final String parentPath, final ItemFilter filter) throws RepositoryException {
    List<Item> children = new ArrayList<Item>();

    // build regex pattern for all child paths of parent
    Pattern pattern = Pattern.compile("^" + Pattern.quote(parentPath) + "/[^/]+$");

    // collect child resources
    for (Item item : this.items.values()) {
        if (pattern.matcher(item.getPath()).matches()) {
            if (filter == null || filter.accept(item)) {
                children.add(item);/*w ww.  ja v  a 2 s  .co  m*/
            }
        }
    }

    return new RangeIteratorAdapter(children.iterator(), children.size());
}

From source file:unalcol.termites.boxplots.InformationCollected2.java

/**
 * Creates a sample dataset./*w  w  w .j  av  a 2s . c  o  m*/
 *
 * @return A sample dataset.
 */
private BoxAndWhiskerCategoryDataset createSampleDataset(ArrayList<Double> Pf) {

    final int seriesCount = 5;
    final int categoryCount = 4;
    final int entityCount = 22;
    String sDirectorio = ".\\experiments\\2015-10-14-Maze\\results";
    File f = new File(sDirectorio);
    String extension;
    File[] files = f.listFiles();
    Hashtable<String, String> Pop = new Hashtable<>();
    PrintWriter escribir;
    Scanner sc = null;
    ArrayList<Integer> aPops = new ArrayList<>();
    ArrayList<Double> aPf = new ArrayList<>();
    ArrayList<String> aTech = new ArrayList<>();

    final DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset();

    for (File file : files) {
        extension = "";
        int i = file.getName().lastIndexOf('.');
        int p = Math.max(file.getName().lastIndexOf('/'), file.getName().lastIndexOf('\\'));
        if (i > p) {
            extension = file.getName().substring(i + 1);
        }

        // System.out.println(file.getName() + "extension" + extension);
        if (file.isFile() && extension.equals("csv") && file.getName().startsWith("experiment")) {
            System.out.println(file.getName());
            System.out.println("get: " + file.getName());
            String[] filenamep = file.getName().split(Pattern.quote("+"));

            System.out.println("file" + filenamep[8]);

            int popsize = Integer.valueOf(filenamep[2]);
            double pf = Double.valueOf(filenamep[4]);
            String mode = filenamep[6];

            int maxIter = -1;
            //if (!filenamep[8].isEmpty()) {
            maxIter = Integer.valueOf(filenamep[8]);
            //}

            System.out.println("psize:" + popsize);
            System.out.println("pf:" + pf);
            System.out.println("mode:" + mode);
            System.out.println("maxIter:" + maxIter);

            //String[] aMode = {"sandclw", "lwsandc2", "lwsandc", "lwphevap2", "lwphevap"};
            String[] aMode = { "levywalk", "lwphevap", "hybrid" };

            //                String[] aMode = {"turnoncontact", "lwsandc2", "lwsandc", "lwphevap2", "lwphevap"};
            if (/*Pf == pf && */isInMode(aMode, mode)) {
                final List list = new ArrayList();
                try {
                    sc = new Scanner(file);

                } catch (FileNotFoundException ex) {
                    Logger.getLogger(DataCollectedLatexConsolidatorSASOMessagesSend1.class.getName())
                            .log(Level.SEVERE, null, ex);
                }
                int agentsCorrect = 0;
                int worldSize = 0;
                double averageExplored = 0.0;
                int bestRoundNumber = 0;
                double avgSend = 0;
                double avgRecv = 0;
                double avgdataExplInd = 0;
                ArrayList<Double> acSt = new ArrayList<>();
                ArrayList<Double> avgExp = new ArrayList<>();
                ArrayList<Double> bestR = new ArrayList<>();
                ArrayList<Double> avSnd = new ArrayList<>();
                ArrayList<Double> avRecv = new ArrayList<>();
                ArrayList<Double> avIndExpl = new ArrayList<>();

                String[] data = null;
                while (sc.hasNext()) {
                    String line = sc.nextLine();
                    //System.out.println("line:" + line);
                    data = line.split(",");
                    agentsCorrect = Integer.valueOf(data[0]);
                    //agentsIncorrect = Integer.valueOf(data[1]); // not used
                    worldSize = Integer.valueOf(data[3]);
                    averageExplored = Double.valueOf(data[4]);
                    // data[3] stdavgExplored - not used
                    bestRoundNumber = Integer.valueOf(data[6]);
                    avgSend = Double.valueOf(data[7]);
                    avgRecv = Double.valueOf(data[8]);
                    avgdataExplInd = Double.valueOf(data[11]);

                    //Add Data and generate statistics 
                    acSt.add((double) agentsCorrect);
                    avgExp.add(averageExplored);

                    avSnd.add(avgSend);
                    avRecv.add(avgRecv);
                    avIndExpl.add(avgdataExplInd);

                    list.add(new Double(averageExplored / (double) worldSize * 100));
                }
                LOGGER.debug("Adding series " + i);
                LOGGER.debug(list.toString());
                if (Pf.contains(pf)) {
                    /*pf == 1.0E-4 || pf == 3.0E-4*/
                    if (Pf.size() == 1) {
                        dataset.add(list, popsize, getTechniqueName(mode));
                    } else {
                        dataset.add(list, String.valueOf(popsize) + "-" + pf, getTechniqueName(mode));
                    }
                }
            }
        }

    }

    /*for (int i = 0; i < seriesCount; i++) {
     for (int j = 0; j < categoryCount; j++) {
     final List list = new ArrayList();
     // add some values...
     for (int k = 0; k < entityCount; k++) {
     final double value1 = 10.0 + Math.random() * 3;
     list.add(new Double(value1));
     final double value2 = 11.25 + Math.random(); // concentrate values in the middle
     list.add(new Double(value2));
     }
     LOGGER.debug("Adding series " + i);
     LOGGER.debug(list.toString());
     dataset.add(list, "Series " + i, " Type " + j);
     }
            
     }*/
    return dataset;
}

From source file:com.epam.ta.reportportal.database.dao.UserRepositoryCustomImpl.java

@Override
public Page<User> searchForUser(String term, Pageable pageable) {
    final String regex = "(?i).*" + Pattern.quote(term.toLowerCase()) + ".*";
    Criteria email = where(User.EMAIL).regex(regex);
    Criteria login = where(LOGIN).regex(regex);
    Criteria fullName = where(FULLNAME_DB_FIELD).regex(regex);
    Criteria criteria = new Criteria().orOperator(email, login, fullName);
    Query query = query(criteria).with(pageable);
    List<User> users = mongoOperations.find(query, User.class);
    return new PageImpl<>(users, pageable, mongoOperations.count(query, User.class));
}

From source file:com.genentech.chemistry.openEye.apps.SDFEStateCalculator.java

private void run(String inFile) {
    oemolithread ifs = new oemolithread(inFile);
    long start = System.currentTimeMillis();
    int iCounter = 0; //Structures in the SD file.

    OEMolBase mol = new OEGraphMol();
    while (oechem.OEReadMolecule(ifs, mol)) {
        iCounter++;/*  ww w. jav a  2  s  .c  o m*/
        esCalculator.compute(mol, outputESSum, printDetails);

        if (outputESIndex)
            oechem.OESetSDData(mol, TAG_ESTATE_PREFIX + "_INDICE", esCalculator.getEStateIndexSummary());
        if (smarts != null) {
            NameValuePair<String, String>[] nvPairs = esCalculator.getEStateOf(mol, smarts);
            addOutputs(mol, TAG_ESTATE_PREFIX, nvPairs);
        }
        if (outputESCount)
            addOutputs(mol, TAG_ES_COUNT, esCalculator.getEStateCounts());
        if (outputESSum)
            addOutputs(mol, TAG_ES_SUM, esCalculator.getEStateSums());
        if (outputESSymbol)
            addOutputs(mol, TAG_ES_SYMBOL, esCalculator.getEStateAtomGroupSymbols());
        if (outputUnassignedCount)
            oechem.OESetSDData(mol, TAG_UNASSIGNED_COUNT, String.valueOf(esCalculator.getUnknownCount()));
        if (outputUnassignedAtoms)
            oechem.OESetSDData(mol, TAG_UNASSIGNED_ATOMS, esCalculator.getUnknownAtoms());
        oechem.OEWriteMolecule(outputOEThread, mol);
    }

    //Output "." to show that the program is running.
    if (iCounter % 100 == 0)
        System.err.print(".");
    if (iCounter % 4000 == 0) {
        System.err.printf(" %d %dsec\n", iCounter, (System.currentTimeMillis() - start) / 1000);
    }
    mol.delete();
    ifs.close();
    ifs.delete();
    inFile = inFile.replaceAll(".*" + Pattern.quote(File.separator), "");
    System.err.printf("%s: Read %d structures from %s. %d sec\n", MY_NAME, iCounter, inFile,
            (System.currentTimeMillis() - start) / 1000);
}

From source file:com.cj.restspecs.mojo.ConcatenateMojoTest.java

private String relativePath(File parent, File child) {
    String path = child.getAbsolutePath().replaceFirst(Pattern.quote(parent.getAbsolutePath()), "");
    if (path.startsWith("/")) {
        return path.substring(1);
    } else {//from www. jav  a 2s  .  com
        return path;
    }
}

From source file:unalcol.termites.boxplots.HybridInformationCollected.java

/**
 * Creates a sample dataset.//  www.j  a v  a2 s  .co  m
 *
 * @return A sample dataset.
 */
private BoxAndWhiskerCategoryDataset createSampleDataset(ArrayList<Double> Pf) {

    final int seriesCount = 5;
    final int categoryCount = 4;
    final int entityCount = 22;
    String sDirectorio = experimentsDir;
    File f = new File(sDirectorio);
    String extension;
    File[] files = f.listFiles();
    Hashtable<String, String> Pop = new Hashtable<>();
    PrintWriter escribir;
    Scanner sc = null;
    ArrayList<Integer> aPops = new ArrayList<>();
    ArrayList<Double> aPf = new ArrayList<>();
    ArrayList<String> aTech = new ArrayList<>();

    final DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset();

    for (File file : files) {
        extension = "";
        int i = file.getName().lastIndexOf('.');
        int p = Math.max(file.getName().lastIndexOf('/'), file.getName().lastIndexOf('\\'));
        if (i > p) {
            extension = file.getName().substring(i + 1);
        }

        // System.out.println(file.getName() + "extension" + extension);
        if (file.isFile() && extension.equals("csv") && file.getName().startsWith("experiment")
                && file.getName().contains(mazeMode)) {
            System.out.println(file.getName());
            System.out.println("get: " + file.getName());
            String[] filenamep = file.getName().split(Pattern.quote("+"));

            System.out.println("file" + filenamep[8]);

            int popsize = Integer.valueOf(filenamep[2]);
            double pf = Double.valueOf(filenamep[4]);
            String mode = filenamep[6];

            int maxIter = -1;
            //if (!filenamep[8].isEmpty()) {
            int n = 0;
            int rho = 0;
            double evapRate = 0.0;
            //14, 16, 16
            if (mode.equals("hybrid")) {
                n = Integer.valueOf(filenamep[14]);
                rho = Integer.valueOf(filenamep[16]);
                String[] tmp = filenamep[18].split(Pattern.quote("."));

                System.out.println("history size:" + n);
                System.out.println("rho:" + rho);
                String sEvap = tmp[0] + "." + tmp[1];
                evapRate = Double.valueOf(sEvap);
            }

            System.out.println("psize:" + popsize);
            System.out.println("pf:" + pf);
            System.out.println("mode:" + mode);
            System.out.println("maxIter:" + maxIter);
            System.out.println("evap:" + evapRate);
            //String[] aMode = {"hybrid", "lwphevap"};

            if (/*Pf == pf && */isInMode(aMode, mode)) {
                final List list = new ArrayList();
                try {
                    sc = new Scanner(file);

                } catch (FileNotFoundException ex) {
                    Logger.getLogger(DataCollectedLatexConsolidatorSASOMessagesSend1.class.getName())
                            .log(Level.SEVERE, null, ex);
                }
                int agentsCorrect = 0;
                int worldSize = 0;
                double averageExplored = 0.0;
                int bestRoundNumber = 0;
                double avgSend = 0;
                double avgRecv = 0;
                double avgdataExplInd = 0;
                ArrayList<Double> acSt = new ArrayList<>();
                ArrayList<Double> avgExp = new ArrayList<>();
                ArrayList<Double> bestR = new ArrayList<>();
                ArrayList<Double> avSnd = new ArrayList<>();
                ArrayList<Double> avRecv = new ArrayList<>();
                ArrayList<Double> avIndExpl = new ArrayList<>();

                String[] data = null;
                while (sc.hasNext()) {
                    String line = sc.nextLine();
                    //System.out.println("line:" + line);
                    data = line.split(",");
                    agentsCorrect = Integer.valueOf(data[0]);
                    //agentsIncorrect = Integer.valueOf(data[1]); // not used
                    worldSize = Integer.valueOf(data[3]);
                    averageExplored = Double.valueOf(data[4]);
                    // data[3] stdavgExplored - not used
                    bestRoundNumber = Integer.valueOf(data[6]);
                    avgSend = Double.valueOf(data[7]);
                    avgRecv = Double.valueOf(data[8]);
                    avgdataExplInd = Double.valueOf(data[11]);

                    //Add Data and generate statistics 
                    acSt.add((double) agentsCorrect);
                    avgExp.add(averageExplored);

                    avSnd.add(avgSend);
                    avRecv.add(avgRecv);
                    avIndExpl.add(avgdataExplInd);

                    list.add(new Double(averageExplored / (double) worldSize * 100));
                }
                LOGGER.debug("Adding series " + i);
                LOGGER.debug(list.toString());
                if (Pf.contains(pf)) {
                    /*pf == 1.0E-4 || pf == 3.0E-4*/
                    if (Pf.size() == 1) {
                        if (mode.equals("hybrid")) {
                            dataset.add(list, popsize,
                                    /*getTechniqueName(mode) + */ rho + "-" + evapRate + "-" + n);
                        } else {
                            dataset.add(list, popsize, getTechniqueName(mode));
                        }
                    } else {
                        if (mode.equals("hybrid")) {
                            dataset.add(list, String.valueOf(popsize) + "-" + pf,
                                    /*getTechniqueName(mode) +*/ rho + "-" + evapRate + "-" + n);
                        } else {
                            dataset.add(list, String.valueOf(popsize) + "-" + pf, getTechniqueName(mode));
                        }
                    }
                }
            }
        }

    }

    /*for (int i = 0; i < seriesCount; i++) {
     for (int j = 0; j < categoryCount; j++) {
     final List list = new ArrayList();
     // add some values...
     for (int k = 0; k < entityCount; k++) {
     final double value1 = 10.0 + Math.random() * 3;
     list.add(new Double(value1));
     final double value2 = 11.25 + Math.random(); // concentrate values in the middle
     list.add(new Double(value2));
     }
     LOGGER.debug("Adding series " + i);
     LOGGER.debug(list.toString());
     dataset.add(list, "Series " + i, " Type " + j);
     }
            
     }*/
    return dataset;
}

From source file:unalcol.termites.boxplots.BestAgentsPercentageInfoCollected.java

/**
 * Creates a sample dataset.//from w  w w.j a v  a  2s.  c o  m
 *
 * @return A sample dataset.
 */
private void createSampleDataset(ArrayList<Double> Pf, Hashtable<String, List> info) {
    String sDirectorio = experimentsDir;
    File f = new File(sDirectorio);
    String extension;
    File[] files = f.listFiles();
    Scanner sc = null;

    for (File file : files) {
        extension = "";
        int i = file.getName().lastIndexOf('.');
        int p = Math.max(file.getName().lastIndexOf('/'), file.getName().lastIndexOf('\\'));
        if (i > p) {
            extension = file.getName().substring(i + 1);
        }

        // System.out.println(file.getName() + "extension" + extension);
        if (file.isFile() && extension.equals("csv") && file.getName().startsWith("experiment")
                && file.getName().contains(mazeMode)) {
            System.out.println(file.getName());
            System.out.println("get: " + file.getName());
            String[] filenamep = file.getName().split(Pattern.quote("+"));

            System.out.println("file" + filenamep[8]);

            int popsize = Integer.valueOf(filenamep[2]);
            double pf = Double.valueOf(filenamep[4]);
            String mode = filenamep[6];

            int maxIter = -1;
            //if (!filenamep[8].isEmpty()) {
            maxIter = Integer.valueOf(filenamep[8]);
            //}

            /*System.out.println("psize:" + popsize);
             System.out.println("pf:" + pf);
             System.out.println("mode:" + mode);
             System.out.println("maxIter:" + maxIter);
             */
            //String[] aMode = {"sandclw", "lwsandc2", "lwsandc", "lwphevap2", "lwphevap"};
            //String[] aMode = {"levywalk", "lwphevap", "hybrid", "hybrid3", "hybrid4", "sequential"};
            //                String[] aMode = {"turnoncontact", "lwsandc2", "lwsandc", "lwphevap2", "lwphevap"};
            if (/*Pf == pf && */isInMode(aMode, mode)) {
                final List list = new ArrayList();
                try {
                    sc = new Scanner(file);

                } catch (FileNotFoundException ex) {
                    Logger.getLogger(DataCollectedLatexConsolidatorSASOMessagesSend1.class.getName())
                            .log(Level.SEVERE, null, ex);
                }
                int agentsCorrect = 0;
                int worldSize = 0;
                double averageExplored = 0.0;
                int bestRoundNumber = 0;
                double avgSend = 0;
                double avgRecv = 0;
                double avgdataExplInd = 0;
                ArrayList<Double> acSt = new ArrayList<>();
                ArrayList<Double> avgExp = new ArrayList<>();
                ArrayList<Double> bestR = new ArrayList<>();
                ArrayList<Double> avSnd = new ArrayList<>();
                ArrayList<Double> avRecv = new ArrayList<>();
                ArrayList<Double> avIndExpl = new ArrayList<>();

                String[] data = null;
                while (sc.hasNext()) {
                    String line = sc.nextLine();
                    //System.out.println("line:" + line);
                    data = line.split(",");
                    agentsCorrect = Integer.valueOf(data[0]);
                    //agentsIncorrect = Integer.valueOf(data[1]); // not used
                    worldSize = Integer.valueOf(data[3]);
                    averageExplored = Double.valueOf(data[4]);
                    // data[3] stdavgExplored - not used
                    bestRoundNumber = Integer.valueOf(data[6]);
                    avgSend = Double.valueOf(data[7]);
                    avgRecv = Double.valueOf(data[8]);
                    avgdataExplInd = Double.valueOf(data[11]);

                    //Add Data and generate statistics 
                    acSt.add((double) agentsCorrect);
                    avgExp.add(averageExplored);

                    avSnd.add(avgSend);
                    avRecv.add(avgRecv);
                    avIndExpl.add(avgdataExplInd);

                    if (agentsCorrect > 0 && Pf.contains(pf)) {
                        //list.add(100.0);
                        if (info.get(mode + "+" + popsize) == null) {
                            info.put((mode + "+" + popsize), new ArrayList<Integer>());
                        }
                        info.get(mode + "+" + popsize).add(100.0);
                        //System.out.println(mode + "-entra!");
                        //list.add(new Double(averageExplored / (double) worldSize * 100));
                    }

                }

                LOGGER.debug("Adding series " + i);
                LOGGER.debug(list.toString());
                //if (Pf.contains(pf)) {
                /*pf == 1.0E-4 || pf == 3.0E-4*/
                /*if (Pf.size() == 1) {
                 dataset.add(list, popsize, getTechniqueName(mode));
                 } else {
                 dataset.add(list, String.valueOf(popsize) + "-" + pf, getTechniqueName(mode));
                 }*/

                //}
            }
        }

    }
}

From source file:com.epam.dlab.auth.dao.LdapUserDAO.java

private Map<String, Object> searchUsersAttributes(final String username, LdapConnection userCon)
        throws IOException, LdapException {
    Map<String, Object> contextMap;
    Map<String, Object> userAttributes = new HashMap<>();
    for (Request request : requests) {
        if (request.getName().equalsIgnoreCase(USER_LOOK_UP)) {
            log.info("Request: {}", request.getName());
            log.info("Putting user param {} : {}", ldapSearchAttribute, username);
            SearchRequest sr = request/*  w w w.  j av  a2 s . co m*/
                    .buildSearchRequest(Collections.singletonMap(Pattern.quote(ldapSearchAttribute), username));
            String filter = sr.getFilter().toString();
            contextMap = (useCache) ? LdapFilterCache.getInstance().getLdapFilterInfo(filter) : null;
            SearchResultToDictionaryMapper mapper = new SearchResultToDictionaryMapper(request.getName(),
                    new HashMap<>());
            log.debug("Retrieving new branch {} for {}", request.getName(), filter);
            try (SearchCursor cursor = userCon.search(sr)) {
                contextMap = mapper.transformSearchResult(cursor);
                Iterator<Object> iterator = contextMap.values().iterator();
                if (iterator.hasNext()) {
                    @SuppressWarnings("unchecked")
                    Map<String, Object> ua = (Map<String, Object>) iterator.next();
                    log.info("User atttr {} ", ua);
                    userAttributes = ua;
                }
            }
        }
    }
    log.info("User context is: {}", userAttributes);
    return userAttributes;
}