Refine search
private Nature(String name) { if (idMap == null) idMap = new TreeMap<String, Integer>(); assert !idMap.containsKey(name); this.name = name; ordinal = idMap.size(); idMap.put(name, ordinal); Nature[] extended = new Nature[idMap.size()]; if (values != null) System.arraycopy(values, 0, extended, 0, values.length); extended[ordinal] = this; values = extended; }
/** * Splits the range set at the given timestamp (if it hasn't been split yet) */ private void splitAt(long t) { if (data.containsKey(t)) return; // already split at this timestamp SortedMap<Long, int[]> head = data.headMap(t); int v = head.isEmpty() ? 0 : data.get(head.lastKey())[0]; data.put(t, new int[]{v}); }
/** * Returns null if it was created, the value otherwise. */ public Object getStateOrCreate(long txid, StateInitializer init) { Object state; if (_curr.containsKey(txid)) { state = _curr.get(txid); } else { getState(txid, init); state = null; } return state; }
defaults.put(defaultEntry.getKey(), defaultEntry.getValue()); for (Entry<String,String> e : shellState.getAccumuloClient().namespaceOperations() .getProperties(n)) { namespaceConfig.put(e.getKey(), e.getValue()); sortedConf.put(propEntry.getKey(), propEntry.getValue()); continue; if (defaults.containsKey(key) && !Property.getPropertyByKey(key).isExperimental()) { printConfLine(output, "default", key, dfault); printed = true; if (!defaults.containsKey(key) || !defaults.get(key).equals(siteVal)) { printConfLine(output, "site", printed ? " @override" : key, siteVal == null ? "" : siteVal); printed = true; if (!siteConfig.containsKey(key) || !siteVal.equals(sysVal)) { printConfLine(output, "system", printed ? " @override" : key, sysVal); printed = true; if (!systemConfig.containsKey(key) || !sysVal.equals(nspVal)) { printConfLine(output, "namespace", printed ? " @override" : key, nspVal); printed = true;
static void combineChain(TreeMap<String, String> s2t, TreeMap<String, String> t2x) { for (Map.Entry<String, String> entry : s2t.entrySet()) { String x = t2x.get(entry.getValue()); if (x != null) { entry.setValue(x); } } for (Map.Entry<String, String> entry : t2x.entrySet()) { String s = CharTable.convert(entry.getKey()); if (!s2t.containsKey(s)) { s2t.put(s, entry.getValue()); } } }
synchronized private void changeDisplay(int displayId, DisplayInfo displayInfo) { if (!displayInfos.containsKey(displayId)) { throw new IllegalStateException("no display " + displayId); } displayInfos.put(displayId, displayInfo); notifyListeners(displayId, DisplayManagerGlobal.EVENT_DISPLAY_CHANGED); }
/** * @param timeNano the time in nano seconds * @return the number of event happened in the bucket that includes timeNano */ public int get(long timeNano) { long leftEndPoint = bucket(timeNano); return mSeries.containsKey(leftEndPoint) ? mSeries.get(leftEndPoint) : 0; }
/** * Record events at a timestamp into the time series. * @param timeNano the time in nano seconds * @param numEvents the number of events happened at timeNano */ public void record(long timeNano, int numEvents) { long leftEndPoint = bucket(timeNano); mSeries.put(leftEndPoint, (mSeries.containsKey(leftEndPoint) ? mSeries.get(leftEndPoint) : 0) + numEvents); }
@SuppressWarnings("unused") protected static void checkAndCoSort(int[] positions, Class<?>[] types) { if (positions.length != types.length) { throw new IllegalArgumentException("The positions and types must be of the same length"); } TreeMap<Integer, Class<?>> map = new TreeMap<Integer, Class<?>>(); for (int i = 0; i < positions.length; i++) { if (positions[i] < 0) { throw new IllegalArgumentException("The field " + " (" + positions[i] + ") is invalid."); } if (types[i] == null) { throw new IllegalArgumentException("The type " + i + " is invalid (null)"); } if (map.containsKey(positions[i])) { throw new IllegalArgumentException("The position " + positions[i] + " occurs multiple times."); } map.put(positions[i], types[i]); } int i = 0; for (Map.Entry<Integer, Class<?>> entry : map.entrySet()) { positions[i] = entry.getKey(); types[i] = entry.getValue(); i++; } }
/** * Returns null if it was created, the value otherwise. */ public Object getStateOrCreate(BigInteger txid, StateInitializer init) { if (_curr.containsKey(txid)) { return _curr.get(txid); } else { getState(txid, init); return null; } }
/** * 增加词+词性 * @param pos * @param s */ private void add(String pos, String s) { if(s.length()>maxLen) return; if(pos.length()==0) return; posSet.add(pos); if(dict.containsKey(s)){ TreeSet<String> sett = dict.get(s); sett.add(pos); }else{ TreeSet<String> sett = new TreeSet<String>(); sett.add(pos); dict.put(s, sett); } }
public void register(Iterable<String> tags, Integer usn) { //boolean found = false; for (String t : tags) { if (!mTags.containsKey(t)) { mTags.put(t, usn == null ? mCol.usn() : usn); mChanged = true; } } //if (found) { // runHook("newTag"); // TODO //} }
/** * Returns null if it was created, the value otherwise. */ public Object getStateOrCreate(long txid, StateInitializer init) { if(_curr.containsKey(txid)) { return _curr.get(txid); } else { getState(txid, init); return null; } }
private void addSortMap(int a, int b, double updatedata) { if (sortmap.containsKey(updatedata)) { Set<String> set = sortmap.get(updatedata); set.add(id2String(a, b)); } else { Set<String> set = new HashSet<String>(); set.add(id2String(a, b)); sortmap.put(updatedata, set); } }
public static void setColumnStatsState(Map<String, String> params, List<String> colNames) { if (params == null) { throw new RuntimeException("params are null...cant set columnstatstate!"); } if (colNames == null) { return; } ColumnStatsAccurate stats = parseStatsAcc(params.get(COLUMN_STATS_ACCURATE)); for (String colName : colNames) { if (!stats.columnStats.containsKey(colName)) { stats.columnStats.put(colName, true); } } try { params.put(COLUMN_STATS_ACCURATE, ColumnStatsAccurate.objectWriter.writeValueAsString(stats)); } catch (JsonProcessingException e) { LOG.trace(e.getMessage()); } }
@Override public FileStream getStream( String filename ) { if ( fileNameMap.containsKey( filename ) ) { return fileNameMap.get( filename ).getFileStream(); } else { return null; } }
private void initSortMap() { for (int i = 0; i < feasize - 1; i++) { for (int j = i + 1; j < feasize; j++) { double temp = getDistance(i, j); Set<String> hashset; if (sortmap.containsKey(temp)) hashset = sortmap.get(temp); else hashset = new HashSet<String>(); // System.out.println(temp + " " + i + " " + j); // System.out.println(getDistance(i, j)); hashset.add(id2String(i, j)); sortmap.put(temp, hashset); } } System.out.println("Map init size: " + sortmap.size()); }
apiKeysText.put(supportedVersion.apiKey, apiVersionToText(supportedVersion)); for (ApiVersion apiVersion : unknownApis) apiKeysText.put(apiVersion.apiKey, apiVersionToText(apiVersion)); if (!apiKeysText.containsKey(apiKey.id)) { StringBuilder bld = new StringBuilder(); bld.append(apiKey.name).append("("). append(apiKey.id).append("): ").append("UNSUPPORTED"); apiKeysText.put(apiKey.id, bld.toString());
MDAGNode currentTargetNode = transitionKeyValuePair.getValue(); if(!outgoingTransitionTreeMap2.containsKey(currentCharKey) || !outgoingTransitionTreeMap2.get(currentCharKey).equals(currentTargetNode)) return false;
private void addStartEndKeysForTest(TreeMap<byte[], Integer> map, byte[] first, byte[] last) { Integer value = map.containsKey(first) ? map.get(first) : 0; map.put(first, value + 1); value = map.containsKey(last) ? map.get(last) : 0; map.put(last, value - 1); }