示例#1
1
  @SuppressWarnings("unchecked")
  @Test
  public void getHashMapTest()
      throws NoSuchMethodException, SecurityException, IllegalAccessException,
          IllegalArgumentException, InvocationTargetException {

    HashMap<String, String> map = new HashMap<String, String>();
    map.put("nom", "test_nom");
    map.put("num_dossier", "123");
    map.put("num_instruction", "12");
    map.put("num_parquet", "42");

    DateFormat db = new SimpleDateFormat("yyyy-MM-dd");
    map.put("date_ordre", db.format(new Date(0)));
    map.put("date_rendu", db.format(new Date(0)));
    map.put("delai", "0");
    map.put("comment", "test_comment");
    map.put("id_enqueteur", "0");

    // La methode getHashMap est private, on passe donc par la reflection
    Method method = a.getClass().getDeclaredMethod("getHashMap");
    method.setAccessible(true);
    HashMap<String, String> mapToCompare = (HashMap<String, String>) method.invoke(a);

    assertEquals(mapToCompare.toString(), map.toString());
  }
示例#2
1
 public String toString() {
   return "WebGenRequest:"
       + "\n allparameters = "
       + allparameters.toString()
       + "\n results = "
       + results.toString()
       + "\n messages = "
       + messages.toString();
 }
示例#3
1
  @Test
  public void addMultipleFiles() throws Exception {

    Map<String, Map<String, Object>> parameters = new HashMap<String, Map<String, Object>>();
    parameters.put("input", new HashMap<String, Object>());
    parameters.get("input").put("content", multiFileCollectionInput);

    ArrayList<HashMap<String, byte[]>> files = new ArrayList<HashMap<String, byte[]>>();

    String[] binaryfiles = {
      "/home/bala/Pictures/zbcdefghijklm.jpg", "/home/bala/Pictures/bsnlbill.png"
    };

    for (String fileName : binaryfiles) {
      File uploadfile = new File(fileName);
      byte[] b = new byte[(int) uploadfile.length()];
      try {

        FileInputStream fileInputStream = new FileInputStream(uploadfile);
        b = IOUtils.toByteArray(fileInputStream);

      } catch (FileNotFoundException e) {
        throw e;
      } catch (IOException e1) {
        throw e1;
      }
      HashMap<String, byte[]> f = new HashMap<String, byte[]>();
      f.put(DMSUTILS.splitFileName(fileName), b);
      files.add(f);
    }
    parameters.get("input").put("files", files);
    parameters = dmsService.add(domainName, entity, parameters);

    HashMap<String, Object> expectedOutputContent;
    expectedOutputContent =
        (HashMap<String, Object>)
            FormatXml.getInstanceof(domainName)
                .in(parameters.get("output").get("content").toString());

    log.debug("addMultipleFiles: " + expectedOutputContent.toString());

    List<HashMap<String, String>> fileList = getFileList(expectedOutputContent);
    for (HashMap<String, String> file : fileList) {
      if (file.get("status") != null) {
        assertTrue(file.get("status").equals("true"));
      }
    }
    System.out.println(expectedOutputContent.toString());
  }
  @Override
  public OlapConnection connectMDB(String dbName, String catalog) throws GamaRuntimeException {
    OlapWrapper wrapper;
    Connection conn;
    System.out.println("dbtype:" + dbtype);
    System.out.println("driver:" + driverMap.toString());
    System.out.println("jdbc:" + jdbcMap.toString());
    try {
      if (vender.equalsIgnoreCase(MONDRIAN)) {
        Class.forName(DRIVER);
        conn =
            DriverManager.getConnection(
                "jdbc:mondrian:"
                    + "JdbcDrivers="
                    + driverMap.get(dbtype.toLowerCase())
                    + ";"
                    + "Jdbc="
                    + jdbcMap.get(dbtype.toLowerCase())
                    + url
                    + ":"
                    + port
                    + "/"
                    + dbName
                    + "?user="******"&"
                    + "password="******";"
                    + "Catalog=file:"
                    + catalog
                    + ";");

        wrapper = (OlapWrapper) conn;
        olapConnection = wrapper.unwrap(OlapConnection.class);
      } else {
        throw GamaRuntimeException.error(
            "MondrianConnection.connectMDB: The " + vender + " is not supported!");
      }
    } catch (SQLException e) {
      e.printStackTrace();
      throw GamaRuntimeException.error(e.toString());
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
      throw GamaRuntimeException.error(e.toString());
    }
    return olapConnection;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    //        Intent i = getIntent();
    //        String id_user = i.getStringExtra("id_user");
    //        Log.d("id_user", id_user);

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

    session = new UserSessionManager(getApplicationContext());
    HashMap<String, String> detail = session.getUserDetail();

    String uId = detail.get(UserSessionManager.KEY_ID);

    Log.d("detail", detail.toString());

    pDialog = new ProgressDialog(ListBlogActivity.this);
    pDialog.setMessage("loading all your blog");
    pDialog.setCancelable(false);

    getListView().setOnItemClickListener(new ListitemClickListener());
    registerForContextMenu(getListView());
    allBlog(uId);
  }
示例#6
1
  /**
   * toString method to see what is inside the website-object
   *
   * @param var var == 1 => website-text (String) will be shown in return var == 2 => JDOM-Document
   *     will be shown in return
   * @return a String in the way you wanted
   */
  public String toString(int var) {
    String result = "";

    result += "URL: " + url + "\n=========================\n";
    result += "Timestamp " + timeStamp + "\n=========================\n";
    result +=
        "Meta-Informations: "
            + contentMetaInformations.toString()
            + "\n=========================\n";
    result +=
        "Head-Informations: " + headMetaInformations.toString() + "\n=========================\n";
    result += "XML: " + XML + "\n=========================\n";
    result += "Location: " + currentLocation + "\n=========================\n";
    if (var == 1) {
      result +=
          "Text: \n--------------------------------------------------------------------------\n"
              + raw
              + "\n--------------------------------------------------------------------------\n=========================\n";
    }
    if (var == 2) {
      result +=
          "JDOM: \n--------------------------------------------------------------------------\n";
      JDOMReader reader = new JDOMReader();
      result += reader.readJDOM(this, 2);
      result +=
          "\n--------------------------------------------------------------------------\n=========================\n";
    }
    return result;
  }
  public AppletControl(String u, int w, int h, String user, String p) {

    PARAMETERS.put("RemoteHost", u.split("//")[1].split(":")[0]);
    PARAMETERS.put("RemotePort", u.split(":")[2].split("/")[0]);
    System.out.println(PARAMETERS.toString());
    this.url = u;
    URL[] url = new URL[1];
    try {

      url[0] = new URL(u);
      URLClassLoader load = new URLClassLoader(url);
      try {
        try {
          app = (Applet) load.loadClass("aplug").newInstance();
          app.setSize(w, h);
          app.setStub(this);
          app.setVisible(true);
        } catch (InstantiationException ex) {
          ex.printStackTrace();
        } catch (IllegalAccessException ex) {
          ex.printStackTrace();
        }
      } catch (ClassNotFoundException ex) {
        ex.printStackTrace();
      }
    } catch (MalformedURLException ex) {
      ex.printStackTrace();
    }
  }
示例#8
1
  @Override
  public void activate(OperatorContext ctx) {
    for (int i = 0; i < testNum; i++) {
      HashMap<String, Integer> dataMapa = new HashMap<String, Integer>();
      dataMapa.put("a", 2);
      holdingBuffer.add(dataMapa.toString().getBytes());

      HashMap<String, Integer> dataMapb = new HashMap<String, Integer>();
      dataMapb.put("b", 20);
      holdingBuffer.add(dataMapb.toString().getBytes());

      HashMap<String, Integer> dataMapc = new HashMap<String, Integer>();
      dataMapc.put("c", 1000);
      holdingBuffer.add(dataMapc.toString().getBytes());
    }
  }
 public synchronized void logout(JSONObject req) {
   Long longseq = new Long((Long) req.get("sequence"));
   Integer seq = longseq.intValue();
   JSONObject res = new JSONObject();
   String name = (String) req.get("params");
   System.out.println("Logout von Client mit Name: " + name);
   Socket t = this.keyList.get(name);
   ServerGUI.getInstance().setClientInactive(name);
   this.keyList.remove(name);
   System.out.println("In KeyList: " + keyList.toString());
   this.names.remove(name);
   this.listWithoutName.remove(t);
   ServerGUI.getInstance().id--;
   res.put("sequence", seq);
   res.put("statuscode", ServerGUI.STATUS_OK);
   res.put("response", "memberLeft");
   res.put("author", "Server");
   res.put("msg", name + " hat den Chat verlassen.");
   for (Socket s : listWithoutName) {
     try {
       PrintWriter p = new PrintWriter(s.getOutputStream(), true);
       p.println(res);
     } catch (IOException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   }
 }
示例#10
0
 public void salvaArquivo(HashMap hashMap, String nomeArquivo) throws IOException {
   File file = new File(nomeArquivo);
   try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file))) {
     bufferedWriter.write(hashMap.toString());
     bufferedWriter.close();
   }
 }
示例#11
0
 /**
  * Reads a saved serialized HashMap of TreeData objects in 'dir' named 'id' and returns the
  * TreeContainer object.
  *
  * @param id name of HashMap
  * @param dir location of saved .ser file
  * @param printData if true, will print HashMap to string (via toString method)
  * @return HashMap of TreeData objects specified by 'id' and 'dir', or null if no TreeContainer
  *     found
  */
 @SuppressWarnings("unchecked")
 public static HashMap<String, TreeData> readTreeDataMap(
     String id, String dir, boolean printData) {
   ObjectInput inputObject;
   HashMap<String, TreeData> tdHash = null;
   try {
     inputObject =
         new ObjectInputStream(new BufferedInputStream(new FileInputStream(dir + id + ".ser")));
     try {
       tdHash = (HashMap<String, TreeData>) inputObject.readObject();
     } catch (ClassNotFoundException e) {
       tdHash = null;
       Logger.logln("Couldn't load ArrayList<TreeData>: " + id + ", from: " + dir);
       e.printStackTrace();
     } finally {
       inputObject.close();
     }
   } catch (FileNotFoundException e) {
     e.printStackTrace();
   } catch (IOException e) {
     e.printStackTrace();
   }
   if (printData == true && tdHash != null) {
     System.out.println(tdHash.toString());
   }
   return tdHash;
 }
  @Test
  public void testGetOMDistribution2() throws IOException, Exception {
    log.debug("== testGetOMDistribution2() Test Start ==");
    String offset = "-7";
    String omcd = "RE003";
    String omc2n = "8.3";
    String omdep = "5";
    String ominp = "50";
    String dmr = "2.5";

    Map expected_1 = new HashMap();
    expected_1.put("event", "organic_matter");
    expected_1.put("date", "19990408");
    expected_1.put("omcd", "RE003");
    expected_1.put("omamt", "1000");
    expected_1.put("omc2n", "8.3");
    expected_1.put("omdep", "5");
    expected_1.put("ominp", "50");
    expected_1.put("omn%", "4.82");
    Map acctual_1;

    HashMap<String, Object> data = new HashMap<String, Object>();
    AcePathfinderUtil.insertValue(data, "pdate", "19990415");
    AcePathfinderUtil.insertValue(data, "om_tot", "1000");
    log.debug((String) data.get("om_tot"));
    ArrayList<HashMap<String, String>> events =
        ExperimentHelper.getOMDistribution(data, offset, omcd, omc2n, omdep, ominp, dmr);
    acctual_1 = events.get(0);

    assertEquals("getRootDistribution: om app 2", expected_1, acctual_1);
    log.info("getOMDistribution output 2: {}", data.toString());
    log.debug("== testGetOMDistribution2() Test End ==");
  }
 private void getSavedDevices() {
   JSONObject jsonObject = new JSONObject();
   String file = readFromFile();
   if (file != null) {
     try {
       jsonObject = new JSONObject(file);
     } catch (JSONException e) {
       e.printStackTrace();
     }
     // List<iBeaconInfo> devices = new ArrayList<iBeaconInfo>();
     Iterator<String> iter = jsonObject.keys();
     while (iter.hasNext()) {
       String hash = iter.next();
       try {
         JSONObject tempObject = (JSONObject) jsonObject.get(hash);
         String nickname = tempObject.getString("nickname");
         // HashMap<String,String> tempMap = new HashMap<String, String>();
         // tempMap.put(hash,nickname);
         mHashNicknames.put(hash, nickname);
       } catch (JSONException e) {
         e.printStackTrace();
       }
     }
     Log.v(TAG, mHashNicknames.toString());
   }
 }
示例#14
0
文件: Sub.java 项目: naur/jlabs
 protected String format(Object... msg) {
   HashMap<String, Object> map = new HashMap<String, Object>();
   for (int i = 0; i < msg.length; i++) {
     map.put(String.valueOf(msg[i]), msg[i = i + 1]);
   }
   return map.toString();
 }
示例#15
0
 public String findWinnerMostPoints() {
   String currentWinner = "";
   int mostPoints = 0;
   System.out.println(numFirstVotes.toString());
   System.out.println(numSecondVotes.toString());
   System.out.println(numThirdVotes.toString());
   for (String cand : candidates) {
     int currentPoints = getPoints(cand);
     System.out.printf(" %s | %d %n", cand, currentPoints);
     if (currentPoints > mostPoints) {
       currentWinner = cand;
       mostPoints = currentPoints;
     }
   }
   return currentWinner;
 }
  @Test
  public void testGetOMDistribution_NoOMData() throws IOException, Exception {

    log.debug("== testGetOMDistribution_NoOMData() Test Start ==");
    String offset = "-7";
    String omcd = "RE003";
    String omc2n = "8.3";
    String omdep = "5";
    String ominp = "50";
    String dmr = "2.5";

    HashMap<String, Object> data = new HashMap<String, Object>();
    AcePathfinderUtil.insertValue(data, "pdate", "19990415");
    ArrayList<HashMap<String, String>> events =
        ExperimentHelper.getOMDistribution(data, offset, omcd, omc2n, omdep, ominp, dmr);

    //        try {
    //            assertEquals("getRootDistribution: om no data", 1, events.size());
    //        } catch (Error e) {
    //            log.error(e.getMessage());
    //        }
    assertEquals("getRootDistribution: om no data", 0, events.size());
    log.info("getOMDistribution output: {}", data.toString());
    log.debug("== testGetOMDistribution_NoOMData() Test End ==");
  }
示例#17
0
  /**
   * Retourne la liste des types d'alignements sous forme de MAP (id + Nom)
   *
   * @param ds
   * @return
   */
  public HashMap<String, String> getAlignmentType(HikariDataSource ds) {

    Connection conn;
    Statement stmt;
    ResultSet resultSet;
    HashMap<String, String> map = new HashMap<>();

    try {
      // Get connection from pool--- aqui salta para el install
      conn = ds.getConnection();
      try {
        stmt = conn.createStatement();
        try {
          String query = "select id, label_skos from alignement_type";

          stmt.executeQuery(query);
          resultSet = stmt.getResultSet();
          while (resultSet.next()) {
            map.put(String.valueOf(resultSet.getInt("id")), resultSet.getString("label_skos"));
          }
          resultSet.close();

        } finally {
          stmt.close();
        }
      } finally {
        conn.close();
      }
    } catch (SQLException sqle) {
      // Log exception
      log.error("Error while getting Map of Type of Alignment : " + map.toString(), sqle);
    }
    return map;
  }
示例#18
0
 public String toString() {
   HashMap<String, Object> map = new HashMap<String, Object>();
   map.put("text", text);
   map.put("pinyin", pinyin);
   map.put("firstLatters", firstLatters);
   return map.toString();
 }
示例#19
0
  private boolean line(String record, Context context) throws IOException, InterruptedException {
    context.getCounter("higo", "totalrecord").increment(1);
    String[] values = record.split(split, -1);
    if (!this.validate(values, record, context)) {
      return false;
    }

    HashMap<String, String> res = new HashMap<String, String>(fields.length);
    for (int i = 0; i < fields.length; i++) {
      String fieldName = fields[i];
      String string = (i < values.length) ? values[i] : null;
      String val = parseDefault(string);

      if (this.isDate[i]) {
        res.put(fieldName, TdateFormat.ensureTdate(val, fieldName));
      } else if (val != null) {
        res.put(fieldName, val);
      } else if (this.isString[i]) {
        res.put(fieldName, "_");
      }
    }

    if (usedthedate) {
      if (thedate != null) {
        res.put("thedate", thedate); // 从文件的路径中获取
      }

      res.put(
          "thedate", String.valueOf(res.get("thedate")).replaceAll("-", "").replaceAll("_", ""));

      if (res.get("thedate").length() != 8) {
        if (debuglines < 100) {
          debuglines++;
          System.out.println("miss thedate values: " + record.replaceAll(split, "#") + "");
        }
        context.getCounter("higo", "skiprecords").increment(1);
      }

      context.getCounter("higo", "dayrecord_" + String.valueOf(res.get("thedate"))).increment(1);

      CRC32 crc32 = new CRC32();
      crc32.update(java.util.UUID.randomUUID().toString().getBytes());
      res.put("higo_uuid", Long.toString(crc32.getValue()));
    }

    if (printlines < 10) {
      printlines++;
      System.out.println("res: " + res.toString() + " arrays," + Arrays.toString(values));
    }

    this.doclist.add(res);
    if (this.doclist.size() >= PER) {
      context.write(new LongWritable(this.Index++), new DocumentList(this.doclist));
      this.doclist.clear();
    }

    return true;
  }
 /**
  * @Method Name : getJSONObjectCastionParam @Date : 2009. 3. 18. @Modify Info : @Method
  * Description : JSONObject를 String 파라미터형태로 변환한다.
  *
  * @param jsonObject
  * @return String
  */
 public String getJSONObjectCastionParam(HashMap jsonObject) {
   return jsonObject
       .toString()
       .replaceAll(",", "&")
       .replaceAll("\\s", "")
       .replaceAll("[\\{|\\}]", "")
       .replaceAll("\\:", "=")
       .replaceAll("\"", "");
 }
示例#21
0
 @SuppressWarnings("unchecked")
 // @Test
 public void objectTOMap() {
   Post post = postDao.get(8);
   String str = JSONObject.toJSONString(post);
   HashMap<String, String> map = JSON.parseObject(JSONObject.toJSONString(post), HashMap.class);
   System.out.println(map.toString());
   System.out.println(ObjectToMap.objectToMap(post));
 }
  @Test
  public void testGetOMDistribution() throws IOException, Exception {
    log.debug("== testGetOMDistribution() Test Start ==");
    String line;
    String offset = "-7";
    String omcd = "RE003";
    String omc2n = "8.3";
    String omdep = "5";
    String ominp = "50";
    String dmr = "2.5";
    // planting data is 19990415
    // fen_tot is 110
    Map expected_1 = new HashMap();
    expected_1.put("event", "organic_matter");
    expected_1.put("date", "19990408");
    expected_1.put("omcd", "RE003");
    expected_1.put("omamt", "1000");
    expected_1.put("omc2n", "8.3");
    expected_1.put("omdep", "5");
    expected_1.put("ominp", "50");
    expected_1.put("omn%", "4.82");
    Map acctual_1;

    // BufferedReader br = new BufferedReader(
    //         new InputStreamReader(
    //         new FileInputStream(resource2.getPath())));

    // if ((line = br.readLine()) != null) {
    //     HashMap<String, ArrayList<Map>> data = new LinkedHashMap<String, ArrayList<Map>>();
    //     Map<String, Object> expData = JSONAdapter.fromJSON(line);
    // data.put("experiments", new ArrayList());
    // data.put("weathers", new ArrayList());
    // data.get("experiments").add(expData);
    // data.get("weathers").add((Map) expData.get("weather"));
    // expData.put("omamt", "1000");
    // Map omEvent = new LinkedHashMap();
    // omEvent.put("event", "organic-materials");
    // omEvent.put("date", "19990414");
    HashMap<String, Object> data = new HashMap<String, Object>();
    AcePathfinderUtil.insertValue(data, "pdate", "19990415");
    AcePathfinderUtil.insertValue(data, "omamt", "1000");
    ArrayList<HashMap<String, String>> events =
        ExperimentHelper.getOMDistribution(data, offset, omcd, omc2n, omdep, ominp, dmr);
    acctual_1 = events.get(0);
    // }
    //        try {
    //            assertEquals("getRootDistribution: om app 1", expected_1, acctual_1);
    //        } catch (Error e) {
    //            log.error(e.getMessage());
    //        }
    assertEquals("getRootDistribution: om app 1", expected_1, acctual_1);
    log.info("getOMDistribution output: {}", data.toString());
    log.debug("== testGetOMDistribution() Test End ==");
  }
 public String getInfo(String path) {
   HashMap<Integer, String> rtrnmap = new HashMap<Integer, String>();
   try {
     rtrnmap = API_GetCall(path);
     rtnval = rtrnmap.get(200).toString();
   } catch (Exception e) {
     System.out.println(rtrnmap.toString());
     System.out.println(e);
   }
   return rtnval;
 }
示例#24
0
 /**
  * Gets a string representation of marker
  *
  * @param marker The marker instance
  * @return Readable description of the marker
  */
 @SuppressWarnings("unchecked")
 protected String getDescription(IMarker marker) {
   try {
     HashMap<String, Object> map = new HashMap<String, Object>();
     map.put("resource", marker.getResource().getName());
     map.put("type", marker.getType());
     map.put("attributes", new HashMap<String, Object>(marker.getAttributes()).toString());
     return map.toString();
   } catch (CoreException e) {
     throw new RuntimeException(e);
   }
 }
 public void reduce(Text key, Iterable<Text> values, Context context)
     throws IOException, InterruptedException {
   HashMap<Text, Integer> ret = new HashMap<Text, Integer>();
   for (Text val : values) {
     if (ret.containsKey(val)) {
       ret.put(val, Integer.valueOf(ret.get(val) + 1));
     } else {
       ret.put(val, Integer.valueOf(1));
     }
   }
   result.set(ret.toString());
   context.write(key, result);
 }
  public BasicWorkFlow(HashMap propertiesHashMap, PageContext pageContext) throws Exception {
    if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
        abcs.logic.communication.log.config.type.LogConfigType.WORKFLOW)) {
      LogUtil.put(
          LogFactory.getInstance(
              "Properties: " + propertiesHashMap.toString(), this, "BasicWorkFlow()"));
    }

    this.propertiesHashMap = propertiesHashMap;
    this.pageContext = pageContext;

    this.validationDomNodeInterface =
        (ValidationComponentInterface) TransformFactory.getInstance(propertiesHashMap, pageContext);
  }
示例#27
0
  void inflateDay(List<HashMap> listMap) {
    String dayWeekNum = listMap.get(0).get("dayWeekNum").toString();
    dayWeekNum = listMap.get(0).get("dayWeekNum").toString();
    int i = 0, count = listMap.size();
    int iDay = 0;

    HashMap<String, List> mapDays = new HashMap<>();

    List<List> listList = new ArrayList<>();

    for (HashMap<String, String> map : listMap) {
      String dN = map.get("dayWeekNum");
      List<HashMap> ll = mapDays.get(dN) == null ? new ArrayList<>() : mapDays.get(dN);
      ll.add(map);
      if (mapDays.get(dN) == null) {
        mapDays.put(dN, ll);
        listList.add(ll);
      }
    }
    final LinearLayout.LayoutParams layoutParamsFrorTitle =
        new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParamsFrorTitle.setMargins(2, 2, 2, 2);

    for (List<HashMap> lm : listList) {
      LayoutInflater inflater = (LayoutInflater) (activity.getLayoutInflater());
      final View view = inflater.inflate(R.layout.coll_week, null, false);
      final LinearLayout.LayoutParams layoutParams =
          new LinearLayout.LayoutParams(
              ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
      final LinearLayout daySprite = (LinearLayout) view.findViewById(R.id.daySprite);
      final List<HashMap> _lm = lm;
      fr.addView(view);
      view.setLayoutParams(layoutParams);
      TextView dayTitle = (TextView) view.findViewById(R.id.dayTitle);
      dayTitle.setLayoutParams(layoutParamsFrorTitle);
      dayTitle.setText(
          firstUpperCase(_lm.get(0).get("dayWeek").toString())
              + " "
              + _lm.get(0).get("date").toString());

      for (HashMap<String, String> map : lm) {
        onInflate(daySprite, map, iDay);
        iDay++;
      }
    }
    Log.d(TAG, "od" + listList.toString());
    Log.d(TAG, "od" + mapDays.toString());
  }
示例#28
0
  public void getAll() {
    System.out.println("Printing Tree");
    Enumeration en = root.breadthFirstEnumeration();
    while (en.hasMoreElements()) {
      DecisionTreeNode node = (DecisionTreeNode) en.nextElement();
      System.out.println("" + node.getUserObject() + " => " + node.nodeName);
    }

    System.out.println("\nPrinting Added name list");
    for (String s : addedNodes) {
      System.out.println(s);
    }

    System.out.println("\nPrinting correctNode list");
    System.out.println(correctNodes.toString());
  }
  public static void main(String[] args) throws Exception {

    // parse arguments
    if (args.length != 3 || !args[1].equals("-config")) {
      usage();
    }

    // Determine type
    Type type = null;
    String software;
    if (args[0].equals("-w")) {
      type = Type.WELCOME;
      software = "TAISHI/WelcomeThreadServer";
    } else if (args[0].equals("-b")) {
      type = Type.BUSY;
      software = "TAISHI/BusyWaitServer";
    } else if (args[0].equals("-s")) {
      type = Type.SUSPENSION;
      software = "TAISHI/SuspensionServer";
    } else {
      software = "";
      usage();
    }

    // Reading configuration file
    String config_file = args[2];

    ReadConfig parse = new ReadConfig(config_file, software);
    HashMap<String, String> config_map = parse.getConfig();
    Debug.debug(config_map.toString());

    // check if config_map is valid
    // necessary to check the thread pool size is set
    if (config_map == null || !config_map.containsKey("ThreadPoolSize")) {
      throw new Exception("Incomplete configuration");
    }

    // create cache
    Debug.debug("Create cache with size: " + config_map.get("CacheSize"));
    ThreadSafeCache cache = new ThreadSafeCache(Integer.parseInt(config_map.get("CacheSize")));

    // create server
    ThreadPoolServer server = new ThreadPoolServer(type, config_map, cache);
    server.run();
  }
  public static void main(String[] args) {
    HashSet<String> vowels = new HashSet<>();
    Collections.addAll(vowels, "a", "e", "i", "o", "u");

    HashMap<String, Integer> vowelMap = new HashMap<>();

    for (String word : new TreeSet<>(new TextFile("SetOperations.java", "\\W+"))) {
      for (char letter : word.toCharArray()) {
        String letterStr = String.valueOf(letter);
        if (vowels.contains(letterStr)) {
          int number = vowelMap.containsKey(letterStr) ? vowelMap.get(letterStr) : 0;
          vowelMap.put(letterStr, ++number);
        }
      }
    }

    print(vowelMap.toString());
  }