List of usage examples for java.util Set addAll
boolean addAll(Collection<? extends E> c);
From source file:io.warp10.script.binary.ADD.java
@Override public Object apply(WarpScriptStack stack) throws WarpScriptException { Object op2 = stack.pop();//from w ww .j a va2s . co m Object op1 = stack.pop(); if (op2 instanceof Number && op1 instanceof Number) { if (op1 instanceof Double || op2 instanceof Double) { stack.push(((Number) op1).doubleValue() + ((Number) op2).doubleValue()); } else { stack.push(((Number) op1).longValue() + ((Number) op2).longValue()); } } else if (op2 instanceof String && op1 instanceof String) { stack.push(op1.toString() + op2.toString()); } else if (op1 instanceof List) { List<Object> l = new ArrayList<Object>(); l.addAll((List) op1); l.add(op2); stack.push(l); } else if (op1 instanceof Set) { Set<Object> s = new HashSet<Object>(); s.addAll((Set) op1); s.add(op2); stack.push(s); } else if (op1 instanceof Macro && op2 instanceof Macro) { Macro macro = new Macro(); macro.addAll((Macro) op1); macro.addAll((Macro) op2); stack.push(macro); } else if (op1 instanceof RealMatrix && op2 instanceof RealMatrix) { stack.push(((RealMatrix) op1).add((RealMatrix) op2)); } else if (op1 instanceof RealMatrix && op2 instanceof Number) { stack.push(((RealMatrix) op1).scalarAdd(((Number) op2).doubleValue())); } else if (op2 instanceof RealMatrix && op1 instanceof Number) { stack.push(((RealMatrix) op2).scalarAdd(((Number) op1).doubleValue())); } else if (op1 instanceof RealVector && op2 instanceof RealVector) { stack.push(((RealVector) op1).add((RealVector) op2)); } else if (op1 instanceof RealVector && op2 instanceof Number) { stack.push(((RealVector) op1).mapAdd(((Number) op2).doubleValue())); } else if (op2 instanceof RealVector && op1 instanceof Number) { stack.push(((RealVector) op2).mapAdd(((Number) op1).doubleValue())); } else { throw new WarpScriptException( getName() + " can only operate on numeric, string, lists, matrices, vectors and macro values."); } return stack; }
From source file:gov.jgi.meta.MetaUtils.java
public static Set<String> generateAllNeighborsWithinDistance(String start, int distance) { Set<String> s = new HashSet<String>(); if (distance == 0) { s.add(start);// w ww.j av a 2 s . c om return s; } int[] v = new int[distance]; int i; for (i = 0; i < distance; i++) v[i] = i; // init the change vector boolean overflow = false; while (!overflow) { Set<String> c = changeVectorApply2(start, v); s.addAll(c); for (int j = v.length - 1; j >= 0; j--) { if (v[j] < start.length() - distance + j) { v[j] += 1; for (int k = j + 1; k < v.length; k++) v[k] = v[k - 1] + 1; break; } else if (j == 0) { v[j] = 0; overflow = true; } else { v[j] = 0; } } } return s; }
From source file:la.alsocan.jsonshapeshifter.bindings.StringHandlebarsBinding.java
@Override public Set<SchemaNode> getSourceNodes() { Set<SchemaNode> nodes = new HashSet<>(); params.values().stream().forEach((b) -> { nodes.addAll(b.getSourceNodes()); });//from w ww . ja v a2s. c om return nodes; }
From source file:edu.cornell.mannlib.vitro.webapp.controller.accounts.manageproxies.ManageProxiesCreatePage.java
/** * We don't remove any existing relationships, we just add new ones. But we * won't add a relationship to one's self. *//*w ww . j a v a2 s . c o m*/ public void createRelationships() { for (UserAccount proxyAccount : proxyAccounts) { Set<String> profiles = new HashSet<String>(); profiles.addAll(figureNonSelfProfileUris(proxyAccount)); profiles.addAll(proxyAccount.getProxiedIndividualUris()); proxyAccount.setProxiedIndividualUris(profiles); userAccountsDao.updateUserAccount(proxyAccount); } }
From source file:org.mitre.openid.connect.service.impl.DefaultScopeClaimTranslationService.java
@Override public Set<String> getClaimsForScopeSet(Set<String> scopes) { Set<String> result = new HashSet<>(); for (String scope : scopes) { result.addAll(getClaimsForScope(scope)); }/*from w w w .j av a2 s.c o m*/ return result; }
From source file:br.ufac.sion.service.AuditoriaService.java
public List<AuditoriaDTO> findAll(FiltroAuditoria filtro) throws NegocioException { // public List<AuditoriaDTO> findAll(Class<?> classe, String nomeEntidade, String login, LocalDateTime dataInicio, LocalDateTime dataFim) throws NegocioException { Set<AuditoriaDTO> revisions = new HashSet<>(); revisions.addAll(findAllRevisions(filtro)); ArrayList<AuditoriaDTO> list = new ArrayList<>(revisions); Collections.sort(list);/* ww w . ja va 2s . co m*/ return list; }
From source file:edu.vt.middleware.gator.web.support.ParametersEditor.java
/** {@inheritDoc} */ @Override// www . ja v a 2 s. c o m public Object getValue() { final Set<T> copy = new LinkedHashSet<T>(); copy.addAll(paramSet); return copy; }
From source file:hyldap.HyNewUserGroupBean.java
public List<Long> groups(String username, LdapConfig config, LdapOperations ldap, RoleProvider provider, AttributeSet attrSet) {/* w w w .j a v a2 s . c om*/ log.debug("groups for " + username); Set<String> groupNames = new HashSet<String>(); groupNames.addAll(attrSet.getAll(GROUP_MEMBER)); groupNames.addAll(attrSet.getAll(GROUP_OWNER)); if (groupNames.isEmpty()) { throw new ValidationException(username + " has no attributes " + GROUP_MEMBER); } List<Long> groups = new ArrayList<Long>(); for (String grpName : groupNames) { log.debug("grpName " + grpName); if (allowedGroups.containsKey(grpName)) { log.debug("grpName matched " + grpName); String grpOmeName = (String) allowedGroups.get(grpName); log.debug("grpName matched " + grpOmeName); groups.add(provider.createGroup(grpOmeName, null, false)); log.debug("grpName matched, adding group 'user'"); groups.add(new Long(1)); } } return groups; }
From source file:de.tudarmstadt.ukp.dkpro.lexsemresource.core.AbstractResource.java
public Set<Entity> getNeighbors(Entity entity) throws LexicalSemanticResourceException { Set<Entity> neighbors = new HashSet<Entity>(); neighbors.addAll(getParents(entity)); neighbors.addAll(getChildren(entity)); return neighbors; }