Java Code Examples for java.util.LinkedList
The following code examples are extracted from open source projects. You can click to
vote up the examples that are useful to you.
Example 1
From project activiti-explorer, under directory /src/main/java/org/activiti/explorer/cache/.
Source file: RadixTreeImpl.java

private void getNodes(RadixTreeNode<T> parent,ArrayList<T> keys,int limit){ Queue<RadixTreeNode<T>> queue=new LinkedList<RadixTreeNode<T>>(); queue.addAll(parent.getChildern()); while (!queue.isEmpty()) { RadixTreeNode<T> node=queue.remove(); if (node.isReal() == true) { keys.add(node.getValue()); } if (keys.size() == limit) { break; } queue.addAll(node.getChildern()); } }
Example 2
From project android_5, under directory /src/aarddict/android/.
Source file: ArticleViewActivity.java

@SuppressWarnings("unchecked") @Override protected void onSaveInstanceState(Bundle outState){ super.onSaveInstanceState(outState); outState.putSerializable("backItems",new LinkedList(backItems)); outState.putSerializable("scrollPositionsH",new HashMap(scrollPositionsH)); outState.putSerializable("scrollPositionsV",new HashMap(scrollPositionsV)); }
Example 3
From project alphaportal_dev, under directory /sys-src/alphaportal/core/src/main/java/alpha/portal/dao/hibernate/.
Source file: AlphaCardDaoHibernate.java

/** * List alpha cards by criterion. * @param caseId the case id * @param criteriaArray the criteria array * @return the list * @see alpha.portal.dao.AlphaCardDao#listAlphaCardsByCriterion(org.hibernate.criterion.Criterion) */ public List<AlphaCard> listAlphaCardsByCriterion(final String caseId,final Criterion... criteriaArray){ Session session; boolean sessionOwn=false; try { session=this.getSessionFactory().getCurrentSession(); } catch ( final Exception e) { session=this.getSessionFactory().openSession(); sessionOwn=true; } final DetachedCriteria version=DetachedCriteria.forClass(AlphaCard.class,"cardVersion").add(Property.forName("card.alphaCardIdentifier.cardId").eqProperty("cardVersion.alphaCardIdentifier.cardId")).setProjection(Projections.projectionList().add(Projections.max("alphaCardIdentifier.sequenceNumber"))); final Criteria crit=session.createCriteria(AlphaCard.class,"card"); for ( final Criterion c : criteriaArray) { final DetachedCriteria subcrit=DetachedCriteria.forClass(AlphaCardDescriptor.class,"crit"); subcrit.createAlias("crit.adornmentList","ad"); subcrit.add(c); subcrit.add(Restrictions.eqProperty("card.alphaCardIdentifier","crit.alphaCardIdentifier")); subcrit.setProjection(Projections.property("crit.alphaCardIdentifier.cardId")); crit.add(Subqueries.exists(subcrit)); } crit.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY).add(Property.forName("alphaCardIdentifier.sequenceNumber").eq(version)).createAlias("alphaCase","case").add(Restrictions.eq("case.caseId",caseId)); List<AlphaCard> list=crit.list(); if (list.size() > 1) { final List<AlphaCard> order=(list.get(0)).getAlphaCase().getAlphaCards(); final List<AlphaCard> orderedList=new LinkedList<AlphaCard>(); for ( final AlphaCard cc : order) { for ( final AlphaCard c : list) { if (c.getAlphaCardIdentifier().equals(cc.getAlphaCardIdentifier())) { orderedList.add(c); break; } } } list=orderedList; } if (sessionOwn) { session.close(); } return list; }
Example 4
From project 16Blocks, under directory /src/main/java/de/minestar/sixteenblocks/Manager/.
Source file: AreaDatabaseManager.java

public List<SkinArea> loadZones(){ List<SkinArea> thisList=new LinkedList<SkinArea>(); try { ResultSet result=this.loadAreas.executeQuery(); while (result.next()) thisList.add(new SkinArea(result.getInt(2),result.getInt(3),result.getString(1))); } catch ( Exception e) { e.printStackTrace(); } return thisList; }
Example 5
From project Aardvark, under directory /aardvark-core/src/main/java/gw/vark/.
Source file: AardvarkOptions.java

public AardvarkOptions(ArgInfo argInfo){ _logger=argInfo.consumeArg(ARGKEY_LOGGER); _projectHelp=argInfo.consumeArg(ARGKEY_PROJECTHELP); boolean quiet=argInfo.consumeArg(ARGKEY_QUIET); boolean verbose=argInfo.consumeArg(ARGKEY_VERBOSE); boolean debug=argInfo.consumeArg(ARGKEY_DEBUG); if (debug) { _logLevel=LogLevel.DEBUG; } else if (verbose) { _logLevel=LogLevel.VERBOSE; } else if (quiet) { _logLevel=LogLevel.WARN; } Deque<String> rawTargets=new LinkedList<String>(argInfo.getArgsList()); String it=rawTargets.poll(); while (it != null) { TargetCall targetCall=new TargetCall(it); while (rawTargets.peek() != null && rawTargets.peek().startsWith("-")) { String paramName=rawTargets.poll().substring(1); String paramVal=possiblyHandleArgValue(rawTargets); targetCall.addParam(paramName,paramVal); } _targetCalls.put(targetCall.getName(),targetCall); it=rawTargets.poll(); } }
Example 6
From project activemq-apollo, under directory /apollo-boot/src/test/java/org/apache/activemq/apollo/boot/.
Source file: ApolloTest.java

@Test public void testResolveBootDirsAsSeenOnWindows(){ LinkedList<String> args=new LinkedList<String>(); args.add("D:\\apache-apollo-1.4\\lib" + DIR_SEPARATOR + "D:\\apache-apollo\\myboker\\lib"); String[] bootDirs=Apollo.resolveBootDirs(args); assertEquals("The correct number of boot dirs was not found",2,bootDirs.length); }
Example 7
From project adbcj, under directory /api/src/main/java/org/adbcj/.
Source file: DbSessionPool.java

public void onCompletion(DbFuture<Connection> future) throws Exception { DbSession session=future.get(); synchronized (entryLock) { if (sessions == null) { sessions=new LinkedList<DbSession>(); sessions.add(session); } else { List<DbSession> temp=new LinkedList<DbSession>(); temp.addAll(sessions); temp.add(session); sessions=temp; } } }
Example 8
From project AdminCmd, under directory /src/main/java/be/Balor/Manager/.
Source file: CommandManager.java

/** * @param plugin the plugin to set */ public void setCorePlugin(final AdminCmd plugin){ this.corePlugin=plugin; final ExtendedConfiguration cmds=FileManager.getInstance().getYml("commands"); disabledCommands=cmds.getStringList("disabledCommands",new LinkedList<String>()); prioritizedCommands=cmds.getStringList("prioritizedCommands",new LinkedList<String>()); commandsOnJoin.addAll(cmds.getStringList("onNewJoin")); final ExConfigurationSection aliases=cmds.getConfigurationSection("aliases"); for ( final String command : aliases.getKeys(false)) { Set<CommandAlias> setAliasCmd=commandsAlias.get(command); if (setAliasCmd == null) { setAliasCmd=new HashSet<CommandAlias>(); commandsAlias.put(command,setAliasCmd); } final ConfigurationSection aliasSection=aliases.getConfigurationSection(command); for ( final Entry<String,Object> alias : aliasSection.getValues(false).entrySet()) { String params; final Object value=alias.getValue(); if (value instanceof ConfigurationSection) { final StringBuffer buffer=new StringBuffer(); for ( final Entry<String,Object> entry : ((ConfigurationSection)alias).getValues(false).entrySet()) { buffer.append(entry.getKey()).append(':').append(entry.getValue()); } params=buffer.toString(); } else { params=value.toString(); } final CommandAlias commandAlias=new CommandAlias(command,alias.getKey(),params); commandsAliasReplacer.put(alias.getKey(),commandAlias); setAliasCmd.add(commandAlias); } } graph=plugin.getMetrics().createGraph("Commands"); startThreads(); }
Example 9
From project AdServing, under directory /modules/utilities/common/src/main/java/biz/source_code/miniConnectionPoolManager/.
Source file: MiniConnectionPoolManager.java

/** * Constructs a MiniConnectionPoolManager object. * @param dataSource the data source for the connections. * @param maxConnections the maximum number of connections. * @param timeout the maximum time in seconds to wait for a free connection. */ public MiniConnectionPoolManager(ConnectionPoolDataSource dataSource,int maxConnections,int timeout){ this.dataSource=dataSource; this.maxConnections=maxConnections; this.timeoutMs=timeout * 1000L; try { logWriter=dataSource.getLogWriter(); } catch ( SQLException e) { } if (maxConnections < 1) { throw new IllegalArgumentException("Invalid maxConnections value."); } semaphore=new Semaphore(maxConnections,true); recycledConnections=new LinkedList<PooledConnection>(); poolConnectionEventListener=new PoolConnectionEventListener(); }
Example 10
From project advanced, under directory /management/src/main/java/org/neo4j/management/impl/.
Source file: BeanProxy.java

public static <T>Collection<T> loadAll(MBeanServerConnection mbs,Class<T> beanInterface,ObjectName query){ Collection<T> beans=new LinkedList<T>(); try { for ( ObjectName name : mbs.queryNames(query,null)) { beans.add(factory.makeProxy(mbs,beanInterface,name)); } } catch ( IOException e) { } return beans; }
Example 11
From project AeminiumRuntime, under directory /src/aeminium/runtime/tests/.
Source file: ExecutorServiceTests.java

@Test public void invokeAll(){ final String[] data={"FIR$T","$ECOND"}; Runtime rt=getRuntime(); rt.init(); ExecutorService es=rt.getExecutorService(); List<Callable<String>> tasks=new LinkedList<Callable<String>>(); tasks.add(null); tasks.add(null); tasks.set(0,new Callable<String>(){ @Override public String call() throws Exception { return data[0]; } } ); tasks.set(1,new Callable<String>(){ @Override public String call() throws Exception { return data[1]; } } ); try { List<Future<String>> futures=es.invokeAll(tasks); for (int i=0; i < futures.size(); i++) { assertTrue(data[i].equals(futures.get(i).get())); } } catch ( InterruptedException e) { org.junit.Assert.fail(); } catch ( ExecutionException e) { org.junit.Assert.fail(); } rt.shutdown(); }
Example 12
From project aerogear-controller, under directory /src/main/java/org/jboss/aerogear/controller/router/.
Source file: DefaultRouter.java

private Object[] extractParameters(HttpServletRequest request,Route route){ LinkedList<Parameter> parameters=new LinkedList<Parameter>(); Map<String,String[]> parameterMap=request.getParameterMap(); for ( Map.Entry<String,String[]> entry : parameterMap.entrySet()) { String[] value=entry.getValue(); if (value.length == 1) { parameters.add(new Parameter(entry.getKey(),value[0])); } else { AeroGearLogger.LOGGER.multivaluedParamsUnsupported(); continue; } } Class<?>[] parameterTypes=route.getTargetMethod().getParameterTypes(); if (parameterTypes.length == 1) { Class<?> parameterType=parameterTypes[0]; Target<?> target=Target.create(parameterType,StringUtils.downCaseFirst(parameterType.getSimpleName())); Object instantiate=iogi.instantiate(target,parameters.toArray(new Parameter[]{})); return new Object[]{instantiate}; } return new Object[0]; }
Example 13
From project aether-ant, under directory /src/main/java/org/eclipse/aether/ant/tasks/.
Source file: Resolve.java

private void createRequests(DependencyNode node,LinkedList<DependencyNode> parents){ if (node.getDependency() != null) { for ( ArtifactConsumer consumer : consumers) { if (consumer.accept(node,parents)) { ArtifactRequest request=new ArtifactRequest(node); if (classifier != null) { request.setArtifact(new SubArtifact(request.getArtifact(),classifier,"jar")); } requests.add(request); break; } } } parents.addFirst(node); for ( DependencyNode child : node.getChildren()) { createRequests(child,parents); } parents.removeFirst(); }
Example 14
From project aether-core, under directory /aether-impl/src/test/java/org/eclipse/aether/internal/impl/.
Source file: DefaultDependencyCollectorTest.java

private static void assertEqualSubtree(DependencyNode expected,DependencyNode actual,LinkedList<DependencyNode> parents){ assertEquals("path: " + parents,expected.getDependency(),actual.getDependency()); if (actual.getDependency() != null) { Artifact artifact=actual.getDependency().getArtifact(); for ( DependencyNode parent : parents) { if (parent.getDependency() != null && artifact.equals(parent.getDependency().getArtifact())) { return; } } } parents.addLast(expected); assertEquals("path: " + parents + ", expected: "+ expected.getChildren()+ ", actual: "+ actual.getChildren(),expected.getChildren().size(),actual.getChildren().size()); Iterator<DependencyNode> iterator1=expected.getChildren().iterator(); Iterator<DependencyNode> iterator2=actual.getChildren().iterator(); while (iterator1.hasNext()) { assertEqualSubtree(iterator1.next(),iterator2.next(),parents); } parents.removeLast(); }
Example 15
From project agile, under directory /agile-apps/agile-app-admin/src/main/java/org/headsupdev/agile/app/admin/.
Source file: AdminApplication.java

public AdminApplication(){ links=new LinkedList<MenuLink>(); links.add(new SimpleMenuLink("add-project")); links.add(new SimpleMenuLink("add-account")); links.add(new SimpleMenuLink("permissions")); links.add(new SimpleMenuLink("membership")); links.add(new SimpleMenuLink("configuration")); links.add(new SimpleMenuLink("stats")); eventTypes=new LinkedList<String>(); eventTypes.add("projectadd"); eventTypes.add("accountadd"); eventTypes.add("updateproject"); Manager.getInstance().addProjectListener(this); }
Example 16
From project agileBase, under directory /gtpb_server/src/com/gtwm/pb/auth/.
Source file: Company.java

public synchronized List<Integer> getCachedSparkline(LogType logType,int options){ long cacheAge=System.currentTimeMillis() - this.sparkLineCacheTime; if (cacheAge > 1000 * 60 * 60* 48) { return new LinkedList<Integer>(); } String key=logType.name() + options; List<Integer> cachedSparkLine=this.cachedSparkLines.get(key); if (cachedSparkLine == null) { return new LinkedList<Integer>(); } return cachedSparkLine; }
Example 17
From project agit, under directory /agit/src/main/java/com/madgag/agit/diff/.
Source file: DiffText.java

public void initWith(LinkedList<Diff> diffs,float state){ DeltaSpan insertSpan=new DeltaSpan(true,state); DeltaSpan deleteSpan=new DeltaSpan(false,state); insertSpans=newArrayList(); deleteSpans=newArrayList(); spannableText.clear(); for ( Diff diff : diffs) { spannableText.append(diff.text); if (diff.operation != Operation.EQUAL) { boolean insertNotDelete=diff.operation == INSERT; CharacterStyle deltaSpan=CharacterStyle.wrap(insertNotDelete ? insertSpan : deleteSpan); spannableText.setSpan(deltaSpan,spannableText.length() - diff.text.length(),spannableText.length(),SPAN_EXCLUSIVE_EXCLUSIVE); (insertNotDelete ? insertSpans : deleteSpans).add(deltaSpan); } } }
Example 18
From project agraph-java-client, under directory /src/test/stress/.
Source file: StreamingTest.java

public void concurrent(STREAM... sts) throws Exception { minSeconds=300; limit=" limit 15000"; int proc=Runtime.getRuntime().availableProcessors(); ExecutorService exec=Executors.newFixedThreadPool(proc); List<Callable<Stats>> tasks=new LinkedList<Callable<Stats>>(); for (int i=0; i < (proc / (sts.length)); i++) { for (int j=0; j < sts.length; j++) { final STREAM st=sts[j]; tasks.add(new Callable<Stats>(){ public Stats call() throws Exception { return measurePerf(st); } } ); } } Stats stats=new Stats(); List<Future<Stats>> futures=exec.invokeAll(tasks); for ( Future<Stats> future : futures) { stats.add(future.get()); } log.info("concurrent " + Arrays.asList(sts) + "\t"+ stats); }
Example 19
From project AirCastingAndroidClient, under directory /src/main/java/ioio/lib/util/.
Source file: IOIOConnectionRegistry.java

/** * Get all available connection specifications. This is a list of all currently available communication channels in which a IOIO may be available. The client typically passes elements of this collection to {@link IOIOFactory#create(ioio.lib.api.IOIOConnection)}, possibly after filtering based on the specification's properties. * @return A collection of specifications. */ public static Collection<IOIOConnectionFactory> getConnectionFactories(){ Collection<IOIOConnectionFactory> result=new LinkedList<IOIOConnectionFactory>(); for ( IOIOConnectionBootstrap bootstrap : bootstraps_) { bootstrap.getFactories(result); } return result; }
Example 20
public static void bfs(UndirectedGraph inputGraph,int src){ StringBuilder sb=new StringBuilder(); sb.append("Breadth-First Search:\n"); sb.append("Graph=").append(inputGraph.getName()).append(", source=").append(src).append("\n"); boolean[] done=new boolean[inputGraph.size()]; Integer[] pred=new Integer[inputGraph.size()]; int[] dist=new int[inputGraph.size()]; LinkedList<Integer> queue=new LinkedList<Integer>(); queue.add(src); done[src]=true; pred[src]=null; dist[src]=0; while (!queue.isEmpty()) { Integer node=queue.pollFirst(); sb.append("node=").append(node).append(", pred=").append(pred[node] == null ? " " : pred[node]); sb.append(", dist/layer=").append(dist[node]).append("\n"); for ( int edge : inputGraph.getEdges(node)) { if (!done[edge]) { queue.add(edge); done[edge]=true; pred[edge]=node; dist[edge]=dist[node] + 1; } } } System.out.println(sb); }
Example 21
From project ALP, under directory /workspace/alp-reporter-fe/src/main/java/com/lohika/alp/reporter/fe/query/.
Source file: QueryParser.java

LinkedList<String> buildTokens(String query){ Matcher m=p.matcher(query); LinkedList<String> tokens=new LinkedList<String>(); while (m.find()) tokens.push(query.substring(m.start(),m.end())); return tokens; }
Example 22
From project AmDroid, under directory /httpclientandroidlib/src/ch/boye/httpclientandroidlib/conn/ssl/.
Source file: AbstractVerifier.java

public static String[] getCNs(X509Certificate cert){ LinkedList<String> cnList=new LinkedList<String>(); String subjectPrincipal=cert.getSubjectX500Principal().toString(); StringTokenizer st=new StringTokenizer(subjectPrincipal,","); while (st.hasMoreTokens()) { String tok=st.nextToken(); int x=tok.indexOf("CN="); if (x >= 0) { cnList.add(tok.substring(x + 3)); } } if (!cnList.isEmpty()) { String[] cns=new String[cnList.size()]; cnList.toArray(cns); return cns; } else { return null; } }
Example 23
From project amplafi-sworddance, under directory /src/main/java/com/sworddance/taskcontrol/.
Source file: ResourceLockManager.java

/** * return the list of locks for the given resource. copy over exclusive, unreleased locks from the global list. This will allow the tasks with global exclusive locks to be able to create subtasks that insert selective locks. If released locks are not pruned then the actual list is returned. This is important for combineLocks. combineLocks should be changed to remove this dependency. * @param resourceName * @return actual list */ private List<ResourceLock> getResourceLockList(String resourceName){ synchronized (lockLists) { LinkedList<ResourceLock> list=lockLists.get(resourceName); if (list == null) { list=new LinkedList<ResourceLock>(); lockLists.put(resourceName,list); LinkedList<ResourceLock> globalList=lockLists.get(GLOBALRESOURCE); if (globalList != null) { for (ListIterator<ResourceLock> iter=globalList.listIterator(); iter.hasNext(); ) { ResourceLock lock=iter.next(); if (lock.isExclusiveLock()) { ResourceLock newLock=new ResourceLock(resourceName,lock.getLockType()); ResourceLocker task=lock.getTask(); newLock.setTask(task); if (lock.isLockReleased()) { newLock.releaseLock(); } task.addLock(newLock); list.add(newLock); } } } } return list; } }
Example 24
From project Android, under directory /app/src/main/java/com/github/mobile/ui/code/.
Source file: RepositoryCodeFragment.java

private void refreshTree(final Reference reference){ showLoading(true); new RefreshTreeTask(repository,reference,getActivity()){ @Override protected void onSuccess( final FullTree fullTree) throws Exception { super.onSuccess(fullTree); if (folder == null || folder.parent == null) setFolder(fullTree,fullTree.root); else { Folder current=folder; LinkedList<Folder> stack=new LinkedList<Folder>(); while (current != null && current.parent != null) { stack.addFirst(current); current=current.parent; } Folder refreshed=fullTree.root; while (!stack.isEmpty()) { refreshed=refreshed.folders.get(stack.removeFirst().name); if (refreshed == null) break; } if (refreshed != null) setFolder(fullTree,refreshed); else setFolder(fullTree,fullTree.root); } } @Override protected void onException( Exception e) throws RuntimeException { super.onException(e); showLoading(false); ToastUtils.show(getActivity(),e,string.error_code_load); } } .execute(); }
Example 25
From project android-aac-enc, under directory /src/com/coremedia/iso/boxes/.
Source file: EditListBox.java

@Override public void _parseDetails(ByteBuffer content){ parseVersionAndFlags(content); int entryCount=l2i(IsoTypeReader.readUInt32(content)); entries=new LinkedList<Entry>(); for (int i=0; i < entryCount; i++) { entries.add(new Entry(this,content)); } }
Example 26
From project android-async-http, under directory /src/com/loopj/android/http/.
Source file: AsyncHttpClient.java

private void sendRequest(DefaultHttpClient client,HttpContext httpContext,HttpUriRequest uriRequest,String contentType,AsyncHttpResponseHandler responseHandler,Context context){ if (contentType != null) { uriRequest.addHeader("Content-Type",contentType); } Future<?> request=threadPool.submit(new AsyncHttpRequest(client,httpContext,uriRequest,responseHandler)); if (context != null) { List<WeakReference<Future<?>>> requestList=requestMap.get(context); if (requestList == null) { requestList=new LinkedList<WeakReference<Future<?>>>(); requestMap.put(context,requestList); } requestList.add(new WeakReference<Future<?>>(request)); } }
Example 27
From project android-client, under directory /xwiki-android-client/src/org/xwiki/android/client/blog/.
Source file: LoadSavedPostsActivity.java

@Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); DocumentSvc svc=new DocumentSvcImpl(); init(); svc.listBySpace("Blog",clbk); setContentView(R.layout.blog_loadsaved_list); btnLoad=(Button)findViewById(R.id.btnLoad); btnDel=(Button)findViewById(R.id.btnDel); btnLoad.setOnClickListener(this); btnDel.setOnClickListener(this); refList=new LinkedList<FSDocumentReference>(); }
Example 28
From project android-client_1, under directory /src/org/apache/harmony/javax/security/auth/.
Source file: Subject.java

/** * return set with elements that are instances or subclasses of the specified class */ protected final <E>Set<E> get(final Class<E> c){ if (c == null) { throw new NullPointerException(); } AbstractSet<E> s=new AbstractSet<E>(){ private LinkedList<E> elements=new LinkedList<E>(); @Override public boolean add( E o){ if (!c.isAssignableFrom(o.getClass())) { throw new IllegalArgumentException("auth.0C " + c.getName()); } if (elements.contains(o)) { return false; } elements.add(o); return true; } @Override public Iterator<E> iterator(){ return elements.iterator(); } @Override public boolean retainAll( Collection<?> c){ if (c == null) { throw new NullPointerException(); } return super.retainAll(c); } @Override public int size(){ return elements.size(); } } ; for (Iterator<SST> it=iterator(); it.hasNext(); ) { SST o=it.next(); if (c.isAssignableFrom(o.getClass())) { s.add(c.cast(o)); } } return s; }
Example 29
From project android-joedayz, under directory /Proyectos/GreenDroid/src/greendroid/widget/.
Source file: ActionBar.java

/** * @param type */ public void setType(Type type){ if (type != mType) { removeAllViews(); int layoutId=0; switch (type) { case Empty: layoutId=R.layout.gd_action_bar_empty; break; case Dashboard: layoutId=R.layout.gd_action_bar_dashboard; break; case Normal: layoutId=R.layout.gd_action_bar_normal; break; } mType=type; LayoutInflater.from(getContext()).inflate(layoutId,this); LinkedList<ActionBarItem> itemsCopy=new LinkedList<ActionBarItem>(mItems); mItems.clear(); for (ActionBarItem item : itemsCopy) { addItem(item); } } }
Example 30
From project Android-MapForgeFragment, under directory /library-common/src/com/jakewharton/android/mapsforge_fragment/.
Source file: DependencyCache.java

/** * Creates a symbol dependency element for the dependency cache. * @param symbol reference on the dependency symbol. * @param tile dependency tile. */ DependencySymbol(Bitmap symbol,Tile tile){ this.depCounter=0; this.symbol=symbol; this.tiles=new LinkedList<Tile>(); this.tiles.add(tile); }
Example 31
From project android-pulltorefresh, under directory /pulltorefreshexample/src/com/markupartist/android/example/pulltorefresh/.
Source file: PullToRefreshActivity.java

/** * Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.pull_to_refresh); ((PullToRefreshListView)getListView()).setOnRefreshListener(new OnRefreshListener(){ @Override public void onRefresh(){ new GetDataTask().execute(); } } ); mListItems=new LinkedList<String>(); mListItems.addAll(Arrays.asList(mStrings)); ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,mListItems); setListAdapter(adapter); }
Example 32
From project android-shuffle, under directory /client/src/org/dodgybits/shuffle/android/synchronisation/tracks/.
Source file: TaskSynchronizer.java

@Override protected void verifyLocalEntities(Map<Id,Task> localEntities){ LinkedList<Id> tasksWithoutContext=new LinkedList<Id>(); for ( Task t : localEntities.values()) { if (!t.getContextId().isInitialised()) { tasksWithoutContext.add(t.getLocalId()); } } if (tasksWithoutContext.size() > 0) { mTracksSynchronizer.postSyncMessage(R.string.cannotSyncTasksWithoutContext); for ( Id id : tasksWithoutContext) { localEntities.remove(id); } } }
Example 33
From project Android-Terminal-Emulator, under directory /src/jackpal/androidterm/.
Source file: TermViewFlipper.java

private void commonConstructor(Context context){ this.context=context; callbacks=new LinkedList<UpdateCallback>(); updateVisibleRect(); Rect visible=mVisibleRect; mChildParams=new LayoutParams(visible.width(),visible.height(),Gravity.TOP | Gravity.LEFT); }
Example 34
From project android-thaiime, under directory /latinime/src/com/android/inputmethod/keyboard/internal/.
Source file: PointerTrackerQueue.java

public synchronized void releaseAllPointersOlderThan(PointerTracker tracker,long eventTime){ if (mQueue.lastIndexOf(tracker) < 0) { return; } final LinkedList<PointerTracker> queue=mQueue; int oldestPos=0; for (PointerTracker t=queue.get(oldestPos); t != tracker; t=queue.get(oldestPos)) { if (t.isModifier()) { oldestPos++; } else { t.onPhantomUpEvent(t.getLastX(),t.getLastY(),eventTime); queue.remove(oldestPos); } } }
Example 35
From project android-viewflow, under directory /viewflow/src/org/taptwo/android/widget/.
Source file: ViewFlow.java

private void init(){ mLoadedViews=new LinkedList<View>(); mRecycledViews=new LinkedList<View>(); mScroller=new Scroller(getContext()); final ViewConfiguration configuration=ViewConfiguration.get(getContext()); mTouchSlop=configuration.getScaledTouchSlop(); mMaximumVelocity=configuration.getScaledMaximumFlingVelocity(); }
Example 36
From project android-wheel, under directory /wheel/src/kankan/wheel/widget/adapters/.
Source file: AbstractWheelAdapter.java

@Override public void registerDataSetObserver(DataSetObserver observer){ if (datasetObservers == null) { datasetObservers=new LinkedList<DataSetObserver>(); } datasetObservers.add(observer); }
Example 37
From project android-wheel-datetime-picker, under directory /src/kankan/wheel/widget/adapters/.
Source file: AbstractWheelAdapter.java

@Override public void registerDataSetObserver(DataSetObserver observer){ if (datasetObservers == null) { datasetObservers=new LinkedList<DataSetObserver>(); } datasetObservers.add(observer); }
Example 38
From project android-wheel_1, under directory /wheel/src/kankan/wheel/widget/adapters/.
Source file: AbstractWheelAdapter.java

@Override public void registerDataSetObserver(DataSetObserver observer){ if (datasetObservers == null) { datasetObservers=new LinkedList<DataSetObserver>(); } datasetObservers.add(observer); }
Example 39
From project AndroidLab, under directory /samples/AndroidLdapClient/src/com/unboundid/android/ldap/client/.
Source file: AddServer.java

/** * Tests the provided server settings to determine if they are acceptable. */ private void testSettings(){ logEnter(LOG_TAG,"testSettings"); final LinkedList<String> reasons=new LinkedList<String>(); final ServerInstance instance; try { instance=createInstance(); } catch ( final NumberFormatException nfe) { logException(LOG_TAG,"testSettings",nfe); reasons.add(getString(R.string.add_server_err_port_not_int)); final Intent i=new Intent(this,PopUp.class); i.putExtra(PopUp.BUNDLE_FIELD_TITLE,getString(R.string.add_server_popup_title_failed)); i.putExtra(PopUp.BUNDLE_FIELD_TEXT,getString(R.string.add_server_popup_text_failed,listToString(reasons))); startActivity(i); return; } final TestServerThread testThread=new TestServerThread(this,instance); testThread.start(); progressDialog=new ProgressDialog(this); progressDialog.setTitle(getString(R.string.add_server_progress_text)); progressDialog.setIndeterminate(true); progressDialog.setCancelable(false); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.show(); }
Example 40
From project android_8, under directory /src/com/google/gson/.
Source file: DefaultTypeAdapters.java

@SuppressWarnings({"rawtypes"}) private static ParameterizedTypeHandlerMap<InstanceCreator<?>> createDefaultInstanceCreators(){ ParameterizedTypeHandlerMap<InstanceCreator<?>> map=new ParameterizedTypeHandlerMap<InstanceCreator<?>>(); DefaultConstructorAllocator allocator=new DefaultConstructorAllocator(50); map.registerForTypeHierarchy(Map.class,new DefaultConstructorCreator<Map>(LinkedHashMap.class,allocator)); DefaultConstructorCreator<List> listCreator=new DefaultConstructorCreator<List>(ArrayList.class,allocator); DefaultConstructorCreator<Queue> queueCreator=new DefaultConstructorCreator<Queue>(LinkedList.class,allocator); DefaultConstructorCreator<Set> setCreator=new DefaultConstructorCreator<Set>(HashSet.class,allocator); DefaultConstructorCreator<SortedSet> sortedSetCreator=new DefaultConstructorCreator<SortedSet>(TreeSet.class,allocator); map.registerForTypeHierarchy(Collection.class,listCreator); map.registerForTypeHierarchy(Queue.class,queueCreator); map.registerForTypeHierarchy(Set.class,setCreator); map.registerForTypeHierarchy(SortedSet.class,sortedSetCreator); map.makeUnmodifiable(); return map; }
Example 41
From project android_external_easymock, under directory /src/org/easymock/internal/.
Source file: LastControl.java

private static List<IArgumentMatcher> popLastArgumentMatchers(int count){ Stack<IArgumentMatcher> stack=threadToArgumentMatcherStack.get(); assertState(stack != null,"no matchers found."); assertState(stack.size() >= count,"" + count + " matchers expected, "+ stack.size()+ " recorded."); List<IArgumentMatcher> result=new LinkedList<IArgumentMatcher>(); result.addAll(stack.subList(stack.size() - count,stack.size())); for (int i=0; i < count; i++) { stack.pop(); } return result; }
Example 42
From project android_external_guava, under directory /src/com/google/common/collect/.
Source file: Lists.java

/** * Creates a {@code LinkedList} instance containing the given elements. * @param elements the elements that the list should contain, in order * @return a new {@code LinkedList} containing those elements */ @GwtCompatible(serializable=true) public static <E>LinkedList<E> newLinkedList(Iterable<? extends E> elements){ LinkedList<E> list=newLinkedList(); for ( E element : elements) { list.add(element); } return list; }
Example 43
From project android_ioio_combination_lock, under directory /src/kankan/wheel/widget/adapters/.
Source file: AbstractWheelAdapter.java

@Override public void registerDataSetObserver(DataSetObserver observer){ if (datasetObservers == null) { datasetObservers=new LinkedList<DataSetObserver>(); } datasetObservers.add(observer); }
Example 44
From project android_packages_apps_FileManager, under directory /src/org/openintents/filemanager/.
Source file: FileManagerActivity.java

private void deleteMultiFile(){ LinkedList<File> files=new LinkedList<File>(); for ( IconifiedText it : mDirectoryEntries) { if (!it.isSelected()) { continue; } File file=FileUtils.getFile(currentDirectory,it.getText()); files.add(file); } new RecursiveDeleteTask().execute(files); }
Example 45
From project android_packages_apps_Nfc, under directory /src/com/android/nfc/.
Source file: NfcDispatcher.java

static List<String> extractAarPackages(NdefMessage message){ List<String> aarPackages=new LinkedList<String>(); for ( NdefRecord record : message.getRecords()) { String pkg=checkForAar(record); if (pkg != null) { aarPackages.add(pkg); } } return aarPackages; }
Example 46
From project android_packages_apps_QuickSearchBox, under directory /src/com/android/quicksearchbox/.
Source file: RankAwarePromoter.java

public void pickPromoted(SuggestionCursor shortcuts,ArrayList<CorpusResult> suggestions,int maxPromoted,ListSuggestionCursor promoted){ if (DBG) Log.d(TAG,"Available results: " + suggestions); LinkedList<CorpusResult> defaultResults=new LinkedList<CorpusResult>(); LinkedList<CorpusResult> otherResults=new LinkedList<CorpusResult>(); for ( CorpusResult result : suggestions) { if (result.getCount() > 0) { result.moveTo(0); Corpus corpus=result.getCorpus(); if (corpus == null || corpus.isCorpusDefaultEnabled()) { defaultResults.add(result); } else { otherResults.add(result); } } } if (maxPromoted > 0 && !defaultResults.isEmpty()) { int slotsToFill=Math.min(getSlotsAboveKeyboard() - promoted.getCount(),maxPromoted); if (slotsToFill > 0) { int stripeSize=Math.max(1,slotsToFill / defaultResults.size()); maxPromoted-=roundRobin(defaultResults,slotsToFill,stripeSize,promoted); } } if (maxPromoted > 0 && !defaultResults.isEmpty()) { int stripeSize=Math.max(1,maxPromoted / defaultResults.size()); maxPromoted-=roundRobin(defaultResults,maxPromoted,stripeSize,promoted); maxPromoted-=roundRobin(defaultResults,maxPromoted,maxPromoted,promoted); } if (maxPromoted > 0 && !otherResults.isEmpty()) { int stripeSize=Math.max(1,maxPromoted / otherResults.size()); maxPromoted-=roundRobin(otherResults,maxPromoted,stripeSize,promoted); maxPromoted-=roundRobin(otherResults,maxPromoted,maxPromoted,promoted); } if (DBG) Log.d(TAG,"Returning " + promoted.toString()); }
Example 47
From project android_packages_inputmethods_LatinIME, under directory /java/src/com/android/inputmethod/keyboard/internal/.
Source file: PointerTrackerQueue.java

public synchronized void releaseAllPointersOlderThan(PointerTracker tracker,long eventTime){ if (mQueue.lastIndexOf(tracker) < 0) { return; } final LinkedList<PointerTracker> queue=mQueue; int oldestPos=0; for (PointerTracker t=queue.get(oldestPos); t != tracker; t=queue.get(oldestPos)) { if (t.isModifier()) { oldestPos++; } else { t.onPhantomUpEvent(t.getLastX(),t.getLastY(),eventTime); queue.remove(oldestPos); } } }
Example 48
From project andstatus, under directory /src/org/andstatus/app/net/.
Source file: ConnectionOAuth.java

@Override public JSONObject updateStatus(String message,String inReplyToId) throws ConnectionException { HttpPost post=new HttpPost(getApiUrl(apiEnum.STATUSES_UPDATE)); LinkedList<BasicNameValuePair> out=new LinkedList<BasicNameValuePair>(); out.add(new BasicNameValuePair("status",message)); if (!TextUtils.isEmpty(inReplyToId)) { out.add(new BasicNameValuePair("in_reply_to_status_id",inReplyToId)); } try { post.setEntity(new UrlEncodedFormEntity(out,HTTP.UTF_8)); } catch ( UnsupportedEncodingException e) { Log.e(TAG,e.toString()); } return postRequest(post); }
Example 49
From project andtweet, under directory /src/com/xorcode/andtweet/net/.
Source file: ConnectionOAuth.java

@Override public JSONObject updateStatus(String message,long inReplyToId) throws ConnectionException { HttpPost post=new HttpPost(STATUSES_UPDATE_URL); LinkedList<BasicNameValuePair> out=new LinkedList<BasicNameValuePair>(); out.add(new BasicNameValuePair("status",message)); if (inReplyToId > 0) { out.add(new BasicNameValuePair("in_reply_to_status_id",String.valueOf(inReplyToId))); } try { post.setEntity(new UrlEncodedFormEntity(out,HTTP.UTF_8)); } catch ( UnsupportedEncodingException e) { Log.e(TAG,e.toString()); } return postRequest(post); }
Example 50
@Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); registerExternalStorageListener(); setContentView(R.layout.card_editor); mFieldsLayoutContainer=(LinearLayout)findViewById(R.id.CardEditorEditFieldsLayout); mSave=(Button)findViewById(R.id.CardEditorSaveButton); mCancel=(Button)findViewById(R.id.CardEditorCancelButton); mEditorCard=Reviewer.getEditorCard(); Fact cardFact=mEditorCard.getFact(); TreeSet<Field> fields=cardFact.getFields(); mEditFields=new LinkedList<FieldEditText>(); Iterator<Field> iter=fields.iterator(); while (iter.hasNext()) { FieldEditText newTextbox=new FieldEditText(this,iter.next()); TextView label=newTextbox.getLabel(); mEditFields.add(newTextbox); mFieldsLayoutContainer.addView(label); mFieldsLayoutContainer.addView(newTextbox); } mSave.setOnClickListener(new View.OnClickListener(){ @Override public void onClick( View v){ Iterator<FieldEditText> iter=mEditFields.iterator(); while (iter.hasNext()) { FieldEditText current=iter.next(); current.updateField(); } setResult(RESULT_OK); finish(); } } ); mCancel.setOnClickListener(new View.OnClickListener(){ @Override public void onClick( View v){ setResult(RESULT_CANCELED); finish(); } } ); }