public static int compareChrom(String chrom1, String chrom2) { chrom1 = chrom1.substring(3); chrom2 = chrom2.substring(3); try { if (NumberUtils.isNumber(chrom1) && NumberUtils.isNumber(chrom2)) { Integer a = Integer.parseInt(chrom1); Integer b = Integer.parseInt(chrom2); return a.compareTo(b); } } catch (NumberFormatException e) { //return chrom1.compareTo(chrom2); } return chrom1.compareTo(chrom2); }
return NumberUtils.isNumber(value) ? Float.parseFloat(value) : null; } catch (Exception e) { return null;
ARTIFACT_DELETE_THREAD_POOL_SIZE); if (org.apache.commons.lang.NumberUtils.isNumber(strPoolSize)) {
@SuppressWarnings("deprecation") protected Map<String,Float> calculateWordScores( List<List<String>> phrases) { Bag<String> wordFreq = new HashBag<String>(); Bag<String> wordDegree = new HashBag<String>(); for (List<String> phrase : phrases) { int degree = -1; for (String word : phrase) { if (NumberUtils.isNumber(word)) continue; else degree++; } for (String word : phrase) { wordFreq.add(word); wordDegree.add(word, degree); // other words } } for (String word : wordFreq.uniqueSet()) { wordDegree.add(word, wordFreq.getCount(word)); // itself } Map<String,Float> wordScores = new HashMap<String,Float>(); for (String word : wordFreq.uniqueSet()) { float score = (float) wordDegree.getCount(word) / (float) wordFreq.getCount(word); wordScores.put(word, score); } return wordScores; }