private void printResults(Map<String, Double> pvals, List<String> list) { for (String s : list) { System.out.println( s + "\t" + FormatUtil.roundToSignificantDigits(pvals.get(s), 2) + "\t" + affectedDw.get(s)); } }
public static void fight(AIDelegate aiDelegate, CachedUnit unit, AIFloat3 pos, boolean queue) { AICommand command = new FightUnitAICommand( unit.getUnitId(), -1, queue ? queueOption : 0, commandTimeout.getValue(), pos); try { handleCommand(aiDelegate, command); } catch (Exception e) { System.err.println(unit.getDef().getHumanName() + "::" + FormatUtil.formatAIFloat3(pos)); } }
@Test public void testFindKeysByMetricName() { keyCache.addTSDRCacheEntry(TSDR_TEST_KEY); List<TSDRCacheEntry> list = keyCache.findMatchingTSDRCacheEntries( FormatUtil.KEY_METRICNAME + FormatUtil.getMetriNameFromTSDRKey(TSDR_TEST_KEY) + ']'); Assert.assertEquals(1, list.size()); TSDRCacheEntry entry = list.get(0); Assert.assertEquals("127.0.0.1", entry.getNodeID()); Assert.assertEquals(DataCategory.EXTERNAL, entry.getDataCategory()); Assert.assertEquals("Memory", entry.getMetricName()); Assert.assertEquals("Testing", entry.getRecordKeys().get(1).getKeyName()); }
/** * 从json数组中解析出java Date 型对象数组,使用本方法必须保�? * * @param jsonString * @return * @throws ParseException */ public static Date[] getDateArray4Json(String jsonString, String dataFormat) throws ParseException { JSONArray jsonArray = JSONArray.fromObject(jsonString); Date[] dateArray = new Date[jsonArray.size()]; String dateString; Date date; for (int i = 0; i < jsonArray.size(); i++) { dateString = jsonArray.getString(i); date = FormatUtil.stringToDate(dateString, dataFormat); dateArray[i] = date; } return dateArray; }
public String format(long fileSize) { return FormatUtil.readableFileSize(fileSize); }