Example usage for java.util LinkedHashMap isEmpty

List of usage examples for java.util LinkedHashMap isEmpty

Introduction

In this page you can find the example usage for java.util LinkedHashMap isEmpty.

Prototype

boolean isEmpty();

Source Link

Document

Returns true if this map contains no key-value mappings.

Usage

From source file:com.vmware.admiral.request.compute.ComputeReservationTaskService.java

private void selectReservation(ComputeReservationTaskState state,
        LinkedHashMap<String, String> resourcePoolsPerGroupPlacementLinks) {
    if (resourcePoolsPerGroupPlacementLinks.isEmpty()) {
        failTask(null,/*from   w w w . jav a2  s . c o m*/
                new LocalizableValidationException("resourcePoolsPerGroupPlacementLinks must not be empty",
                        "request.compute.reservation.resource-pools.empty"));
        return;
    }

    Iterator<String> iter = resourcePoolsPerGroupPlacementLinks.keySet().iterator();
    String placementLink = iter.next();
    iter.remove();

    logInfo("Current selected placement: %s", placementLink);
    proceedTo(SubStage.RESERVATION_SELECTED, s -> {
        s.resourcePoolsPerGroupPlacementLinks = resourcePoolsPerGroupPlacementLinks;
        s.groupResourcePlacementLink = placementLink;
    });
}

From source file:net.sf.maltcms.chromaui.normalization.spi.charts.PeakGroupBoxPlot.java

protected String getPeakName(IPeakGroupDescriptor pgd) {
    String rt = "mean area: " + String.format("%.2f", pgd.getMeanArea(normalizer)) + "+/-"
            + String.format("%.2f", pgd.getAreaStdDev(normalizer)) + "; median area: "
            + String.format("%.2f", pgd.getMedianArea(normalizer)) + ": ";
    LinkedHashMap<String, Integer> names = new LinkedHashMap<>();
    if (!pgd.getDisplayName().equals(pgd.getName())) {
        return rt + pgd.getDisplayName();
    }/*w  w w .  j a v  a2s . c o m*/
    for (IPeakAnnotationDescriptor ipad : pgd.getPeakAnnotationDescriptors()) {
        if (names.containsKey(ipad.getName())) {
            names.put(ipad.getName(), names.get(ipad.getName()) + 1);
        } else {
            names.put(ipad.getName(), 1);
        }
    }
    if (names.isEmpty()) {
        return rt + "<NA>";
    }
    if (names.size() > 1) {
        StringBuilder sb = new StringBuilder();
        for (String key : names.keySet()) {
            sb.append(key);
            sb.append(" (" + names.get(key) + ")");
            sb.append(" | ");
        }
        return rt + sb.replace(sb.length() - 1, sb.length() - 1, "").toString();
    } else {
        return rt + names.keySet().toArray(new String[0])[0];
    }
}

From source file:be.ugent.maf.cellmissy.gui.controller.analysis.doseresponse.area.AreaDRInputController.java

/**
 * Table model for bottom table: starts from analysis group.
 *
 * @param analysisGroup/*from ww  w.  ja v a 2 s . co  m*/
 * @return
 */
private NonEditableTableModel createTableModel(AreaDoseResponseAnalysisGroup analysisGroup) {
    LinkedHashMap<Double, String> concentrationsMap = analysisGroup.getConcentrationsMap()
            .get(analysisGroup.getTreatmentToAnalyse());
    LinkedHashMap<PlateCondition, List<Double>> velocitiesMap = analysisGroup.getVelocitiesMap();
    //when removing all conditions
    if (velocitiesMap.isEmpty()) {
        return new NonEditableTableModel();
    }

    int maxReplicates = 0;
    for (List<Double> value : velocitiesMap.values()) {
        int replicates = value.size();
        if (replicates > maxReplicates) {
            maxReplicates = replicates;
        }
    }

    Object[][] data = new Object[velocitiesMap.size()][maxReplicates + 2];
    int i = 0;
    int controlIndex = 100;
    int rowIndex = 0;

    for (Map.Entry<PlateCondition, List<Double>> entry : velocitiesMap.entrySet()) {
        //check if this platecondition is the control, save index for table
        for (Treatment treatment : entry.getKey().getTreatmentList()) {
            if (treatment.getTreatmentType().getName().contains("ontrol")) {
                controlIndex = i;
            }
        }
        i++;

        int columnIndex = 2;
        for (Double velocity : entry.getValue()) {

            if (velocity != null && !velocity.isNaN()) {
                // round to three decimals slopes and coefficients
                Double slope = AnalysisUtils.roundThreeDecimals(velocity);
                // show in table slope + (coefficient)
                data[rowIndex][columnIndex] = slope;
            } else if (velocity == null) {
                data[rowIndex][columnIndex] = "excluded";
            } else if (velocity.isNaN()) {
                data[rowIndex][columnIndex] = "NaN";
            }

            columnIndex++;
        }
        rowIndex++;
    }

    if (controlIndex != 100) {
        data[controlIndex][0] = 0.0;
        data[controlIndex][1] = "--";
    }
    rowIndex = 0;
    //if user only selects control, the concentrationsmap is null
    if (concentrationsMap != null) {
        for (Map.Entry<Double, String> entry : concentrationsMap.entrySet()) {
            if (rowIndex >= controlIndex) {
                data[rowIndex + 1][0] = entry.getKey();
                data[rowIndex + 1][1] = entry.getValue();
            } else {
                data[rowIndex][0] = entry.getKey();
                data[rowIndex][1] = entry.getValue();
            }

            rowIndex++;
        }
    }
    // array of column names for table model
    String[] columnNames = new String[data[0].length];
    columnNames[0] = "Conc of " + analysisGroup.getTreatmentToAnalyse();
    columnNames[1] = "Unit";
    for (int x = 2; x < columnNames.length; x++) {
        columnNames[x] = "Repl " + (x - 1);
    }

    NonEditableTableModel nonEditableTableModel = new NonEditableTableModel();
    nonEditableTableModel.setDataVector(data, columnNames);
    return nonEditableTableModel;

}

From source file:com.google.gwt.emultest.java.util.LinkedHashMapTest.java

public void testLinkedHashMapMap() {
    LinkedHashMap<Integer, Integer> srcMap = new LinkedHashMap<Integer, Integer>();
    assertNotNull(srcMap);//  w  w  w.  j a  v  a  2 s .c  o m
    checkEmptyLinkedHashMapAssumptions(srcMap);

    srcMap.put(INTEGER_1, INTEGER_11);
    srcMap.put(INTEGER_2, INTEGER_22);
    srcMap.put(INTEGER_3, INTEGER_33);

    LinkedHashMap<Integer, Integer> hashMap = cloneLinkedHashMap(srcMap);
    assertFalse(hashMap.isEmpty());
    assertTrue(hashMap.size() == SIZE_THREE);

    Collection<Integer> valColl = hashMap.values();
    assertTrue(valColl.contains(INTEGER_11));
    assertTrue(valColl.contains(INTEGER_22));
    assertTrue(valColl.contains(INTEGER_33));

    Collection<Integer> keyColl = hashMap.keySet();
    assertTrue(keyColl.contains(INTEGER_1));
    assertTrue(keyColl.contains(INTEGER_2));
    assertTrue(keyColl.contains(INTEGER_3));
}

From source file:com.karus.danktitles.commands.HelpSubcommand.java

@Override
public void execute(CommandSender sender, String[] args) {

    // Methods inheritied from CommandChecker
    if (!checkLength(sender, args, 1, 3))
        return;/*from  ww  w  .  j a v a  2 s.  c o  m*/
    if (!checkSender(sender, "danktitles.help"))
        return;

    LinkedHashMap<String, MutablePair<String, String>> parsedCommands;

    // Checks if the list needs to be filtered
    if (args.length == 1 || args[1].equals("all")) {
        parsedCommands = new LinkedHashMap<>(
                commands.entrySet().stream().filter(entry -> sender.hasPermission(entry.getValue().getLeft()))
                        .collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue())));
    } else {
        parsedCommands = new LinkedHashMap<>(commands.entrySet().stream().filter(
                entry -> entry.getKey().contains(args[1]) && sender.hasPermission(entry.getValue().getLeft()))
                .collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue())));
    }

    if (parsedCommands.isEmpty()) {
        sender.sendMessage(ChatColor.RED + "No matches found.");
        return;
    }

    if (args.length == 3) {
        try {
            page = Integer.parseInt(args[2]);
        } catch (NumberFormatException e) {
            sender.sendMessage(ChatColor.RED + "Invalid page number!");
            return;
        }
    } else {
        page = 1;
    }

    int totalPages = (int) Math.max(1, Math.floor(parsedCommands.size() / SIZE));

    if (page <= 0 || page > totalPages) {
        sender.sendMessage(ChatColor.RED + "Invalid page number!");
        return;
    }

    sender.sendMessage(ChatColor.GOLD + "[Commands - (" + ChatColor.RED + page + "/" + totalPages
            + ChatColor.GOLD + ") ]");

    ArrayList<String> keys = new ArrayList<>(parsedCommands.keySet());

    IntStream.range(page * SIZE - SIZE, parsedCommands.size()).limit(SIZE)
            .forEach(i -> sender.sendMessage(ChatColor.GOLD + commands.get(keys.get(i)).getRight()));

}

From source file:gov.llnl.lc.smt.command.fabric.SmtFabric.java

/**
 * Describe the method here/*  w ww . j  a  va  2  s  .co  m*/
 *
 * @see gov.llnl.lc.smt.command.SmtCommand#doCommand(gov.llnl.lc.smt.command.config.SmtConfig)
 *
 * @param config
 * @return
 * @throws Exception
 ***********************************************************/

@Override
public boolean doCommand(SmtConfig config) throws Exception {
    // this is the fabric command
    // support obtaining the fabric on-line, or from an OMS or Fabric
    // file.  Only one at a time....

    // which is all done by default within the execute() command of the
    // parent superclass smt-command

    // only one way of obtaining fabric data should be specified, but IF more
    // than one is, prefer;
    //
    //  on-line (if host or port is specified)
    //  OMS file
    //  Fabric file
    //  on-line using localhost and port 10011

    Map<String, String> map = smtConfig.getConfigMap();
    OSM_Configuration cfg = null;

    String subCommand = map.get(SmtProperty.SMT_SUBCOMMAND.getName());
    if (subCommand == null)
        subCommand = SmtProperty.SMT_HELP.getName();

    // there should only be one subcommand
    if (subCommand.equalsIgnoreCase(SmtProperty.SMT_FABRIC_DISCOVER.getName())) {
        showDiscoveredFabrics(map);
        return true;
    } else if (subCommand.equalsIgnoreCase(SmtProperty.SMT_FABRIC_CONFIG_CMD.getName())) {
        cfg = getOsmConfig(true);
        if ((cfg != null) && (cfg.getFabricConfig() != null)
                && (cfg.getFabricConfig().getFabricName() != null)) {
            // save this configuration and then perform a check
            OSM_Configuration.cacheOSM_Configuration(OMService.getFabricName(), cfg);
            System.out.println(cfg.getFabricConfig().toContent());
        } else {
            logger.severe("Couldn't obtain Fabric configuration, check service connection.");
            System.err.println("Couldn't obtain Fabric configuration, check service connection.");
        }
        return true;
    } else if (subCommand.equalsIgnoreCase(SmtProperty.SMT_STATUS.getName())) {
        System.out.println(getStatus(OMService));
    } else if (subCommand.equalsIgnoreCase(SmtProperty.SMT_NODE_MAP_CMD.getName())) {
        cfg = getOsmConfig(true);
        if ((cfg != null) && (cfg.getFabricConfig() != null)
                && (cfg.getFabricConfig().getFabricName() != null)) {
            // save this configuration and then perform a check
            OSM_Configuration.cacheOSM_Configuration(OMService.getFabricName(), cfg);
            System.out.println(cfg.getNodeNameMap().toContent());
        }
        return true;
    } else if (subCommand.equalsIgnoreCase(SmtProperty.SMT_QUERY_TYPE.getName())) {
        FabricQuery qType = FabricQuery.getByName(map.get(SmtProperty.SMT_QUERY_TYPE.getName()));

        if (qType == null) {
            logger.severe("Invalid SmtFabric query option");
            System.err.println("Invalid SmtFabric query option");
            subCommand = SmtProperty.SMT_HELP.getName();
            return false;
        }

        SmtFabricStructure fs = null;
        if (OMService != null)
            fs = new SmtFabricStructure(OMService);
        else
            System.err.println("The OMService is null, baby");

        switch (qType) {
        case FAB_LIST:
            System.out.println(FabricQuery.describeAllQueryTypes());
            break;

        case FAB_STATUS:
            System.out.println(getStatus(OMService));
            break;

        case FAB_STRUCTURE:
            System.out.println(fs.toStringAlternate());
            break;

        case FAB_SWITCHES:
            System.out.println(fs.toSwitchString());
            break;

        case FAB_HOSTS:
            System.out.println(fs.toHostString());
            break;

        case FAB_SERVICE:
            System.out.println(fs.toServiceString());
            break;

        case FAB_CHECK:
            // check for dynamic link errors AND configuration errors
            System.out.println("Checking for Link errors...");
            LinkedHashMap<String, String> errMap = IB_LinkInfo.getErrorLinkInfoRecords(OMService,
                    getOSM_FabricDelta(false));
            if ((errMap != null) && !(errMap.isEmpty()))
                for (Map.Entry<String, String> mapEntry : errMap.entrySet())
                    System.out.println(mapEntry.getValue());
            else
                System.out.println("  no errors found");
            System.out.println();

            cfg = getOsmConfig(true);
            if ((cfg != null) && (cfg.getFabricConfig() != null)
                    && (cfg.getFabricConfig().getFabricName() != null)) {
                // save this configuration and then perform a check
                OSM_Configuration.cacheOSM_Configuration(OMService.getFabricName(), cfg);
                OMService.getFabric().checkFabricStructure(cfg.getFabricConfig(), true);
            }
            break;

        case FAB_CONFIG:
            cfg = getOsmConfig(true);
            if ((cfg != null) && (cfg.getFabricConfig() != null)
                    && (cfg.getFabricConfig().getFabricName() != null)) {
                // save this configuration and then perform a check
                OSM_Configuration.cacheOSM_Configuration(OMService.getFabricName(), cfg);

                System.out.println(cfg.toInfo());
            }
            break;

        case FAB_WHATSUP:
            showWhatsUp(map);
            break;

        case FAB_ERRORS:
            OSM_FabricDelta fd = getOSM_FabricDelta(false);
            if (fd == null) {
                System.err.println(
                        "FabricDelta is null.  Check service connection, or perhaps just wait for another snapshot");
                System.exit(0);
            }
            OSM_Fabric fabric = fd.getFabric2();
            OSM_FabricDeltaAnalyzer fda = new OSM_FabricDeltaAnalyzer(fd);

            LinkedHashMap<String, IB_Link> links = fabric.getIB_Links();

            System.out.println(getErrorNodeSummary(fda, links, false));
            break;

        case FAB_EVENTS:
            if (OMService != null)
                System.out.println(SmtEvent.getEventSummary(getOSM_FabricDelta(false), ""));
            else
                System.err.println("An OMS instance is required (connection or file)");
            break;

        case FAB_ROUTE:
            if (OMService != null) {
                RT_Table RoutingTable = RT_Table.buildRT_Table(OMService.getFabric());
                System.out.println(SmtRoute.getRouteTableSummary(OMService, RoutingTable));
            }
            break;

        default:
            // should never get here, because it will be trapped above
            System.err.println("Invalid SmtFabric query option, again");
            break;
        }
    } else if (OMService != null) {
        System.out.println(getStatus(OMService));
    }

    return true;
}

From source file:diffhunter.Indexer.java

public void Make_Index(Database hashdb, String file_name, String read_gene_location)
        throws FileNotFoundException, IOException {
    Set_Parameters();//from   w ww  . ja va  2  s .c om
    //System.out.print("Sasa");
    ConcurrentHashMap<String, Map<Integer, Integer>> dic_gene_loc_count = new ConcurrentHashMap<>();
    ArrayList<String> lines_from_bed_file = new ArrayList<>();
    BufferedReader br = new BufferedReader(new FileReader(file_name));

    String line = br.readLine();
    List<String> toks = Arrays.asList(line.split("\t"));
    lines_from_bed_file.add(line);
    String last_Seen_chromosome = toks.get(0).replace("chr", "");
    line = br.readLine();
    lines_from_bed_file.add(line);
    toks = Arrays.asList(line.split("\t"));
    String new_chromosome = toks.get(0).replace("chr", "");

    while (((line = br.readLine()) != null) || lines_from_bed_file.size() > 0) {
        if (line != null) {
            toks = Arrays.asList(line.split("\t"));
            new_chromosome = toks.get(0).replace("chr", "");
        }
        // process the line.
        if (line == null || !new_chromosome.equals(last_Seen_chromosome)) {
            System.out.println("Processing chromosome" + "\t" + last_Seen_chromosome);
            last_Seen_chromosome = new_chromosome;
            lines_from_bed_file.parallelStream().forEach(content -> {

                List<String> inner_toks = Arrays.asList(content.split("\t"));
                //WARNINNG WARNING WARNING WARNINNG WARNING WARNING WARNINNG WARNING WARNING WARNINNG WARNING WARNING WARNINNG WARNING WARNING WARNINNG WARNING WARNING WARNINNG WARNING WARNING WARNINNG WARNING WARNING 
                //STRAND column count should be changed. 
                String strand = inner_toks.get(5);
                String chromosome_ = inner_toks.get(0).replace("chr", "");
                if (!dic_Loc_gene.get(strand).containsKey(chromosome_)) {
                    return;
                }
                Integer start_loc = Integer.parseInt(inner_toks.get(1));
                Integer end_loc = Integer.parseInt(inner_toks.get(2));
                List<Interval<String>> res__ = dic_Loc_gene.get(strand).get(chromosome_).getIntervals(start_loc,
                        end_loc);
                //IntervalTree<String> pot_gene_name=new IntervalTree<>(res__);
                //                        for (int z = 0; z < pot_gene_name.Intervals.Count; z++)
                //{
                for (int z = 0; z < res__.size(); z++) {

                    dic_gene_loc_count.putIfAbsent(res__.get(z).getData(), new HashMap<>());
                    String gene_symbol = res__.get(z).getData();
                    Integer temp_gene_start_loc = dic_genes.get(gene_symbol).start_loc;
                    Integer temp_gene_end_loc = dic_genes.get(gene_symbol).end_loc;
                    if (start_loc < temp_gene_start_loc) {
                        start_loc = temp_gene_start_loc;
                    }
                    if (end_loc > temp_gene_end_loc) {
                        end_loc = temp_gene_end_loc;
                    }
                    synchronized (dic_synchrinzer_genes.get(gene_symbol)) {
                        for (int k = start_loc; k <= end_loc; k++) {
                            Integer value_inside = 0;
                            value_inside = dic_gene_loc_count.get(gene_symbol).get(k);
                            dic_gene_loc_count.get(gene_symbol).put(k,
                                    value_inside == null ? 1 : (value_inside + 1));
                        }
                    }
                }
            });
            /*                    List<string> keys_ = dic_gene_loc_count.Keys.ToList();
             List<string> alt_keys = new List<string>();// dic_gene_loc_count.Keys.ToList();
             for (int i = 0; i < keys_.Count; i++)
             {
             Dictionary<int, int> dicccc_ = new Dictionary<int, int>();
             dic_gene_loc_count[keys_[i]] = new Dictionary<int, int>(dic_gene_loc_count[keys_[i]].Where(x => x.Value >= 2).ToDictionary(x => x.Key, x => x.Value));
             if (dic_gene_loc_count[keys_[i]].Count == 0)
             {
                    
             dic_gene_loc_count.TryRemove(keys_[i], out dicccc_);
             continue;
             }
             hashdb.Put(Get_BDB(keys_[i]), Get_BDB_Dictionary(dic_gene_loc_count[keys_[i]]));
             alt_keys.Add(keys_[i]);
             dic_gene_loc_count.TryRemove(keys_[i], out dicccc_);
             }*/
            ArrayList<String> keys_ = new ArrayList<>(dic_gene_loc_count.keySet());
            ArrayList<String> alt_keys = new ArrayList<>();
            for (int i = 0; i < keys_.size(); i++) {

                //LinkedHashMap<Integer, Integer> tmep_map = new LinkedHashMap<>(dic_gene_loc_count.get(keys_.get(i)));
                LinkedHashMap<Integer, Integer> tmep_map = new LinkedHashMap<>();
                /*tmep_map = */
                dic_gene_loc_count.get(keys_.get(i)).entrySet().stream().filter(p -> p.getValue() >= 2)
                        .sorted(Comparator.comparing(E -> E.getKey()))
                        .forEach((entry) -> tmep_map.put(entry.getKey(), entry.getValue()));//.collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue()));
                if (tmep_map.isEmpty()) {
                    dic_gene_loc_count.remove(keys_.get(i));
                    continue;
                }

                //Map<Integer, Integer> tmep_map1 = new LinkedHashMap<>();
                //tmep_map1=sortByKey(tmep_map);
                //tmep_map.entrySet().stream().sorted(Comparator.comparing(E -> E.getKey())).forEach((entry) -> tmep_map1.put(entry.getKey(), entry.getValue()));
                //BerkeleyDB_Box box=new BerkeleyDB_Box();
                hashdb.put(null, BerkeleyDB_Box.Get_BDB(keys_.get(i)),
                        BerkeleyDB_Box.Get_BDB_Dictionary(tmep_map));
                alt_keys.add(keys_.get(i));
                dic_gene_loc_count.remove(keys_.get(i));
                //dic_gene_loc_count.put(keys_.get(i),tmep_map);
            }

            hashdb.sync();
            int a = 1111;
            /*                    hashdb.Sync();
             File.AppendAllLines("InputDB\\" + Path.GetFileNameWithoutExtension(file_name) + "_genes.txt", alt_keys);
             //total_lines_processed_till_now += lines_from_bed_file.Count;
             //worker.ReportProgress(total_lines_processed_till_now / count_);
             lines_from_bed_file.Clear();
             if (!reader.EndOfStream)
             {
             lines_from_bed_file.Add(_line_);
             }
             last_Seen_chromosome = new_choromosome;*/
            lines_from_bed_file.clear();
            if (line != null) {
                lines_from_bed_file.add(line);
            }
            Path p = Paths.get(file_name);
            file_name = p.getFileName().toString();

            BufferedWriter output = new BufferedWriter(new FileWriter((Paths
                    .get(read_gene_location, FilenameUtils.removeExtension(file_name) + ".txt").toString()),
                    true));
            for (String alt_key : alt_keys) {
                output.append(alt_key);
                output.newLine();
            }
            output.close();
            /*if (((line = br.readLine()) != null))
            {
            lines_from_bed_file.add(line);
            toks=Arrays.asList(line.split("\t"));
            new_chromosome=toks.get(0).replace("chr", "");
            }*/
            //last_Seen_chromosome=new_chromosome;
        } else if (new_chromosome.equals(last_Seen_chromosome)) {
            lines_from_bed_file.add(line);
        }

    }
    br.close();
    hashdb.sync();
    hashdb.close();

}

From source file:com.google.gwt.emultest.java.util.LinkedHashMapTest.java

public void testIsEmpty() {
    LinkedHashMap<String, String> srcMap = new LinkedHashMap<String, String>();
    checkEmptyLinkedHashMapAssumptions(srcMap);

    LinkedHashMap<String, String> dstMap = new LinkedHashMap<String, String>();
    checkEmptyLinkedHashMapAssumptions(dstMap);

    dstMap.putAll(srcMap);/*w ww .ja  v a  2s . c  o  m*/
    assertTrue(dstMap.isEmpty());

    dstMap.put(KEY_KEY, VALUE_VAL);
    assertFalse(dstMap.isEmpty());

    dstMap.remove(KEY_KEY);
    assertTrue(dstMap.isEmpty());
    assertEquals(dstMap.size(), 0);
}

From source file:com.google.gwt.emultest.java.util.LinkedHashMapTest.java

public void testClear() {
    LinkedHashMap<String, String> hashMap = new LinkedHashMap<String, String>();
    checkEmptyLinkedHashMapAssumptions(hashMap);

    hashMap.put("Hello", "Bye");
    assertFalse(hashMap.isEmpty());
    assertTrue(hashMap.size() == SIZE_ONE);

    hashMap.clear();/*from  ww  w  .jav a 2s  . c  o  m*/
    assertTrue(hashMap.isEmpty());
    assertTrue(hashMap.size() == 0);
}

From source file:com.espertech.esper.filter.FilterSpecCompiler.java

private static FilterSpecParamRangeValue handleRangeNodeEndpoint(ExprNode endpoint,
        LinkedHashMap<String, Pair<EventType, String>> arrayEventTypes,
        ExprEvaluatorContext exprEvaluatorContext, String statementName) {
    // constant//from   w  ww  . j  a  va  2 s  .c om
    if (ExprNodeUtility.isConstantValueExpr(endpoint)) {
        ExprConstantNode node = (ExprConstantNode) endpoint;
        Object value = node.evaluate(null, true, exprEvaluatorContext);
        if (value instanceof String) {
            return new RangeValueString((String) value);
        } else {
            return new RangeValueDouble(((Number) value).doubleValue());
        }
    }

    if (endpoint instanceof ExprContextPropertyNode) {
        ExprContextPropertyNode node = (ExprContextPropertyNode) endpoint;
        return new RangeValueContextProp(node.getGetter());
    }

    // or property
    if (endpoint instanceof ExprIdentNode) {
        ExprIdentNode identNodeInner = (ExprIdentNode) endpoint;
        if (identNodeInner.getStreamId() == 0) {
            return null;
        }

        if (arrayEventTypes != null && !arrayEventTypes.isEmpty()
                && arrayEventTypes.containsKey(identNodeInner.getResolvedStreamName())) {
            Pair<Integer, String> indexAndProp = getStreamIndex(identNodeInner.getResolvedPropertyName());
            return new RangeValueEventPropIndexed(identNodeInner.getResolvedStreamName(),
                    indexAndProp.getFirst(), indexAndProp.getSecond(), statementName);
        } else {
            return new RangeValueEventProp(identNodeInner.getResolvedStreamName(),
                    identNodeInner.getResolvedPropertyName());
        }
    }

    return null;
}