Java Examples for java.util.LinkedList
The following java examples will help you to understand the usage of java.util.LinkedList. These source code samples are taken from different open source projects.
Example 1
Project: gluster-ovirt-poc-master File: CommandParametersInitializer.java View source code |
public final void InitializeParameter(Object obj, Object value) { java.lang.Class type = obj.getClass(); java.util.LinkedList<String> values = null; if ((values = mParameters.get(value.getClass())) != null && values.size() != 0) { try { String paramName = values.poll(); java.lang.reflect.Field field = type.getField(paramName); if (field != null) { try { field.set(obj, value); } catch (Exception ex) { throw new RuntimeException(ex); } } } catch (Exception e) { throw new VdcException(e); } } }
Example 2
Project: vebugger-master File: LinkedListTemplate.java View source code |
@Override public void render(StringBuilder sb, Object obj) { LinkedList<?> list = (LinkedList<?>) obj; sb.append("<style>"); sb.append("table.java-util-LinkedList {border-collapse: collapse; font-size: 12px;}"); sb.append("table.java-util-LinkedList > * > tr > * {padding: 4px; text-align: center;}"); sb.append("table.java-util-LinkedList > thead > tr {border-bottom: 2px solid black;}"); sb.append("table.java-util-LinkedList > * > tr > *:first-child {border-right: 1px dotted gray;}"); sb.append("table.java-util-LinkedList > tbody > tr > th {color: gray; font-weight: normal;}"); sb.append("table.java-util-LinkedList > tbody > tr > td:last-child > div {border: 1px dotted silver; -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; display: inline-block; padding: 10px; text-align: initial;}"); sb.append("</style>"); if (list.size() > 0) { sb.append("<table class=\"java-util-LinkedList\"><thead><tr><th>Index</th><th>Value</th></tr></thead><tbody><tr><th></th><th>head</th></tr><tr><th></th><td>↑ ↓</td></tr>"); int i = 0; for (Object o : list) { sb.append("<tr><th>").append(i).append("</th><td><div>").append(VisualDebuggerAid.toString(o, false)).append("</div></td></tr>"); sb.append("<tr><th></th><td>↑ ↓</td></tr>"); i++; } sb.append("<tr><th></th><th>tail</th></tr></tbody></table>"); } else { sb.append("[] <span style=\"color: gray; font-style: italic;\">(empty LinkedList)</span>"); } }
Example 3
Project: rtgov-master File: SOAActivityTypeEventSplitter.java View source code |
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public Serializable process(String source, Serializable event, int retriesLeft) throws Exception { Serializable ret = null; if (event instanceof ActivityUnit) { ret = new java.util.LinkedList<Serializable>(); for (ActivityType at : ((ActivityUnit) event).getActivityTypes()) { if (at instanceof RPCActivityType) { ((java.util.LinkedList<Serializable>) ret).add((RPCActivityType) at); } } if (((java.util.LinkedList<Serializable>) ret).size() == 0) { ret = null; } else if (((java.util.LinkedList<Serializable>) ret).size() == 1) { ret = ((java.util.LinkedList<Serializable>) ret).getFirst(); } } return (ret); }
Example 4
Project: j2objc-master File: LinkedListTest.java View source code |
/** * @tests java.util.LinkedList#add(int, java.lang.Object) */ public void test_addILjava_lang_Object() { // Test for method void java.util.LinkedList.add(int, java.lang.Object) Object o; ll.add(50, o = "Test"); assertTrue("Failed to add Object>: " + ll.get(50).toString(), ll.get(50) == o); assertTrue("Failed to fix up list after insert", ll.get(51) == objArray[50] && (ll.get(52) == objArray[51])); ll.add(50, null); assertNull("Did not add null correctly", ll.get(50)); try { ll.add(-1, "Test"); fail("Should throw IndexOutOfBoundsException"); } catch (IndexOutOfBoundsException e) { } try { ll.add(-1, null); fail("Should throw IndexOutOfBoundsException"); } catch (IndexOutOfBoundsException e) { } try { ll.add(ll.size() + 1, "Test"); fail("Should throw IndexOutOfBoundsException"); } catch (IndexOutOfBoundsException e) { } try { ll.add(ll.size() + 1, null); fail("Should throw IndexOutOfBoundsException"); } catch (IndexOutOfBoundsException e) { } }
Example 5
Project: android-libcore64-master File: LinkedListTest.java View source code |
/** * java.util.LinkedList#add(int, java.lang.Object) */ public void test_addILjava_lang_Object() { // Test for method void java.util.LinkedList.add(int, java.lang.Object) Object o; ll.add(50, o = "Test"); assertTrue("Failed to add Object>: " + ll.get(50).toString(), ll.get(50) == o); assertTrue("Failed to fix up list after insert", ll.get(51) == objArray[50] && (ll.get(52) == objArray[51])); ll.add(50, null); assertNull("Did not add null correctly", ll.get(50)); }
Example 6
Project: android_platform_libcore-master File: LinkedListTest.java View source code |
/** * java.util.LinkedList#add(int, java.lang.Object) */ public void test_addILjava_lang_Object() { // Test for method void java.util.LinkedList.add(int, java.lang.Object) Object o; ll.add(50, o = "Test"); assertTrue("Failed to add Object>: " + ll.get(50).toString(), ll.get(50) == o); assertTrue("Failed to fix up list after insert", ll.get(51) == objArray[50] && (ll.get(52) == objArray[51])); ll.add(50, null); assertNull("Did not add null correctly", ll.get(50)); }
Example 7
Project: robovm-master File: LinkedListTest.java View source code |
/** * java.util.LinkedList#add(int, java.lang.Object) */ public void test_addILjava_lang_Object() { // Test for method void java.util.LinkedList.add(int, java.lang.Object) Object o; ll.add(50, o = "Test"); assertTrue("Failed to add Object>: " + ll.get(50).toString(), ll.get(50) == o); assertTrue("Failed to fix up list after insert", ll.get(51) == objArray[50] && (ll.get(52) == objArray[51])); ll.add(50, null); assertNull("Did not add null correctly", ll.get(50)); }
Example 8
Project: android-sdk-sources-for-api-level-23-master File: LinkedListTest.java View source code |
/** * java.util.LinkedList#add(int, java.lang.Object) */ public void test_addILjava_lang_Object() { // Test for method void java.util.LinkedList.add(int, java.lang.Object) Object o; ll.add(50, o = "Test"); assertTrue("Failed to add Object>: " + ll.get(50).toString(), ll.get(50) == o); assertTrue("Failed to fix up list after insert", ll.get(51) == objArray[50] && (ll.get(52) == objArray[51])); ll.add(50, null); assertNull("Did not add null correctly", ll.get(50)); try { ll.add(-1, "Test"); fail("Should throw IndexOutOfBoundsException"); } catch (IndexOutOfBoundsException e) { } try { ll.add(-1, null); fail("Should throw IndexOutOfBoundsException"); } catch (IndexOutOfBoundsException e) { } try { ll.add(ll.size() + 1, "Test"); fail("Should throw IndexOutOfBoundsException"); } catch (IndexOutOfBoundsException e) { } try { ll.add(ll.size() + 1, null); fail("Should throw IndexOutOfBoundsException"); } catch (IndexOutOfBoundsException e) { } }
Example 9
Project: ARTPart-master File: LinkedListTest.java View source code |
/** * java.util.LinkedList#add(int, java.lang.Object) */ public void test_addILjava_lang_Object() { // Test for method void java.util.LinkedList.add(int, java.lang.Object) Object o; ll.add(50, o = "Test"); assertTrue("Failed to add Object>: " + ll.get(50).toString(), ll.get(50) == o); assertTrue("Failed to fix up list after insert", ll.get(51) == objArray[50] && (ll.get(52) == objArray[51])); ll.add(50, null); assertNull("Did not add null correctly", ll.get(50)); try { ll.add(-1, "Test"); fail("Should throw IndexOutOfBoundsException"); } catch (IndexOutOfBoundsException e) { } try { ll.add(-1, null); fail("Should throw IndexOutOfBoundsException"); } catch (IndexOutOfBoundsException e) { } try { ll.add(ll.size() + 1, "Test"); fail("Should throw IndexOutOfBoundsException"); } catch (IndexOutOfBoundsException e) { } try { ll.add(ll.size() + 1, null); fail("Should throw IndexOutOfBoundsException"); } catch (IndexOutOfBoundsException e) { } }
Example 10
Project: betsy-master File: ShortIdsTests.java View source code |
@org.junit.Test public void testUniquenessOfShortIds() { List<String> shortIds = new LinkedList<>(); BPELProcessRepository processRepository = BPELProcessRepository.INSTANCE; List<Test> processed = processRepository.getByName("ALL"); for (Test process : processed) { shortIds.add(new BPELIdShortener(process.getName()).getShortenedId()); } for (String shortId : shortIds) { List<String> copyOfShortIds = new LinkedList<>(shortIds); copyOfShortIds.remove(shortId); copyOfShortIds.remove(shortId); Assert.assertEquals("ID " + shortId + " is used more than once", shortIds.size() - 1, copyOfShortIds.size()); } }
Example 11
Project: contra-master File: StatementsDemo.java View source code |
public static void main(String args[]) { Node firstMsg = new PrintNode(new NumberNode(1), "newline"); Node secondMsg = new PrintNode(new NumberNode(2), "newline"); Node wait = new WaitNode(new NumberNode(new Integer(2000))); List<Node> script = new LinkedList<Node>(); script.add(firstMsg); script.add(wait); script.add(secondMsg); for (Node statement : script) statement.eval(); }
Example 12
Project: hudson_plugins-master File: Utils.java View source code |
public static List<Integer> csvToIntList(String execDefIds) { List<Integer> list = new LinkedList<Integer>(); if (execDefIds.contains(",")) { //$NON-NLS-1$ //$NON-NLS-1$ String[] ids = execDefIds.split(","); for (String str : ids) { list.add(Integer.valueOf(str)); } } else { list.add(Integer.valueOf(execDefIds)); } return list; }
Example 13
Project: kilim-master File: TestClassInfo.java View source code |
public void testContains() throws Exception { List<ClassInfo> classInfoList = new LinkedList<ClassInfo>(); ClassInfo classOne = new ClassInfo("kilim/S_01.class", "whocares".getBytes("UTF-8")); classInfoList.add(classOne); ClassInfo classTwo = new ClassInfo("kilim/S_01.class", "whocares".getBytes("UTF-8")); assertTrue(classInfoList.contains(classTwo)); }
Example 14
Project: KPComputers-master File: ArgsParser.java View source code |
public static String[] parse(String str) { List<String> args = new LinkedList<>(); boolean paren = false; String s = ""; for (char c : str.toCharArray()) { if (c == '\"') { if (paren) { args.add(s); paren = false; } else { s = ""; paren = true; } } else { s += c; } } return args.toArray(new String[args.size()]); }
Example 15
Project: uli-mini-tools-master File: TextMessageFormatter.java View source code |
@Override public List<String> format(byte[] message) { String rawText = new String(message, Charset.defaultCharset()); String[] splittedText = rawText.split("\\n"); List<String> formatted = new LinkedList<String>(); for (String l : splittedText) { l = l.replaceAll("\\r", "[CR]"); l += "[LF]"; formatted.add(l); } return formatted; }
Example 16
Project: acra-master File: BoundedLinkedList.java View source code |
/* * (non-Javadoc) * * @see java.util.LinkedList#addAll(java.util.Collection) */ @Override public boolean addAll(@NonNull Collection<? extends E> collection) { final int size = collection.size(); if (size > maxSize) { final LinkedList<? extends E> list = new LinkedList<E>(collection); for (int i = 0; i < size - maxSize; i++) { list.removeFirst(); } collection = list; } final int totalNeededSize = size() + collection.size(); final int overhead = totalNeededSize - maxSize; if (overhead > 0) { removeRange(0, overhead); } return super.addAll(collection); }
Example 17
Project: kraken-master File: ObjectAdapterFactory.java View source code |
public void shutdown() { java.util.List<Ice.ObjectAdapterI> adapters; synchronized (this) { // if (_instance == null) { return; } _instance = null; _communicator = null; adapters = new java.util.LinkedList<Ice.ObjectAdapterI>(_adapters); notifyAll(); } // for (Ice.ObjectAdapterI adapter : adapters) { adapter.deactivate(); } }
Example 18
Project: android_libcore-master File: LinkedListTest.java View source code |
/** * @tests java.util.LinkedList#add(int, java.lang.Object) */ @TestTargetNew(level = TestLevel.COMPLETE, notes = "", method = "add", args = { int.class, java.lang.Object.class }) public void test_addILjava_lang_Object() { // Test for method void java.util.LinkedList.add(int, java.lang.Object) Object o; ll.add(50, o = "Test"); assertTrue("Failed to add Object>: " + ll.get(50).toString(), ll.get(50) == o); assertTrue("Failed to fix up list after insert", ll.get(51) == objArray[50] && (ll.get(52) == objArray[51])); ll.add(50, null); assertNull("Did not add null correctly", ll.get(50)); }
Example 19
Project: sosies-generator-master File: QueueUtilsTest.java View source code |
@org.junit.Test(timeout = 1000) public void testUnmodifiableQueue() { fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(), this, "testUnmodifiableQueue"); Queue<java.lang.Object> queue = org.apache.commons.collections4.QueueUtils.unmodifiableQueue(new java.util.LinkedList<java.lang.Object>()); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 8161, (queue instanceof org.apache.commons.collections4.queue.UnmodifiableQueue)); try { org.apache.commons.collections4.QueueUtils.unmodifiableQueue(null); org.apache.commons.collections4.QueueUtils.unmodifiableQueue(null); } catch (final IllegalArgumentException ex) { } fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 8162, queue); fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 8164, null, 8163, org.apache.commons.collections4.QueueUtils.unmodifiableQueue(queue)); fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread()); }
Example 20
Project: sglj-master File: LinkedListTest.java View source code |
static void checkConcatenation(LinkedList<Integer> l1, LinkedList<Integer> l2) { System.out.println("----------"); int size1 = l1.size; int size2 = l2.size; java.util.LinkedList<Integer> expected = new java.util.LinkedList<Integer>(l1); expected.addAll(l2); System.out.println(l1); System.out.println("+"); System.out.println(l2); System.out.println("="); l1.concatenate(l2); System.out.println(l1); Assert.assertEquals(size1 + size2, l1.size()); Assert.assertTrue(l2.isEmpty()); Assert.assertEquals(l2.size(), 0); for (int i = 0; i < expected.size(); ++i) Assert.assertEquals(expected.get(i), l1.get(i)); }
Example 21
Project: 99-problems-master File: Problem3_2.java View source code |
public <T> List<T> reverse(List<T> list) { /* Algorithm: 1. Maintain a stack 2. Iterate over all the elements in a list and put that on the stack 3. Then empty the stack into a new LinkedList */ Stack<T> stack = new Stack<>(); list.forEach(stack::push); List<T> reversed = new LinkedList<>(); while (!stack.isEmpty()) { reversed.add(stack.pop()); } return reversed; }
Example 22
Project: AccModels-master File: DAO.java View source code |
public static boolean saveData(LinkedList<String> message, String fileName) { String route = Environment.getExternalStorageDirectory().getAbsolutePath() + "/AccModels/" + fileName; try { File file = new File(route); PrintWriter pw = new PrintWriter(file); for (String s : message) { pw.append(s); pw.append("\n"); } pw.close(); return true; } catch (FileNotFoundException e) { return false; } }
Example 23
Project: algorithmic-programming-master File: PreorderIterative.java View source code |
public List<Integer> preorder(Node<Integer> root) { List<Integer> result = new LinkedList<>(); Deque<Node<Integer>> deque = new LinkedList<>(); add(deque, root); while (!deque.isEmpty()) { Node<Integer> node = deque.pollFirst(); result.add(node.getData()); add(deque, node.getRight()); add(deque, node.getLeft()); } return result; }
Example 24
Project: android-lite-orm-master File: TestSpliter.java View source code |
public static void main(String[] args) throws Exception { Collection coll = new LinkedList(); for (int i = 0; i < 9; i++) { coll.add("a " + i); } CollSpliter.split(coll, 3, new CollSpliter.Spliter() { @Override public int oneSplit(ArrayList list) throws Exception { System.out.println("------- " + list.size()); for (Object o : list) { System.out.println(o); } return 0; } }); }
Example 25
Project: bergamot-master File: MergeListUnique.java View source code |
public List<T> resolve(List<T> m, List<T> l) { List<T> r = new LinkedList<T>(); if (m != null) { for (T e : m) { if (!r.contains(e)) r.add(e); } } if (l != null) { for (T e : l) { if (!r.contains(e)) r.add(e); } } return r; }
Example 26
Project: calibre2opds-master File: FilterHelper.java View source code |
public static List<Book> filter(BookFilter filter, List<Book> books) { assert filter != null && books != null : "Program Error: invalid parameter"; List<Book> result = new LinkedList<Book>(); if (books != null) { for (Book book : books) { if (filter.didBookPassThroughFilter(book)) { result.add(book); } } } return result; }
Example 27
Project: CtCI-6th-Edition-master File: Tester.java View source code |
public static void main(String[] args) { String[] words = { "maps", "tan", "tree", "apple", "cans", "help", "aped", "pree", "pret", "apes", "flat", "trap", "fret", "trip", "trie", "frat", "fril" }; LinkedList<String> listA = QuestionA.transform("tree", "flat", words); LinkedList<String> listB = QuestionB.transform("tree", "flat", words); LinkedList<String> listC = QuestionC.transform("tree", "flat", words); printList(listA); printList(listB); printList(listC); }
Example 28
Project: DoSeR-master File: UndirectedWeightedShotGraph.java View source code |
public List<Node<T>> getNodeList(List<T> lst) { List<Node<T>> result = new LinkedList<Node<T>>(); for (T t2 : lst) { T t = t2; for (int i = 0; i < nodeLst.size(); i++) { if (t.compareTo(nodeLst.get(i).getData()) == 0) { result.add(nodeLst.get(i)); } } } return result; }
Example 29
Project: frostwire-common-master File: PerformerResultListener.java View source code |
@Override public void onResults(SearchPerformer performer, List<? extends SearchResult> results) { List<SearchResult> list = new LinkedList<SearchResult>(); for (SearchResult sr : results) { if (sr instanceof CrawlableSearchResult) { CrawlableSearchResult csr = (CrawlableSearchResult) sr; if (csr.isComplete()) { list.add(sr); } manager.crawl(performer, csr); } else { list.add(sr); } } if (!list.isEmpty()) { manager.onResults(performer, list); } }
Example 30
Project: guj.com.br-master File: AllBookmarkableToCompatibleConverters.java View source code |
public static List<URIConverter> get(String uri) { List<URIConverter> converters = new LinkedList<URIConverter>(); converters.add(new BookmarkableShortPostToCompatibleURIConverter(uri, new DefaultCompatibleURIBuilder())); converters.add(new BookmarkablePostToCompatibleURIConverter(uri, new DefaultCompatibleURIBuilder())); converters.add(new BookmarkablePrePostToCompatibleURIConverter(uri, new DefaultCompatibleURIBuilder())); return converters; }
Example 31
Project: hplookball-master File: NewsResp.java View source code |
@Override public void paser(JSONObject json) throws Exception { json = json.optJSONObject("result"); JSONArray array = json.optJSONArray("data"); if (array != null) { int size = array.length(); mList = new LinkedList<NewsEntity>(); NewsEntity temp; for (int i = 0; i < size; i++) { temp = new NewsEntity(); temp.paser(array.getJSONObject(i)); mList.add(temp); if (i == size - 1) lastNId = temp.nid; } } nextDataExists = json.optInt("nextDataExists"); }
Example 32
Project: jade4j-master File: AssignmentParserTest.java View source code |
@Test public void shouldReturnTagsWithTexts() { loadInParser("assignment.jade"); block = (BlockNode) root; LinkedList<Node> nodes = block.getNodes(); assertEquals(2, nodes.size()); ExpressionNode assignment = (ExpressionNode) block.getNodes().get(0); assertEquals("var hello = \"world\"", assignment.getValue()); TagNode tag = (TagNode) block.getNodes().get(1); assertNotNull(tag); }
Example 33
Project: jaxb-xew-plugin-master File: XmlElementWrapperPluginSpecificTest.java View source code |
/** * This test unfortunately does not run on Java8. */ @Test public void testDifferentNamespacesForWrapperAndElement() throws Exception { // Plural form in this case will have no impact as all properties are already in plural: assertXsd("different-namespaces", new String[] { "-Xxew:collection", "java.util.LinkedList", "-Xxew:instantiate", "lazy", "-Xxew:plural" }, false, "BaseContainer", "Container", "Entry", "package-info"); }
Example 34
Project: jaxb2-commons-master File: CommaDelimitedStringAdapter.java View source code |
@Override public List<String> unmarshal(String text) throws Exception { if (text == null) { return null; } else { final List<String> value = new LinkedList<String>(); final String[] items = StringUtils.split(text, ','); for (String item : items) { final String trimmedItem = item.trim(); if (!StringUtils.isEmpty(trimmedItem)) { value.add(trimmedItem); } } return value; } }
Example 35
Project: katharsis-core-master File: StringUtils.java View source code |
public static String join(String delimiter, Iterable<String> stringsIterable) { List<String> strings = new LinkedList<>(); Iterator<String> iterator = stringsIterable.iterator(); while (iterator.hasNext()) { strings.add(iterator.next()); } StringBuilder ab = new StringBuilder(); for (int i = 0; i < strings.size(); i++) { ab.append(strings.get(i)); if (i != strings.size() - 1) { ab.append(delimiter); } } return ab.toString(); }
Example 36
Project: librato-java-master File: Lists.java View source code |
public static <T> List<List<T>> partition(List<T> items, int maxSize) { List<List<T>> result = new LinkedList<List<T>>(); List<T> thisList = new LinkedList<T>(); for (T item : items) { thisList.add(item); if (thisList.size() >= maxSize) { result.add(thisList); thisList = new LinkedList<T>(); } } if (!thisList.isEmpty()) { result.add(thisList); } return result; }
Example 37
Project: like_netease_news-master File: WeatherTestCase.java View source code |
public void testGetWeatherJson() throws IOException, Exception { WeatherService service = new WeatherService(); String json = service.getWeatherJson("180802"); System.out.println("json = " + json); LinkedList<Weather> data = JsonUtils.handleWeatherJson(json); if (null != data) { for (Weather weather : data) { System.out.println(weather); } } }
Example 38
Project: mockneat-master File: ComplexStructure.java View source code |
public static void main(String[] args) { MockNeat m = MockNeat.threadLocal(); Map<String, List<Map<Set<Integer>, List<Integer>>>> result = m.ints().list(// List<Integer> 2).mapKeys(// Map<Set<Integer>, List<Integer>> 2, m.ints().set(3)::val).list(// List<Map<Set<Integer>, List<Integer>>> LinkedList.class, 2).mapKeys(// Map<String, List<Map<Set<Integer>, List<Integer>>>> 4, m.strings()::val).val(); }
Example 39
Project: mp4parser-master File: ProgressiveDownloadInformationBoxTest.java View source code |
@Override public void setupProperties(Map<String, Object> addPropsHere, ProgressiveDownloadInformationBox box) { List<ProgressiveDownloadInformationBox.Entry> entries = new LinkedList<ProgressiveDownloadInformationBox.Entry>(); entries.add(new ProgressiveDownloadInformationBox.Entry(10, 20)); entries.add(new ProgressiveDownloadInformationBox.Entry(20, 10)); addPropsHere.put("entries", entries); }
Example 40
Project: MPS-master File: Main_javaIterable_as_sequence.java View source code |
/*package*/ static void main(String[] args) { Iterable<Integer> javaIterable = new LinkedList<Integer>(); for (int i = 0; i < 5; i++) { ((List<Integer>) javaIterable).add(i); } System.out.println("java-iterable as sequence"); Iterable<Integer> sequence = javaIterable; for (Integer n : Sequence.fromIterable(sequence)) { System.out.println(n); } }
Example 41
Project: mybatis-master File: ObjectFactory.java View source code |
@Override protected Class<?> resolveInterface(Class<?> type) { Class<?> classToCreate; if (type == Map.class) { classToCreate = LinkedHashMap.class; } else if (type == List.class || type == Collection.class) { classToCreate = LinkedList.class; } else { classToCreate = super.resolveInterface(type); } return classToCreate; }
Example 42
Project: mysaml-master File: TimerService.java View source code |
/** * @param args */ public static void main(String[] args) { Endpoint endpoint = Endpoint.create(new TimerImpl()); Binding binding = endpoint.getBinding(); @SuppressWarnings("rawtypes") List<Handler> handlerChain = new LinkedList<Handler>(); handlerChain.add(new SamlAuthenticationHandler()); binding.setHandlerChain(handlerChain); endpoint.publish("http://localhost:1234/timer"); }
Example 43
Project: OpenJML-master File: Bug1.java View source code |
public static void main(String... args) { LinkedList<?>[] a = new LinkedList<?>[1]; a[0] = new LinkedList<Boolean>(); //int k = 0; Object o = new Object(); // @ ghost \TYPE t = \elemtype(\typeof(a)); // @ assert (\lbl TY t) == \type(LinkedList<Object>); // @ assert (\lbl TY2 \typeof(k)) == \type(int); // @ set t = (\lbl TY3 \elemtype(\typeof(k))); // @ set t = (\lbl TY4 \elemtype(\typeof(o))); System.out.println("END"); }
Example 44
Project: overture-master File: ContextHelper.java View source code |
public static List<PMultipleBind> bindListFromPattern(PPattern pattern, PType type) { List<PMultipleBind> bindList = new LinkedList<PMultipleBind>(); ATypeMultipleBind tmBind = new ATypeMultipleBind(); List<PPattern> plist = new LinkedList<PPattern>(); plist.add(pattern.clone()); tmBind.setPlist(plist); tmBind.setType(type.clone()); bindList.add(tmBind); return bindList; }
Example 45
Project: Slithice-master File: SDG5.java View source code |
static void useList() { List<Integer> list = new LinkedList<Integer>(); Integer x = new Integer(1); Integer y = new Integer(2); list.add(x); list.add(y); int z = list.size(); z++; Integer p = list.iterator().next(); p.toString(); for (Integer s : list) { int a = s.intValue(); z += a; } }
Example 46
Project: Stage-master File: ConfigurationOptionProvider.java View source code |
public List<ConfigurationOption<?>> getConfigurationOptions() { List<ConfigurationOption<?>> configurationOptions = new LinkedList<ConfigurationOption<?>>(); for (Field field : getClass().getDeclaredFields()) { if (field.getType() == ConfigurationOption.class) { field.setAccessible(true); try { configurationOptions.add((ConfigurationOption) field.get(this)); } catch (IllegalAccessException e) { logger.warn(e.getMessage(), e); } } } return configurationOptions; }
Example 47
Project: stagemonitor-master File: ConfigurationOptionProvider.java View source code |
public List<ConfigurationOption<?>> getConfigurationOptions() { List<ConfigurationOption<?>> configurationOptions = new LinkedList<ConfigurationOption<?>>(); for (Field field : getClass().getDeclaredFields()) { if (field.getType() == ConfigurationOption.class) { field.setAccessible(true); try { configurationOptions.add((ConfigurationOption) field.get(this)); } catch (IllegalAccessException e) { logger.warn(e.getMessage(), e); } } } return configurationOptions; }
Example 48
Project: EnterpriseGym-master File: EventsModel.java View source code |
public java.util.LinkedList<EventsModel> getHomeEvents() throws ClassNotFoundException, InstantiationException, IllegalAccessException, SQLException { java.util.LinkedList<EventsModel> tr = new java.util.LinkedList<>(); Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection(url, user, password); CallableStatement cs = null; //(?,?)}" cs = this.con.prepareCall("{call upcoming_events()}"); //cs.setString(1, "Tom"); //cs.setInt(1,urlNewsID); ResultSet rs = cs.executeQuery(); while (rs.next()) { int id = rs.getInt("idActivities"); String Title = rs.getString("Title"); String Body = rs.getString("Body"); String Trainer = rs.getString("Users_Username"); //java.util.Date dt = rs.getDate("DatePublished"); //String Date = dt.toString(); int Points = rs.getInt("Points"); EventsModel events_model = new EventsModel(id, Title, Body, Trainer, Points); tr.add(events_model); } cs.close(); con.close(); return tr; }
Example 49
Project: intellij-community-master File: CollectionUtil.java View source code |
@Nullable public static PsiClassType createSimilarCollection(@Nullable PsiType collection, Project project, PsiType... itemType) { if (InheritanceUtil.isInheritor(collection, "java.util.SortedSet")) { return createCollection(project, "java.util.SortedSet", itemType); } if (InheritanceUtil.isInheritor(collection, "java.util.LinkedHashSet")) { return createCollection(project, "java.util.LinkedHashSet", itemType); } if (InheritanceUtil.isInheritor(collection, CommonClassNames.JAVA_UTIL_SET)) { return createCollection(project, "java.util.HashSet", itemType); } if (InheritanceUtil.isInheritor(collection, "java.util.LinkedList")) { return createCollection(project, "java.util.LInkedList", itemType); } if (InheritanceUtil.isInheritor(collection, "java.util.Stack")) { return createCollection(project, "java.util.Stack", itemType); } if (InheritanceUtil.isInheritor(collection, "java.util.Vector")) { return createCollection(project, "java.util.Vector", itemType); } if (InheritanceUtil.isInheritor(collection, CommonClassNames.JAVA_UTIL_LIST)) { return createCollection(project, "java.util.ArrayList", itemType); } if (InheritanceUtil.isInheritor(collection, "java.util.Queue")) { return createCollection(project, "java.util.LinkedList", itemType); } return createCollection(project, "java.util.ArrayList", itemType); }
Example 50
Project: 101simplejava-master File: Cut.java View source code |
/** * Cut using JXPath to modify salaries. Method demonstrate JXPath ability to * alter values. * * @param c * Company to cut salaries */ @SuppressWarnings("unchecked") public static void cut(Company c) { JXPathContext con = JXPathContext.newContext(c); LinkedList<Employee> es = new LinkedList<Employee>(); es.addAll(con.selectNodes("//employees | //manager")); con = JXPathContext.newContext(es); for (int i = 1; i <= es.size(); i++) { con.setValue("@salary[" + i + "]", (Double) con.getValue("@salary[" + i + "]") / 2); } }
Example 51
Project: Acuitra-master File: SlowTestStage.java View source code |
@Override public void execute() { LinkedList<Integer> list = getCtx().getInput(); list.add(getStageCount()); try { // initilize output getCtx().addOutput(this.getKeyName(), this.getOutput()); Thread.sleep(pauseTimeMillis); output = "COMPLETE: " + super.getOutput(); } catch (InterruptedException e) { e.printStackTrace(); } }
Example 52
Project: adaptive-restful-api-master File: ApplicationContextTest.java View source code |
@Test public void testInitializeValid() throws Exception { Model model = new Model("model", new LinkedList<Entity>()); Configuration conf = new Pack(); ApplicationContext.initialize(model, conf); ApplicationContext context = ApplicationContext.getInstance(); assert (context.isInitialized() == true) : "Application context should be initialized."; }
Example 53
Project: Advanced-Logon-Editor-master File: FileReader.java View source code |
protected static List<String> readFile(Path file) { assert FileUtil.control(file); List<String> sb = new LinkedList<>(); String line = null; Charset charset = Charset.defaultCharset(); try (BufferedReader reader = Files.newBufferedReader(file, charset)) { while ((line = reader.readLine()) != null) { sb.add(line); } reader.close(); } catch (IOException e) { return null; } return sb; }
Example 54
Project: aMatch-master File: CareerCupAPI.java View source code |
public LinkedList<Question> loadRecentQuestions(String page, String company, String job, String topic) throws IOException { String[] filters = new String[] { page, company, topic, job }; questionURL = new QuestionUrlParser(filters); questionSearch = new QuestionSearch(questionURL); Question[] questionList = questionSearch.loadRecentQuestions(); return new LinkedList(Arrays.asList(questionList)); }
Example 55
Project: apipixie-master File: TypeUtil.java View source code |
private static List<Class<?>> getClasses() { List<Class<?>> classes = new LinkedList<>(); classes.add(String.class); classes.add(Float.class); classes.add(Long.class); classes.add(Integer.class); classes.add(Double.class); classes.add(Character.class); classes.add(Boolean.class); classes.add(Short.class); classes.add(Byte.class); return classes; }
Example 56
Project: Asteroid-Push-master File: Component.java View source code |
public Collection<Representation> getRepresentations() { Collection<Representation> representations = new LinkedList<Representation>(); for (Plug plug : plugs) { BehaviorFactory factory = plug.getFactory(); assert factory != null; if (factory.getRepresentations() != null) { representations.addAll(factory.getRepresentations()); } } return representations; }
Example 57
Project: atom-nuke-master File: BindingEnvironmentManagerImpl.java View source code |
@Override public List<BindingEnvironment> newEnviornment(ResourceManager resourceManager) { final List<BindingEnvironment> bindingContexts = new LinkedList<BindingEnvironment>(); bindingContexts.add(new JavaBindingEnvironment(rootClassloader, resourceManager)); bindingContexts.add(new JythonBindingEnvironment()); bindingContexts.add(RhinoInterpreterContext.newInstance()); return bindingContexts; }
Example 58
Project: Auto-Dagger2-master File: AnnotationProcessor.java View source code |
@Override protected LinkedList<AbstractProcessing> processings() { LinkedList<AbstractProcessing> processings = new LinkedList<>(); processings.add(new AdditionProcessing(elements, types, errors, state)); processings.add(new SubcomponentProcessing(elements, types, errors, state)); processings.add(new ComponentProcessing(elements, types, errors, state)); return processings; }
Example 59
Project: batfish-master File: Main.java View source code |
public static void main(String[] args) { // Uncomment these lines when you want things to be captured by fiddler // System.setProperty("http.proxyHost", "127.0.0.1"); // System.setProperty("https.proxyHost", "127.0.0.1"); // System.setProperty("http.proxyPort", "8888"); // System.setProperty("https.proxyPort", "8888"); Settings _settings = null; try { _settings = new Settings(args); } catch (Exception e) { System.err.println(Main.class.getName() + ": Initialization failed:\n"); System.err.print(ExceptionUtils.getFullStackTrace(e)); System.exit(1); } Client client = new Client(_settings); client.run(new LinkedList<String>()); }
Example 60
Project: blueprint-namespaces-master File: LinkedListHandlerActivator.java View source code |
public void start(BundleContext context) throws Exception { CollectionNSHandler nshandler = new CollectionNSHandler(LinkedList.class); Hashtable<String, Object> props = new Hashtable<String, Object>(); props.put("osgi.service.blueprint.namespace", "http://aries.apache.org/ns/test/list"); props.put("version", context.getBundle().getVersion()); context.registerService(NamespaceHandler.class, nshandler, props); }
Example 61
Project: BoxMeBackend-master File: DirectoryListing.java View source code |
public void insertPrefix(String prefix) { List<String> newFiles = new LinkedList<String>(); List<String> newDirs = new LinkedList<String>(); for (String file : files) { newFiles.add(prefix + file); } for (String dir : directories) { newDirs.add(prefix + dir); } this.directories = newDirs; this.files = newFiles; }
Example 62
Project: BuildCraft-master File: TileTestPathfinding.java View source code |
@Override public void updateEntity() { if (worldObj.isRemote) { return; } if (!initialized) { initialized = true; if (firstEntity == null) { firstEntity = this; } else { PathFinding p = new PathFinding(worldObj, new BlockIndex(xCoord, yCoord, zCoord), new BlockIndex(firstEntity.xCoord, firstEntity.yCoord, firstEntity.zCoord)); p.iterate(10000); LinkedList<BlockIndex> r = p.getResult(); for (BlockIndex b : r) { worldObj.setBlock(b.x, b.y, b.z, Blocks.sponge); } firstEntity = null; } } }
Example 63
Project: bundlemaker-master File: StageSubMenu.java View source code |
@Override protected IContributionItem[] getContributionItems() { List<IContributionItem> contributionItems = new LinkedList<IContributionItem>(); _addModeActionGroup.update(); _addModeActionGroup.fill(contributionItems); contributionItems.add(new Separator()); _manipulateStageActionGroup.fill(contributionItems); return contributionItems.toArray(new IContributionItem[0]); }
Example 64
Project: BW4T-master File: SequenceProcessor.java View source code |
@Override public void process(List<Parameter> parameters, ClientMapController clientMapController) { List<BlockColor> sequence = new LinkedList<>(); for (Parameter i : parameters) { ParameterList list = (ParameterList) i; for (Parameter j : list) { char letter = ((Identifier) j).getValue().charAt(0); sequence.add(BlockColor.toAvailableColor(letter)); } } clientMapController.setSequence(sequence); }
Example 65
Project: cfnassist-master File: TestInstanceSummary.java View source code |
@Test public void testShouldSummariseTags() { List<Tag> tags = new LinkedList<>(); tags.add(EnvironmentSetupForTests.createEc2Tag("tag1", "valueA")); tags.add(EnvironmentSetupForTests.createEc2Tag("tag2", "valueB")); tags.add(EnvironmentSetupForTests.createEc2Tag("tag3", "valueC")); InstanceSummary summary = new InstanceSummary("id", "10.0.0.99", tags); String results = summary.getTags(); assertEquals("tag1=valueA,tag2=valueB,tag3=valueC", results); }
Example 66
Project: checker-framework-master File: Simple.java View source code |
void test() { // valid @Encrypted String s = encrypt("foo"); // valid sendOverTheInternet(s); // valid (subtype) String t = encrypt("bar"); // valid (flow) sendOverTheInternet(t); List<@Encrypted String> lst = new LinkedList<@Encrypted String>(); lst.add(s); lst.add(t); for (@Encrypted String str : lst) { sendOverTheInternet(str); } // for (String str : lst) // sendOverTheInternet(str); // should be valid! }
Example 67
Project: cistern-master File: SimpleAligner.java View source code |
@Override public List<Integer> align(String input, String output) { List<Integer> positions = new LinkedList<>(); int length = Math.min(input.length(), output.length()); int index = 0; while (index < length - 1) { if (input.charAt(index) == output.charAt(index)) { positions.add(1); positions.add(1); } else { break; } index++; } positions.add(input.length() - index); positions.add(output.length() - index); return positions; }
Example 68
Project: ClayGen-master File: ClayUpdate.java View source code |
@SuppressWarnings("unchecked") @Override public synchronized void run() { try { if (plugin.doneblocks.size() > 0) { LinkedList<Block> theblocks = (LinkedList<Block>) plugin.doneblocks.clone(); for (Block theblock : theblocks) { theblock.setType(Material.CLAY); plugin.doneblocks.remove(theblock); } } } catch (ConcurrentModificationException e) { System.out.println("[ClayGen] Uhoh, this should never happen, please tell Tux2 that you met with an concurrent modification exception!"); } }
Example 69
Project: completely-master File: DiacriticsTransformer.java View source code |
@Override public Collection<String> apply(Collection<String> input) { checkPointer(input != null); List<String> result = new LinkedList<>(); for (String text : input) { checkPointer(text != null); StringBuilder builder = new StringBuilder(); String canonical = Normalizer.normalize(text, Normalizer.Form.NFD); for (int i = 0; i < canonical.length(); ++i) { if (Character.getType(canonical.charAt(i)) != Character.NON_SPACING_MARK) { builder.append(canonical.charAt(i)); } } result.add(builder.toString()); } return result; }
Example 70
Project: Composer-Java-Bindings-master File: SearchResult.java View source code |
@SuppressWarnings("rawtypes") public void fromJson(Object obj) { if (obj instanceof LinkedHashMap) { LinkedHashMap json = (LinkedHashMap) obj; next = (String) json.get("next"); total = json.get("total").toString(); results = new LinkedList<MinimalPackage>(); Object r = json.get("results"); if (r instanceof LinkedList) { for (Object p : (LinkedList) r) { results.add(new MinimalPackage(p)); } } } }
Example 71
Project: craft-master File: TileTestPathfinding.java View source code |
@Override public void updateEntity() { if (worldObj.isRemote) { return; } if (!initialized) { initialized = true; if (firstEntity == null) { firstEntity = this; } else { PathFinding p = new PathFinding(worldObj, new BlockIndex(xCoord, yCoord, zCoord), new BlockIndex(firstEntity.xCoord, firstEntity.yCoord, firstEntity.zCoord)); p.iterate(10000); LinkedList<BlockIndex> r = p.getResult(); for (BlockIndex b : r) { worldObj.setBlock(b.x, b.y, b.z, Blocks.sponge); } firstEntity = null; } } }
Example 72
Project: csu-code-analysis-master File: JCVariableDeclHandler.java View source code |
@Override protected void execute(JCTree node) { JCVariableDecl decl = JCVariableDecl.class.cast(node); walker.handle(decl.name, "nodename.name"); walker.handle(decl.mods, "nodename.modifiers"); List<JCTree> varTypeList = new LinkedList<JCTree>(); if (decl.vartype != null) varTypeList.add(decl.vartype); walker.handle(varTypeList, "vartype"); List<JCTree> initList = new LinkedList<JCTree>(); if (decl.init != null) initList.add(decl.init); walker.handle(initList, "init"); }
Example 73
Project: cxfemn-master File: TestGetListInterface.java View source code |
public static void main(String[] args) { List<Object> filtres = new LinkedList<>(); filtres.add(new LiftingInterceptor()); Service service = JAXRSClientFactory.create("http://localhost:8080/LiftingAlgorithm", Service.class, filtres); List<Personne> l = service.getPersonnesInt(); for (int i = 0, k = l.size(); i < k; i++) { Personne courant = l.get(i); System.out.println(UniformementRepresentable.toString(new StringBuilder(), courant)); } }
Example 74
Project: DeveloperDay-master File: Ex01Connect.java View source code |
public static void main(String[] args) { System.out.println("--------------------------------------------------------------------------"); System.out.println("\tCouchbase Simple Connection"); System.out.println("--------------------------------------------------------------------------"); List<URI> uris = new LinkedList<URI>(); uris.add(URI.create("http://127.0.0.1:8091/pools")); CouchbaseClient cb = null; try { cb = new CouchbaseClient(uris, "default", ""); System.out.println(cb.getStats()); cb.shutdown(10, TimeUnit.SECONDS); } catch (Exception e) { System.err.println("Error connecting to Couchbase: " + e.getMessage()); } }
Example 75
Project: Edge-Node-master File: EdgeNodeWithCouchDB.java View source code |
private static void testIFM() { String configXMLfieldPath = "src/IFM/configurationIFM.xml"; XMLConfiguration configuration = XMLConfiguration.instance(configXMLfieldPath); AlchemyEngineInterface alchemy = new AlchemyEngine(configuration.ALCHEMY_DB, configuration.ALCHEMY_PATTERNS, configuration.ALCHEMY_RESULTS, configuration.ALCHEMY_PATH); List<String> listOfServers = new LinkedList<String>(); listOfServers.add(configuration.URLGet_CouchDB); CouchDBClient client = new CouchDBClient(alchemy, listOfServers, configuration.URLPost_CouchDB, configuration.REQUEST_PERIOD); client.run(); }
Example 76
Project: EMExperiments-master File: GeneratingPipeTask.java View source code |
@Override public void process() { BlockingQueue<Particle> processedParticles = DefaultStorageEngine.getStorageEngine().getQueue(processedQueueName); Collection<Particle> generated = new LinkedList<Particle>(); generated.add(target); for (ParticleGenerator stage : stages) { generated = stage.generate(generated); } processedParticles.addAll(generated); outputCount = generated.size(); }
Example 77
Project: EnderIO-master File: TriggerProviderEIO.java View source code |
@Override public LinkedList<ITrigger> getNeighborTriggers(Block block, TileEntity tile) { if (tile instanceof IOverrideDefaultTriggers) { return ((IOverrideDefaultTriggers) tile).getTriggers(); } LinkedList<ITrigger> triggers = new LinkedList<ITrigger>(); if (tile instanceof TileCapacitorBank) { triggers.add(EnderIO.triggerNoEnergy); triggers.add(EnderIO.triggerHasEnergy); triggers.add(EnderIO.triggerFullEnergy); triggers.add(EnderIO.triggerIsCharging); triggers.add(EnderIO.triggerFinishedCharging); } return triggers; }
Example 78
Project: fb-contrib-master File: ITC_Sample.java View source code |
public String testOthers(List<String> l) { if (l instanceof ArrayList) return (String) ((ArrayList) l).remove(0); else if (l instanceof LinkedList) return (String) ((LinkedList) l).removeFirst(); else if (l instanceof Vector) return (String) ((Vector) l).remove(0); else return null; }
Example 79
Project: Finches-2011-master File: GestureProgram.java View source code |
public GestureCommand getNextCommand() { if (commandListClone == null) { commandListClone = new LinkedList<GestureCommand>(commandList); } if (commandListClone.peek() == null) { //program is over, clear the clone list //allowing for subsequent execution //and return a stop command commandListClone = null; return new GestureCommand.StopCommand(); } else { return commandListClone.poll(); } }
Example 80
Project: floobits-intellij-master File: SelectRecentWorkspace.java View source code |
public static void joinRecent(Project project) { PersistentJson persistentJson = PersistentJson.getInstance(); LinkedList<String> recent = new LinkedList<String>(); for (Workspace workspace : persistentJson.recent_workspaces) { recent.add(workspace.url); } floobits.dialogs.SelectRecentWorkspace selectRecentWorkspace = new floobits.dialogs.SelectRecentWorkspace(project, recent); selectRecentWorkspace.createCenterPanel(); selectRecentWorkspace.show(); }
Example 81
Project: forge-master File: TileTestPathfinding.java View source code |
@Override public void updateEntity() { if (worldObj.isRemote) { return; } if (!initialized) { initialized = true; if (firstEntity == null) { firstEntity = this; } else { PathFinding p = new PathFinding(worldObj, new BlockIndex(xCoord, yCoord, zCoord), new BlockIndex(firstEntity.xCoord, firstEntity.yCoord, firstEntity.zCoord)); p.iterate(10000); LinkedList<BlockIndex> r = p.getResult(); for (BlockIndex b : r) { worldObj.setBlock(b.x, b.y, b.z, Blocks.sponge); } firstEntity = null; } } }
Example 82
Project: functionaljava-master File: JavaLinkedList.java View source code |
public static void main(final String[] args) { final Property p = property(arbLinkedList(arbInteger), arbLinkedList(arbInteger), ( x, y) -> { final LinkedList<Integer> xy = new LinkedList<>(x); xy.addAll(y); return prop(xy.size() == x.size() + y.size()); }); // OK, passed 100 tests. summary.println(p.check()); }
Example 83
Project: Gaalop-master File: UpdateLocalVariableSet.java View source code |
/** * Updates the LocalVariable-set in a graph * @param graph The graph */ public static void updateVariableSets(ControlFlowGraph graph) { VariablesCollector collector = new VariablesCollector(); graph.accept(collector); LinkedList<Variable> vars = new LinkedList<Variable>(graph.getLocalVariables()); for (Variable v : vars) if (!collector.getVariables().contains(v.getName())) graph.removeLocalVariable(v); }
Example 84
Project: Galacticraft-master File: ArrayDumper.java View source code |
@Override public Iterable<String[]> dump(int mode) { LinkedList<String[]> list = new LinkedList<String[]>(); T[] array = array(); for (int i = 0; i < array.length; i++) { T obj = array[i]; if (obj == null) { if (mode == 1 || mode == 2) { list.add(new String[] { Integer.toString(i), null, null, null, null }); } } else { if (mode == 0 || mode == 2) { list.add(dump(obj, i)); } } } return list; }
Example 85
Project: GATECH-master File: ObjLoader.java View source code |
public static List<Vector3f> importObj(final File objFile) throws FileNotFoundException { Scanner objScanner = new Scanner(objFile); List<Vector3f> vertices = new LinkedList<Vector3f>(); while (objScanner.hasNextLine()) { String line = objScanner.nextLine().trim(); if (line.startsWith("v ")) { String vS[] = line.substring(2).trim().split(" "); vertices.add(new Vector3f(Float.parseFloat(vS[0]), Float.parseFloat(vS[1]), Float.parseFloat(vS[2]))); } } return vertices; }
Example 86
Project: gcexplorer-master File: LocalJavaProcessFinder.java View source code |
public static List<String> getLocalJavaProcesses() { List<String> localProcesses = new LinkedList<>(); List<VirtualMachineDescriptor> vms = VirtualMachine.list(); for (VirtualMachineDescriptor vmd : vms) { if (!vmd.displayName().contains(GarbageGeneratorApp.class.getSimpleName())) { localProcesses.add(vmd.id() + " " + vmd.displayName()); } } return localProcesses; }
Example 87
Project: gmf-tooling.uml2tools-master File: VisualIDRegistryExtension.java View source code |
/** * @generated */ public List<MenuTypeHint> getMenuTypeHints(String type) { int visualId = 0; try { visualId = Integer.parseInt(type); } catch (NumberFormatException e) { return Collections.emptyList(); } switch(visualId) { default: List<MenuTypeHint> hints = new LinkedList<MenuTypeHint>(); hints.add(new MenuTypeHint("", type)); return hints; } }
Example 88
Project: hook-any-text-master File: UTF16Converter.java View source code |
@Override protected List<String> extractConvertibleChunks(String hex) { List<String> results = new LinkedList<>(); Matcher m = Pattern.compile("([0-9a-f]{4})+?(0000|$)").matcher(hex); String match; while (m.find()) { match = m.group(); if (match.endsWith("0000")) { match = match.substring(0, match.length() - 4); } if (!match.contains("ffff") && hex.indexOf(match) % 2 == 0) { results.add(match); } } return results; }
Example 89
Project: ilarkesto-master File: LineTokenizer.java View source code |
@Override public List<String> tokenize(String s) { List<String> ret = new LinkedList<String>(); if (s == null) return ret; int len = s.length(); int from = 0; int to = s.indexOf('\n'); while (to >= 0) { ret.add(s.substring(from, to)); ret.add("\n"); from = to + 1; if (from >= len) return ret; to = s.indexOf('\n', from); } ret.add(s.substring(from)); return ret; }
Example 90
Project: iot-discovery-services-master File: StatusChangeEventTest.java View source code |
@Test public void rowColumnFormatting() { List<String> results = new LinkedList<>(); results.add("Test result"); results.add("Test result1"); StatusChangeEvent event = StatusChangeEvent.build("_0._tcp.test.com", "PTR", results); System.out.println(event.rowFormatted()); Assert.assertTrue(!event.columnFormatted().isEmpty()); Assert.assertTrue(!event.rowFormatted().isEmpty()); }
Example 91
Project: jabm-master File: AggregatePayoffMapTest.java View source code |
public void setUp() { strategy1 = new MockStrategy("strategy1"); strategy2 = new MockStrategy("strategy2"); LinkedList<Strategy> strategies = new LinkedList<Strategy>(); strategies.add(strategy1); strategies.add(strategy2); aggregatePayoffMap = new AggregatePayoffMap(strategies); contributingPayoffMap1 = new ContributingPayoffMap(aggregatePayoffMap, strategies); contributingPayoffMap2 = new ContributingPayoffMap(aggregatePayoffMap, strategies); }
Example 92
Project: japicmp-master File: JpaAnalyzer.java View source code |
public List<JpaTable> analyze(List<JApiClass> classes) { List<JpaTable> jpaTables = new LinkedList<>(); for (JApiClass jApiClass : classes) { List<JApiAnnotation> annotations = jApiClass.getAnnotations(); for (JApiAnnotation jApiAnnotation : annotations) { String fullyQualifiedName = jApiAnnotation.getFullyQualifiedName(); if (JPA_ANNOTATION_ENTITY.equals(fullyQualifiedName)) { JpaTable jpaTable = new JpaTable(jApiClass, jApiAnnotation); jpaTables.add(jpaTable); } } } return jpaTables; }
Example 93
Project: jkappa-master File: OperationModeCollectionGenerator.java View source code |
public static Collection<Object[]> generate(Collection<Object[]> fileNames, boolean allModes) { Collection<Object[]> collection = new LinkedList<Object[]>(); for (Object[] objects : fileNames) { Object[] obj = new Object[objects.length + 1]; for (int i = 0; i < objects.length; i++) { obj[i] = objects[i]; } if (allModes) { for (int j = 1; j <= OPERATION_MODES_NUMBER; j++) { obj[objects.length] = j; collection.add(obj); } } else { obj[objects.length] = 1; collection.add(obj); } } return collection; }
Example 94
Project: jmxfetch-master File: TestInstance.java View source code |
@Test public void testMinCollectionInterval() throws Exception { registerMBean(new SimpleTestJavaApp(), "org.datadog.jmxfetch.test:foo=Bar,qux=Baz"); initApplication("jmx_min_collection_period.yml"); run(); LinkedList<HashMap<String, Object>> metrics = getMetrics(); assertEquals(15, metrics.size()); run(); metrics = getMetrics(); assertEquals(0, metrics.size()); LOGGER.info("sleeping before the next collection"); Thread.sleep(5000); run(); metrics = getMetrics(); assertEquals(15, metrics.size()); }
Example 95
Project: joern-master File: UnaryOpEnvironment.java View source code |
public void addChildSymbols(LinkedList<String> childSymbols, ASTProvider child) { String codeStr = astProvider.getEscapedCodeStr(); if (codeStr != null && codeStr.startsWith("&")) { for (String symbol : childSymbols) { symbols.add("& " + symbol); } return; } if (codeStr == null || !codeStr.startsWith("*")) { symbols.addAll(childSymbols); return; } LinkedList<String> retval = new LinkedList<String>(); // emit all symbols as '* symbol' LinkedList<String> derefedChildren = new LinkedList<String>(); for (String c : childSymbols) { derefedChildren.add("* " + c); } retval.addAll(derefedChildren); // emit entire code string retval.add(codeStr); useSymbols.addAll(childSymbols); symbols.addAll(retval); }
Example 96
Project: Labos3eSup-master File: BeanCaddy.java View source code |
public LinkedList<BeanMovieCaddy> getListMovie(int numPage, int nbFilm) { LinkedList<BeanMovieCaddy> listMoviePagine = new LinkedList<BeanMovieCaddy>(); int cpt = 0; int i = 0; int indice = numPage * nbFilm; for (BeanMovieCaddy beanMovieCaddy : listMovie) { if (i >= indice && cpt < nbFilm) { listMoviePagine.add(beanMovieCaddy); cpt++; } i++; } return listMoviePagine; }
Example 97
Project: laika-master File: RotationCommand.java View source code |
public void execute(LaikaBot aRunOn, String aChannel, String aSender, String[] aMessages) { if (aRunOn.isChaining()) { if (aMessages.length == 1) { LinkedList<String> lList = aRunOn.getChainDetail().getRotationList(); if (lList.size() == 0) { aRunOn.sendMessage(aChannel, Colors.BOLD + Colors.RED + "Nobody is in the rotation list!"); return; } String lOutput = ""; for (int i = 0; i < lList.size(); i++) { if (aRunOn.getChainDetail().getCurrentRotation() == i) lOutput += Colors.BOLD + Colors.RED + " => " + lList.get(i); else lOutput += Colors.NORMAL + Colors.BLACK + " => " + lList.get(i); } aRunOn.sendMessage(aChannel, lOutput); } else aRunOn.sendMessage(aChannel, Colors.BOLD + Colors.RED + "Syntax: !rotation"); } else aRunOn.sendMessage(aChannel, Colors.BOLD + Colors.RED + "Rotation information is available only when chaining."); }
Example 98
Project: like_googleplus_layout-master File: ImgUrl.java View source code |
/*** * @param context * @return null 或者 LinkedList<ImgUrl>对象 */ public static LinkedList<ImgUrl> getImgUrls(Context context) { LinkedList<ImgUrl> data = new LinkedList<ImgUrl>(); String[] arrays = context.getResources().getStringArray(R.array.img_arrays); for (String str : arrays) { String[] tmp = str.split("#"); if (tmp.length == 2) { ImgUrl item = new ImgUrl(); item.imgUrl = tmp[0]; item.note = tmp[1]; item.md5 = MD5Utils.generate(item.imgUrl + item.note); data.add(item); } } if (data.size() == 0) { data = null; } return data; }
Example 99
Project: marketcetera-master File: IterableUtilsTest.java View source code |
@Test public void basics() { LinkedList<Integer> list = new LinkedList<Integer>(); assertEquals(0, IterableUtils.size(list)); assertArrayEquals(ArrayUtils.EMPTY_INTEGER_OBJECT_ARRAY, IterableUtils.toArray(list)); list.add(1); list.add(2); assertEquals(2, IterableUtils.size(list)); assertArrayEquals(new Integer[] { 1, 2 }, IterableUtils.toArray(list)); }
Example 100
Project: meaningfulweb-master File: JDomUtils.java View source code |
public static List<Element> getElementsByName(Element parent, String name) { List<Element> children = parent.getChildren(); LinkedList<Element> result = new LinkedList<Element>(); for (Element child : children) { if (child.getName().equalsIgnoreCase(name)) { result.add(child); } List<Element> subList = getElementsByName(child, name); if (subList.size() > 0) { for (Element e : subList) { result.add(e); } } } return result; }
Example 101
Project: MEater-master File: DefaultTermFilter.java View source code |
@Override public List<String> filterTerms(List<String> terms) { if (this.preFilter != null) { terms = preFilter.filterTerms(terms); } if (this.cleaner != null) { List<String> cleanedTerms = new LinkedList<String>(); for (String term : terms) { term = this.cleaner.clean(term); if (term != null) { cleanedTerms.add(term); } } terms = cleanedTerms; } return terms; }