List of usage examples for java.util LinkedList add
public boolean add(E e)
From source file:com.cloud.agent.resource.virtualnetwork.ConfigHelper.java
private static List<ConfigItem> generateConfig(VmDataCommand cmd) { LinkedList<ConfigItem> cfg = new LinkedList<>(); Map<String, List<String[]>> data = new HashMap<String, List<String[]>>(); data.put(cmd.getVmIpAddress(), cmd.getVmData()); String json = new Gson().toJson(data); String encoded;/* w w w. ja va2 s. c o m*/ try { encoded = Base64.encodeBase64String(json.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException("Unable retrieve UTF-8 encoded data from vmdata"); } String args = "-d " + encoded; cfg.add(new ScriptConfigItem(VRScripts.VMDATA, args)); return cfg; }
From source file:org.psidnell.omnifocus.model.Task.java
@Override @JsonIgnore//from ww w.ja v a 2s. c o m public List<ProjectHierarchyNode> getProjectPath() { if (parent != null) { return getProjectPath(parent); } else { LinkedList<ProjectHierarchyNode> result = new LinkedList<>(); result.add(this); return result; } }
From source file:com.cloud.agent.resource.virtualnetwork.ConfigHelper.java
private static List<ConfigItem> generateConfig(SetPortForwardingRulesCommand cmd) { LinkedList<ConfigItem> cfg = new LinkedList<>(); for (PortForwardingRuleTO rule : cmd.getRules()) { StringBuilder args = new StringBuilder(); args.append(rule.revoked() ? "-D" : "-A"); args.append(" -P ").append(rule.getProtocol().toLowerCase()); args.append(" -l ").append(rule.getSrcIp()); args.append(" -p ").append(rule.getStringSrcPortRange()); args.append(" -r ").append(rule.getDstIp()); args.append(" -d ").append(rule.getStringDstPortRange()); cfg.add(new ScriptConfigItem(VRScripts.FIREWALL_NAT, args.toString())); }/*from ww w .java 2s .c o m*/ return cfg; }
From source file:net.datapipe.CloudStack.CloudStackAPI.java
public Document createAutoScaleVmGroup(String lbRuleId, int minMembers, int maxMembers, String scaleDownPolicyIds, String scaleUpPolicyIds, String vmProfileId, HashMap<String, String> optional) throws Exception { LinkedList<NameValuePair> arguments = newQueryValues("createAutoScaleVmGroup", optional); arguments.add(new NameValuePair("lbruleid", lbRuleId)); arguments.add(new NameValuePair("maxmembers", Integer.toString(maxMembers))); arguments.add(new NameValuePair("minmembers", Integer.toString(minMembers))); arguments.add(new NameValuePair("scaledownpolicyids", scaleDownPolicyIds)); arguments.add(new NameValuePair("scaleuppolicyids", scaleUpPolicyIds)); arguments.add(new NameValuePair("vmprofileid", vmProfileId)); return Request(arguments); }
From source file:net.dv8tion.jda.handle.MessageEmbedHandler.java
@Override protected String handleInternally(JSONObject content) { EntityBuilder builder = new EntityBuilder(api); String messageId = content.getString("id"); String channelId = content.getString("channel_id"); TextChannel channel = api.getChannelMap().get(channelId); LinkedList<MessageEmbed> embeds = new LinkedList<>(); JSONArray embedsJson = content.getJSONArray("embeds"); for (int i = 0; i < embedsJson.length(); i++) { embeds.add(builder.createMessageEmbed(embedsJson.getJSONObject(i))); }//www . j a va 2 s. c o m if (channel != null) { if (GuildLock.get(api).isLocked(channel.getGuild().getId())) { return channel.getGuild().getId(); } api.getEventManager() .handle(new GuildMessageEmbedEvent(api, responseNumber, messageId, channel, embeds)); } else { PrivateChannel privChannel = api.getPmChannelMap().get(channelId); if (privChannel == null) { EventCache.get(api).cache(EventCache.Type.CHANNEL, channelId, () -> { handle(allContent); }); EventCache.LOG.debug("Got unrecognized Channel Id for MessageEmbed! JSON: " + content); return null; } api.getEventManager() .handle(new PrivateMessageEmbedEvent(api, responseNumber, messageId, privChannel, embeds)); } //Combo event api.getEventManager() .handle(new MessageEmbedEvent(api, responseNumber, messageId, channelId, embeds, channel == null)); return null; }
From source file:com.pavikumbhar.javaheart.util.PasswordGenerator.java
private String generatePassword(int length) { int count = c.length; LinkedList<Character> s = new LinkedList<Character>(); LinkedList<Character> s1 = new LinkedList<Character>(); Collections.addAll(s, c);/*from w w w . jav a 2 s . co m*/ while (count > 0) { long n = generateRandomNumber(); int position = (int) (n % count); s1.add(s.remove(position)); count--; } String pwd = null; //System.out.println(">>"+s1.toString()); Character[] c1 = new Character[s1.size()]; c1 = s1.toArray(c1); String s2 = new String(f1(c1)); //System.out.println(">>"+s2); return RandomStringUtils.random(length, s2); }
From source file:calculators.Calculator.java
private LinkedList<Double> calculateValues(final String[] splitLine, final String control_group, final String target_group) { double controlTotal = 0.0; double targetTotal = 0.0; double[] targetList = new double[targetSize]; double[] controlList = new double[controlSize]; Double tempValue;/*from w ww .j a va 2s . c om*/ int index = 0; int controlIndex = 0; int targetIndex = 0; for (String group : groupMap.values()) { tempValue = (((Double.parseDouble(splitLine[index + 14]) / columnMeans.get(index))) * totalMean); if (group.equals(control_group)) { controlTotal += tempValue; controlList[controlIndex] = tempValue; controlIndex++; } else { targetTotal += tempValue; targetList[targetIndex] = tempValue; targetIndex++; } index++; } LinkedList<Double> list = new LinkedList<>(); list.add(calculateLogFC(controlTotal / controlSize, targetTotal / controlSize)); list.add(calculatePvalue(controlList, targetList)); return list; }
From source file:com.erudika.para.utils.Utils.java
/** * Returns a list of all declared fields in a class. Transient and serialVersionUID fields are skipped. * This method scans parent classes as well. * @param clazz a class to scan//from w ww .j a va 2s .c o m * @return a list of fields including those of the parent classes excluding the Object class. */ public static List<Field> getAllDeclaredFields(Class<? extends ParaObject> clazz) { LinkedList<Field> fields = new LinkedList<Field>(); if (clazz == null) { return fields; } Class<?> parent = clazz; do { for (Field field : parent.getDeclaredFields()) { if (!Modifier.isTransient(field.getModifiers()) && !field.getName().equals("serialVersionUID")) { fields.add(field); } } parent = parent.getSuperclass(); } while (!parent.equals(Object.class)); return fields; }
From source file:eu.project.ttc.resources.PrefixTree.java
private Queue<Character> toCharQueue(String line) { LinkedList<Character> characters = Lists.newLinkedList(); for (int i = 0; i < line.length(); i++) characters.add(line.charAt(i)); return characters; }
From source file:net.iubris.ipc_d3.cap.CamelizeSomeFieldsAndExtractInformazioniStoricheDates.java
private LinkedList<String> findNumbers(CharSequence line) { LinkedList<String> numbers = new LinkedList<String>(); Pattern p = Pattern.compile("\\d+"); Matcher m = p.matcher(line);//ww w. j a va2 s . co m while (m.find()) { numbers.add(m.group()); } return numbers; }