There are 33 code examples for java.util.LinkedList.
The API names are highlighted below.
You can use
button
to vote the code example(s) you like. The best code example will be ranked first next time. Thanks a lot for your feedback.
Project Name: CodeAnalyzer Package: de.fzi.cloneanalyzer.annotation
Source Code: CloneFileAnnotationPositionManager.java (Click to view .java file)
Method Code:
/**
* returns the CloneInstance at a given LineNumber
* @return the CloneInstance at a given LineNumber
*/
public LinkedList getCloneInstances(int lineNumber){
LinkedList ll=(posl.getLL(lineNumber));
return ll;
}
Project Name: CodeAnalyzer Package: de.fzi.cloneanalyzer.util
Source Code: IntTreeMap.java (Click to view .java file)
Method Code:
public LinkedList toLinkedList(){
LinkedList ll=new LinkedList();
Iterator it=this.iterator();
while (it.hasNext()) {
Object obj=it.next();
ll.add(obj);
}
return ll;
}
Project Name: CodeAnalyzer Package: de.fzi.cloneanalyzer.util
Source Code: IntSet.java (Click to view .java file)
Method Code:
public Iterator iterator(int key){
LinkedList ll=null;
Object obj=get(key);
if (obj instanceof LinkedList) {
ll=(LinkedList)obj;
return ll.iterator();
}
return null;
}
Project Name: CodeAnalyzer Package: de.fzi.cloneanalyzer.util
Source Code: IntTreeMap2D.java (Click to view .java file)
Method Code:
public LinkedList toLinkedList(){
LinkedList ll=new LinkedList();
Iterator it=this.iterator();
while (it.hasNext()) {
Object obj=it.next();
if (obj instanceof IntTreeMap) {
IntTreeMap itm_obj=(IntTreeMap)obj;
Iterator it2=itm_obj.iterator();
while (it2.hasNext()) {
Object obj2=it2.next();
ll.add(obj2);
int size=ll.size();
}
}
}
return ll;
}
Project Name: CodeAnalyzer Package: de.fzi.cloneanalyzer.viewer
Source Code: CloneEditor.java (Click to view .java file)
Method Code:
protected void showCloneContextMenu(IMenuManager menu,int line){
LinkedList ll=cf.getCloneInstanceList(line);
menu.removeAll();
if (ll != null) {
MenuManager mm=null;
Iterator it=ll.iterator();
while (it.hasNext()) {
CloneInstanceEclipse ci=(CloneInstanceEclipse)(it.next());
String selected="";
if (ci == CloneAnalyzerPlugin.getDefault().getSelectedCloneInstance()) {
selected=">> ";
}
mm=new MenuManager(selected + ci.toShortString(),ci.toShortString());
mm.add(new SelectInTreeAction(ci));
menu.add(mm);
}
}
}
Project Name: codecover Package: org.codecover.eclipse.tscmanager
Source Code: TSContainerManager.java (Click to view .java file)
Method Code:
/**
* Gets the list of {@link TSContainerInfo}s associated with the given ID
* @param ID the given Id.
* @return the list of {@link TSContainerInfo}s
*/
public List<TSContainerInfo> getTestSessionContainers(String ID){
LinkedList<TSContainerInfo> tscInfosByProject=new LinkedList<TSContainerInfo>();
synchronized (this.getReadLock()) {
for ( TSContainerInfo tscInfo : this.tscInfos) {
if (tscInfo.getId().equals(ID)) {
tscInfosByProject.add(tscInfo);
}
}
}
return tscInfosByProject;
}
Project Name: codecover Package: org.codecover.eclipse.tscmanager
Source Code: WorkspaceListener.java (Click to view .java file)
Method Code:
/**
* Retrieves all changed files of test session containers of the resource delta of a project. The test
* session container files are represented by <code>IResourceDelta</code>s which contain information
* about the type of change that happened to the file and a reference to the file itself. It is guaranteed
* that the returned list only contains <code>IResourceDelta</code>s of files (<code>IFile</code>s),
* however these files don't have to be test session containers.
* @param project the project
* @return all changed test session container files of the resource delta of a project.
*/
private static List<IResourceDelta> fetchChangedTSCFilesByProject(IResourceDelta project){
LinkedList<IResourceDelta> tscFiles=new LinkedList<IResourceDelta>();
for ( IResourceDelta child : project.getAffectedChildren()) {
if (child.getResource() instanceof IFolder && ((IFolder)child.getResource()).getName().equals(CodeCoverPlugin.CODECOVER_FOLDER)) {
for ( IResourceDelta tscFile : child.getAffectedChildren()) {
if (tscFile.getResource() instanceof IFile) {
tscFiles.add(tscFile);
}
}
}
}
return tscFiles;
}
Project Name: codecover-instrumentation Package: org.codecover.instrumentation
Source Code: HierarchyLevelContainer.java (Click to view .java file)
Method Code:
/**
* Splits a given package name—e.g.
* <code>org.codecover.instrumentation</code>—into a List of
* hierarchical package names.<br>
* <br>
* The List contains the packages from the top package down to the given
* package. Giving as package name an empty String, the List is empty.<br>
* For the creation of the name of the fullPackagePath,{@link #SEPARATOR_REG_EXP} and {@value #SEPARATOR} are used.
* @param fullPackagePathThe full name of the package as a String; e.g.
* <code>org.codecover.instrumentation</code>
* @param fullPackageNamesStates whether or whether the names of the packages should
* have the full name.
* <ul>
* <li><code>true</code> →
* <code>{org, org.codecover, org.codecover.instrumentation}</code></li>
* <li><code>false</code> →
* <code>{org, codecover, instrumentation}</code></li>
* </ul>
* @return A List containing the names of the packages and its super
* packages.
* @see #addHierarchyLevel(HierarchyLevel,LinkedList)
* @see #addHierarchyLevels(Collection,LinkedList)
*/
public static LinkedList<String> packagePathToList(String fullPackagePath,boolean fullPackageNames){
if (fullPackagePath.startsWith(SEPARATOR)) {
String message="fullPackagePath.startsWith(Character.toString(separator))";
throw new IllegalArgumentException(message);
}
if (fullPackagePath.endsWith(SEPARATOR)) {
String message="fullPackagePath.endsWith(Character.toString(separator))";
throw new IllegalArgumentException(message);
}
LinkedList<String> packageQueue=new LinkedList<String>();
if (fullPackagePath.length() == 0) {
return packageQueue;
}
String[] packageNameArray=fullPackagePath.split(SEPARATOR_REG_EXP);
for (int i=0; i < packageNameArray.length; i++) {
if (fullPackageNames && i > 0) {
packageNameArray[i]=packageNameArray[i - 1] + SEPARATOR + packageNameArray[i];
}
packageQueue.add(packageNameArray[i]);
}
return packageQueue;
}
Project Name: codecover-model Package: org.codecover.model.utils
Source Code: Attic.java (Click to view .java file)
Method Code:
/**
* Returns an {@link Iterator} of this Attic from the <b>bottom</b> to the
* <b>top</b>.
* @return An {@link Iterator}.
*/
public Iterator<T> iterator(){
return this.list.iterator();
}
Project Name: codecover-model Package: org.codecover.model.utils.file.listener
Source Code: AllFileFoundListener.java (Click to view .java file)
Method Code:
/**
* Returns all {@link File}s found by{@link FileFoundListener#notIncludedFileFound(File,String)}.
* @return All not included {@link File}s found.
*/
public Collection<File> getNotIncludedFiles(){
return this.notIncludedFiles;
}
Project Name: codecover-model Package: org.codecover.model.utils.file.listener
Source Code: IncludedFileFoundListener.java (Click to view .java file)
Method Code:
/**
* Returns all {@link File}s found by{@link FileFoundListener#includedFileFound(File,String)}.
* @return All included {@link File}s found.
*/
public Collection<File> getIncludedFiles(){
return this.includedFiles;
}
Project Name: icTAKES Package: edu.mayo.bmi.coref.util
Source Code: AttributeCalculator.java (Click to view .java file)
Method Code:
public ArrayList<BaseToken> containedTokens(int a,int b){
ArrayList<BaseToken> ret=new ArrayList<BaseToken>();
BaseToken t1=hbs.get(a);
BaseToken t2=hbe.get(b);
if (t1 != null && t2 != null) {
int begin=t1.getTokenNumber();
int end=t2.getTokenNumber();
LinkedList<Annotation> l=FSIteratorToList.convert(jcas.getJFSIndexRepository().getAnnotationIndex(BaseToken.type).iterator());
for (int i=0; i < l.size(); i++) {
BaseToken t=(BaseToken)l.get(i);
if (t.getTokenNumber() >= begin && t.getTokenNumber() <= end) ret.add(t);
}
}
return ret;
}
Project Name: icTAKES Package: edu.mayo.bmi.coref.util
Source Code: FSIteratorToList.java (Click to view .java file)
Method Code:
public static LinkedList<Annotation> convert(FSIterator iter){
LinkedList<Annotation> ret=new LinkedList<Annotation>();
while (iter.hasNext()) {
Object o=iter.next();
if (o instanceof Annotation) ret.add((Annotation)o);
}
java.util.Collections.sort(ret,new AnnotOffsetComparator());
return ret;
}
Project Name: icTAKES Package: org.chboston.cnlp.ctakes.coref.uima.ae
Source Code: MipacqMarkablePairGenerator.java (Click to view .java file)
Method Code:
private void createPronPairs(LinkedList<Annotation> lm,int p,JCas jcas){
PronounMarkable m=(PronounMarkable)lm.get(p);
MarkablePairSet pairList=new MarkablePairSet(jcas);
pairList.setAnaphor(m);
NonEmptyFSList head=new NonEmptyFSList(jcas);
pairList.setAntecedentList(head);
NonEmptyFSList tail=null;
for (int q=p - 1; q >= 0; --q) {
Markable a=(Markable)lm.get(q);
if (sentDist(jcas,a,m) > CorefConsts.PRODIST) break;
if ((a.getBegin() <= m.getBegin() && a.getEnd() >= m.getEnd()) || m.getBegin() <= a.getBegin() && m.getEnd() >= a.getEnd()) continue;
BooleanLabeledFS labeledAntecedent=new BooleanLabeledFS(jcas);
labeledAntecedent.setFeature(a);
if (tail == null) {
tail=head;
}
else {
tail.setTail(new NonEmptyFSList(jcas));
tail=(NonEmptyFSList)tail.getTail();
}
tail.setHead(labeledAntecedent);
}
if (tail == null) pairList.setAntecedentList(new EmptyFSList(jcas));
else tail.setTail(new EmptyFSList(jcas));
numVecs++;
pairList.addToIndexes();
}
Project Name: icTAKES Package: org.chboston.cnlp.ctakes.coref.uima.ae
Source Code: MipacqMarkableExpander.java (Click to view .java file)
Method Code:
private void rmDup(JCas aJCas,LinkedList<Annotation> markables){
HashSet<Annotation> rm=new HashSet<Annotation>();
HashMap<String,Annotation> keep=new HashMap<String,Annotation>();
for (int i=0; i < markables.size(); i++) {
Annotation m1=markables.get(i);
String key=m1.getBegin() + "-" + m1.getEnd();
if (!keep.containsKey(key)) {
keep.put(key,m1);
}
else {
Annotation m2=keep.get(key);
if (m2 instanceof DemMarkable && m1 instanceof NEMarkable) {
rm.add(m2);
keep.put(key,m1);
}
else if (m1 instanceof DemMarkable && m2 instanceof NEMarkable) {
rm.add(m1);
}
else {
rm.add(m1);
}
}
}
for ( Annotation a : rm) a.removeFromIndexes();
}
Project Name: jbidwatcher Package: com.jbidwatcher.auction.server
Source Code: AuctionServerManager.java (Click to view .java file)
Method Code:
private void timeStop(String blockName){
synchronized (startLog) {
long now=System.currentTimeMillis();
long started=startLog.get(blockName);
startLog.remove(blockName);
long accum=timingLog.containsKey(blockName) ? timingLog.get(blockName) : 0;
accum+=(now - started);
LinkedList<Long> last10=last10Log.get(blockName);
if (last10 == null) last10=new LinkedList<Long>();
last10.add(now - started);
if (last10.size() > 10) last10.removeFirst();
last10Log.put(blockName,last10);
timingLog.put(blockName,accum);
countLog.put(blockName,(countLog.containsKey(blockName) ? countLog.get(blockName) + 1 : 1));
}
}
Project Name: jbidwatcher Package: com.jbidwatcher.ui
Source Code: SwingMessageQueue.java (Click to view .java file)
Method Code:
public boolean enqueue(String obj){
synchronized (_queue) {
if (_queue.isEmpty() || _queue.getLast() != obj) {
_queue.addLast(obj);
SwingUtilities.invokeLater(this);
return true;
}
}
return false;
}
Project Name: jbidwatcher Package: com.jbidwatcher.util.queue
Source Code: PlainMessageQueue.java (Click to view .java file)
Method Code:
public boolean enqueueObject(Object objToEnqueue){
synchronized (_queue) {
if (_queue.isEmpty() || _queue.getLast() != objToEnqueue) {
_queue.addLast(objToEnqueue);
_queue.notifyAll();
return true;
}
}
return false;
}
Project Name: jbidwatcher Package: com.jbidwatcher.util.queue
Source Code: MessageQueue.java (Click to view .java file)
Method Code:
public void clear(){
synchronized (_queue) {
_queue.clear();
}
}
Project Name: jnode-core Package: org.jnode.assembler.x86
Source Code: X86BinaryAssembler.java (Click to view .java file)
Method Code:
/**
* Set the startoffset of referenced object/label and resolve
* all unresolved references to it.
* @param offset
*/
public void setOffset(int offset){
if (this.dataOffset != -1) {
if (getObject().toString().isEmpty()) {
return;
}
throw new RuntimeException("Offset is already set. Duplicate labels? (" + getObject() + ')');
}
if (offset < 0) {
throw new IllegalArgumentException("Offset: " + offset);
}
this.dataOffset=offset;
if (unresolvedLinks != null) {
for ( UnresolvedOffset unrOfs : unresolvedLinks) {
final int addr=unrOfs.getOffset();
switch (unrOfs.getPatchSize()) {
case 1:
resolve8(addr,offset);
break;
case 4:
resolve32(addr,offset);
break;
case 8:
resolve64(addr,offset);
break;
default :
throw new IllegalArgumentException("Unknown patch size " + unrOfs.getPatchSize());
}
}
unresolvedLinks=null;
}
}
Project Name: jnode-core Package: org.jnode.assembler.x86
Source Code: X86BinaryAssembler.java (Click to view .java file)
Method Code:
/**
* Gets all unresolved references of objects as instanceof ObjectRef
* @return Collection
*/
public final Collection<ObjectRef> getUnresolvedObjectRefs(){
final Collection<X86ObjectRef> coll=getObjectRefs();
final LinkedList<ObjectRef> result=new LinkedList<ObjectRef>();
for ( X86ObjectRef ref : coll) {
if (!ref.isResolved()) {
if (!(ref.getObject() instanceof Label)) {
result.add(ref);
}
}
}
System.out.println("getUnresolvedObjectsRefs: count=" + result.size());
return result;
}
Project Name: jnode-core Package: org.jnode.vm.isolate
Source Code: VmIsolate.java (Click to view .java file)
Method Code:
private synchronized boolean changeState(State newState){
this.state=newState;
IsolateStatus.State newIsolateState=newState.getIsolateState();
if (isolateState != newIsolateState) {
this.isolateState=newIsolateState;
for ( VmLink link : statusLinks) {
sendStatus(link,this.isolateState);
}
}
return true;
}
Project Name: megamek Package: megamek.client.ui.AWT
Source Code: ChatterBox.java (Click to view .java file)
Method Code:
private void fetchHistory(){
try {
inputField.setText(history.get(historyBookmark));
}
catch ( IndexOutOfBoundsException ioobe) {
inputField.setText("");
historyBookmark=-1;
}
}
Project Name: megamek Package: megamek.client.ui.AWT.util
Source Code: ImageCache.java (Click to view .java file)
Method Code:
public synchronized V get(K key){
if (!cache.containsKey(key)) return null;
lru.remove(key);
lru.addLast(key);
return cache.get(key);
}
Project Name: megamek Package: megamek.client.ui.swing
Source Code: ChatterBox.java (Click to view .java file)
Method Code:
/**
*/
public void fetchHistory(){
try {
inputField.setText(history.get(historyBookmark));
cb2.setMessage(inputField.getText());
}
catch ( IndexOutOfBoundsException ioobe) {
inputField.setText("");
cb2.setMessage("");
historyBookmark=-1;
}
}
Project Name: megamek Package: megamek.client.ui.swing.util
Source Code: ImageCache.java (Click to view .java file)
Method Code:
public synchronized V get(K key){
if (!cache.containsKey(key)) return null;
lru.remove(key);
lru.addLast(key);
return cache.get(key);
}
Project Name: megamek Package: megamek.server
Source Code: Server.java (Click to view .java file)
Method Code:
/**
*/
private Packet createSpecialHexDisplayPacket(int toPlayer){
Hashtable<Coords,Collection<SpecialHexDisplay>> shdTable=game.getBoard().getSpecialHexDisplayTable();
Hashtable<Coords,Collection<SpecialHexDisplay>> shdTable2=new Hashtable<Coords,Collection<SpecialHexDisplay>>();
LinkedList<SpecialHexDisplay> tempList=null;
Player player=getPlayer(toPlayer);
if (player != null) {
final String playerName=getPlayer(toPlayer).getName();
for ( Coords coord : shdTable.keySet()) {
tempList=new LinkedList<SpecialHexDisplay>();
for ( SpecialHexDisplay shd : shdTable.get(coord)) {
if (!shd.isObscured() || shd.isOwner(playerName)) {
tempList.add(0,shd);
}
}
if (!tempList.isEmpty()) {
shdTable2.put(coord,tempList);
}
}
}
return new Packet(Packet.COMMAND_SENDING_SPECIAL_HEX_DISPLAY,shdTable2);
}
Project Name: randoop Package: randoop.experiments
Source Code: CovWitnessHelperVisitor.java (Click to view .java file)
Method Code:
/**
* @param tracker the classes that are coverage-instrumented.
*/
public CovWitnessHelperVisitor(CodeCoverageTracker tracker){
if (tracker == null) {
throw new IllegalArgumentException("tracker is null");
}
this.covClasses=tracker.covClasses;
this.covWitnessMap=tracker.branchesToCoveringSeqs;
this.trues=null;
this.falses=null;
}
Project Name: randoop Package: randoop.experiments
Source Code: CodeCoverageTracker.java (Click to view .java file)
Method Code:
@Override public void generationStepPost(ExecutableSequence es){
Set<Branch> cov=new LinkedHashSet<Branch>();
for ( CoverageAtom ca : Coverage.getCoveredAtoms(covClasses)) {
cov.add((Branch)ca);
Set<Sequence> seqs=branchesToCoveringSeqs.get(ca);
if (seqs == null) {
seqs=new LinkedHashSet<Sequence>();
branchesToCoveringSeqs.put(ca,seqs);
}
if (es != null && seqs.isEmpty()) {
seqs.add(es.sequence);
}
}
if (es != null) {
Set<Branch> coveredBranches=cov;
for ( Branch ca : coveredBranches) {
if (branchesCovered.contains(ca)) continue;
branchesCovered.add(ca);
Member member=Coverage.getMemberContaining(ca);
if (member == null) {
branchcov++;
continue;
}
if (member instanceof Method) {
Method method=(Method)member;
addToCount(RMethod.getRMethod(method),1);
continue;
}
assert member instanceof Constructor<?> : member.toString();
Constructor<?> cons=(Constructor<?>)member;
addToCount(RConstructor.getRConstructor(cons),1);
}
}
}
Project Name: rssowl.core Package: org.rssowl.core.internal.persist.migration
Source Code: Migrations.java (Click to view .java file)
Method Code:
private LinkedList<LinkedList<Migration>> findMigrationQueues(LinkedList<LinkedList<Migration>> migrationQueues,int destinationFormat){
boolean changed=false;
LinkedList<LinkedList<Migration>> migrationQueuesCopy=new LinkedList<LinkedList<Migration>>(migrationQueues);
for (ListIterator<LinkedList<Migration>> it=migrationQueuesCopy.listIterator(); it.hasNext(); ) {
LinkedList<Migration> migrationQueue=it.next();
Migration migration=migrationQueue.getLast();
if (migration.getDestinationFormat() == destinationFormat) continue;
it.remove();
for ( Migration innerMigration : fMigrations) {
if (migration.equals(innerMigration)) continue;
if (migration.getDestinationFormat() == innerMigration.getOriginFormat()) {
changed=true;
LinkedList<Migration> newMigrationQueue=new LinkedList<Migration>(migrationQueue);
newMigrationQueue.add(innerMigration);
it.add(newMigrationQueue);
}
}
}
if (changed) return findMigrationQueues(migrationQueuesCopy,destinationFormat);
return migrationQueuesCopy;
}
Project Name: rssowl.core Package: org.rssowl.core.internal.persist.migration
Source Code: Migrations.java (Click to view .java file)
Method Code:
private LinkedList<LinkedList<Migration>> findMigrationQueues(LinkedList<LinkedList<Migration>> migrationQueues,int destinationFormat){
boolean changed=false;
LinkedList<LinkedList<Migration>> migrationQueuesCopy=new LinkedList<LinkedList<Migration>>(migrationQueues);
for (ListIterator<LinkedList<Migration>> it=migrationQueuesCopy.listIterator(); it.hasNext(); ) {
LinkedList<Migration> migrationQueue=it.next();
Migration migration=migrationQueue.getLast();
if (migration.getDestinationFormat() == destinationFormat) continue;
it.remove();
for ( Migration innerMigration : fMigrations) {
if (migration.equals(innerMigration)) continue;
if (migration.getDestinationFormat() == innerMigration.getOriginFormat()) {
changed=true;
LinkedList<Migration> newMigrationQueue=new LinkedList<Migration>(migrationQueue);
newMigrationQueue.add(innerMigration);
it.add(newMigrationQueue);
}
}
}
if (changed) return findMigrationQueues(migrationQueuesCopy,destinationFormat);
return migrationQueuesCopy;
}
Project Name: weka Package: weka.core.tokenizers
Source Code: NGramTokenizer.java (Click to view .java file)
Method Code:
/**
* filters out empty strings in m_SplitString and
* replaces m_SplitString with the cleaned version.
* @see #m_SplitString
*/
protected void filterOutEmptyStrings(){
String[] newSplit;
LinkedList<String> clean=new LinkedList<String>();
for (int i=0; i < m_SplitString.length; i++) {
if (!m_SplitString[i].equals("")) clean.add(m_SplitString[i]);
}
newSplit=new String[clean.size()];
for (int i=0; i < clean.size(); i++) newSplit[i]=clean.get(i);
m_SplitString=newSplit;
}
Project Name: weka Package: weka.gui.beans
Source Code: StripChart.java (Click to view .java file)
Method Code:
/**
* Accept a data point to plot
* @param dataPoint a <code>double[]</code> value
*/
public void acceptDataPoint(double[] dataPoint){
if (m_outputFrame != null && (m_xCount % m_refreshFrequency == 0)) {
double[] dp=new double[dataPoint.length + 1];
dp[dp.length - 1]=m_xCount;
System.arraycopy(dataPoint,0,dp,0,dataPoint.length);
for (int i=0; i < dataPoint.length; i++) {
if (dataPoint[i] < m_min) {
m_oldMin=m_min;
m_min=dataPoint[i];
m_yScaleUpdate=true;
}
if (dataPoint[i] > m_max) {
m_oldMax=m_max;
m_max=dataPoint[i];
m_yScaleUpdate=true;
}
}
if (m_yScaleUpdate) {
m_scalePanel.repaint();
m_yScaleUpdate=false;
}
synchronized (m_dataList) {
m_dataList.add(m_dataList.size(),dp);
m_dataList.notifyAll();
}
}
}