public StringValidator(Map<String, Object> params) { this.acceptedValues = new HashSet<String>(Arrays.asList((String[]) params.get(ConfigValidationAnnotations.ValidatorParams.ACCEPTED_VALUES))); if (this.acceptedValues.isEmpty() || (this.acceptedValues.size() == 1 && this.acceptedValues.contains(""))) { this.acceptedValues = null; } }
private IndexLimitation[] limitationsUnion( Iterable<IndexCapability> capabilities ) { HashSet<IndexLimitation> union = new HashSet<>(); for ( IndexCapability capability : capabilities ) { union.addAll( Arrays.asList( capability.limitations() ) ); } return union.toArray( new IndexLimitation[union.size()] ); } }
/** * Counts profile properties. Note: this method is not * that easy on execution. */ public int countProfileProperties() { final HashSet<String> profileKeys = new HashSet<>(); for (final Map<String, PropsEntry> map : profileProperties.values()) { for (final String key : map.keySet()) { if (!baseProperties.containsKey(key)) { profileKeys.add(key); } } } return profileKeys.size(); }
statement: for (Iterator sIt = body.getUnits().iterator(); sIt.hasNext();) { final Stmt s = (Stmt) sIt.next(); HashSet read = new HashSet(); HashSet write = new HashSet(); Iterator<MethodOrMethodContext> it = tt.iterator(s); while (it.hasNext()) { SootMethod target = (SootMethod) it.next(); ensureProcessed(target); if (target.isNative()) { if (read.size() + write.size() > threshold) { continue statement;
public String getFeaturesFromNodes(WordTree node, String word,String tag,int depth){ if(node.depth>depth) return " "; String res = ""; String newfeature =tag; newfeature = newfeature+node.tag+"."; if(node.wordSet.size()>0) { if(node.wordSet.contains(word)) newfeature = newfeature +"1 "; else newfeature = newfeature +"0 "; res = res + newfeature; } Iterator<WordTree> it = node.childs.iterator(); while(it.hasNext()){ WordTree subnode = it.next(); if(subnode==null) continue; res = res + getFeaturesFromNodes(subnode,word,newfeature,depth); } return res; }
public void countConflict() { int conflict = 0; Iterator it = map.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry)it.next(); HashSet<String> hashset = (HashSet<String>)entry.getValue(); conflict += (hashset.size() - 1); // if(hashset.size() >1) // System.out.println(hashset); } System.out.println(conflict + " / " + count + " = " + (double)conflict/(double)count); map.clear(); map =null; }
public void unregisterSC(ServerConnection sc) { // removed syncLock synchronization to fix bug 37104 synchronized (this.allSCsLock) { this.allSCs.remove(sc); Iterator it = this.allSCs.iterator(); ServerConnection again[] = new ServerConnection[this.allSCs.size()]; for (int i = 0; i < again.length; i++) { again[i] = (ServerConnection) it.next(); } this.allSCList = again; } if (!isRunning()) { return; } // just need to wake the selector up so it will notice our socket was closed wakeupSelector(); }
@Override protected ProducesRequestCondition customize(ProducesRequestCondition condition) { if (!condition.isEmpty()) { return condition; } HashSet<String> mediaTypes = new LinkedHashSet<String>(); mediaTypes.add(configuration.getDefaultMediaType().toString()); mediaTypes.add(MediaType.APPLICATION_JSON_VALUE); return new ProducesRequestCondition(mediaTypes.toArray(new String[mediaTypes.size()])); }
@Override protected int act(List<Run<?, ?>> builds) throws IOException { job.checkPermission(Run.DELETE); final HashSet<Integer> hsBuilds = new HashSet<>(); for (Run<?, ?> build : builds) { if (!hsBuilds.contains(build.number)) { build.delete(); hsBuilds.add(build.number); } } stdout.println("Deleted "+hsBuilds.size()+" builds"); return 0; }
public String[] getPropertyGroups(String prefix) { Enumeration<?> keys = props.propertyNames(); HashSet<String> groups = new HashSet<String>(10); if (!prefix.endsWith(".")) { prefix += "."; } while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); if (key.startsWith(prefix)) { String groupName = key.substring(prefix.length(), key.indexOf( '.', prefix.length())); groups.add(groupName); } } return (String[]) groups.toArray(new String[groups.size()]); }
@Override public Collection<Node> takeNodes(int nodesNeeded) { HashSet<Node> ret = new HashSet<>(); LinkedList<Node> sortedNodes = new LinkedList<>(_nodes); Collections.sort(sortedNodes, Node.FREE_NODE_COMPARATOR_DEC); for (Node n : sortedNodes) { if (nodesNeeded <= ret.size()) { break; } if (n.isAlive()) { n.freeAllSlots(_cluster); _nodes.remove(n); ret.add(n); } } return ret; }
public void execute() throws IOException { for (BugInstance bug : origCollection.getCollection()) { for (Iterator<BugAnnotation> i = bug.annotationIterator(); i.hasNext();) { copySourceForAnnotation(i.next()); } } if (zOut != null) { zOut.close(); } System.out.printf("All done. %d files not found, %d files copied%n", couldNotFind.size(), copyCount); }