Ejemplo n.º 1
1
  public static String fromJExpr2KExprString(
      String jexprStr, ArrayList<SingleVariableDeclaration> params) {
    HashMap<String, String> jvar2KvarMapping = extractJVar2KVarMapping(params);
    HashMap<String, String> typeEnv = new HashMap<>();

    params.forEach(
        var -> {
          typeEnv.put(
              jvar2KvarMapping.get(var.getName().getIdentifier()), var.getType().toString());
        });

    final String[] output = new String[] {jexprStr};
    jvar2KvarMapping.forEach(
        (oldName, newName) -> {
          output[0] = output[0].replaceAll("(?<=\\W)" + oldName + "(?=\\W)", newName);
        });

    Pattern freshVarPattern = Pattern.compile("(?<=\\?)(\\w+)");
    Matcher matcher = freshVarPattern.matcher(output[0]);
    while (matcher.find()) {
      String varName = matcher.group(1);
      output[0] = output[0].replaceAll(varName, varName.toUpperCase());
    }

    return fromJExpr2KExprString(output[0], typeEnv);
  }
Ejemplo n.º 2
1
 public int getLongestDistance(String startingCityName) {
   City startingCity = cities.get(startingCityName);
   longestDistance = 0;
   recLongest(startingCity);
   cities.forEach((s, city) -> city.visited = false);
   return longestDistance;
 }
Ejemplo n.º 3
1
 public int getShortestDistance(String startingCityName) {
   City startingCity = cities.get(startingCityName);
   shortestDistance = 0;
   rec(startingCity);
   cities.forEach((s, city) -> city.visited = false);
   return shortestDistance;
 }
Ejemplo n.º 4
1
  public void testTrue() {
    String value = "[owner]\n" + "name=asfdasasdfsa\n" + "organization=asfdasdf\n";

    try {
      Parse.parse(value);

      HashMap<String, HashMap<String, String>> file = Parse.getFile(); // .get("owner");
      if (file == null) {
        logger.log(Level.SEVERE, "file undefined error");
      } else {
        HashMap<String, String> section = file.get("[owner]");
        if (section == null) {
          logger.log(Level.INFO, " section undefined");
        } else {
          section.forEach((k, v) -> logger.log(Level.INFO, k + " " + v));
        }
      }
    } catch (Exception e) {
      logger.log(Level.SEVERE, e.getMessage(), e.getCause());
    }
  }
 public void forEach(BiConsumer<? super UUID, ? super ClientInfo> action) {
   uniqueIDToInfoMap.forEach(action);
 }