Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] SourceModuleStructureRequestor.java

Hi Roy,

If you are talking about variables, then probably you had better report them via 
enterFieldCheckDuplicates()
so only single model element for each variable would be created.

Another option, if we really want to optimize the case with duplicate element names, could be as below:

private static class Counter {
	int count;
}

private Map<SourceRefElement, Counter> counters = new HashMap<SourceRefElement, Counter>();

protected void resolveDuplicates(SourceRefElement handle) {
	Assert.isTrue(handle.occurrenceCount == 1);
	Counter counter = counters.get(handle);
	if (counter == null) {
		counters.put(handle, new Counter(handle.occurrenceCount));
	} else {
		++counter.count;
		handle.occurrenceCount = counter.count;
	}
	Assert.isTrue(!this.newElements.containsKey(handle));
}

Thoughts?

Regards,
Alex

----- Original Message -----
From: "Roy Ganor" <roy@xxxxxxxx>
To: "DLTK Developer Discussions" <dltk-dev@xxxxxxxxxxx>
Sent: Tuesday, September 1, 2009 12:37:50 AM GMT +06:00 Almaty, Novosibirsk
Subject: RE: [Dltk-dev] SourceModuleStructureRequestor.java

Reverted back, 
the problem here is that we allow n^2*log(n) cycles to find the correct index.

In a script file where 30,000 (ask users why they use it :)) instances are presented the build process is stuck.

Do we really need to keep the 51st and up occurrences? (50 is just as example)
Do you think I can have a limit for such a property?

Thanks for your time,
Roy
-----Original Message-----
From: dltk-dev-bounces@xxxxxxxxxxx [mailto:dltk-dev-bounces@xxxxxxxxxxx] On Behalf Of Alex Panchenko
Sent: Monday, August 31, 2009 7:13 PM
To: DLTK Developer Discussions
Subject: [Dltk-dev] SourceModuleStructureRequestor.java

Hi Roy,

while was correct here.
This code finds unique value, so it might require several increments.

Regards,
Alex

----- Forwarded Message -----
From: "Eclipse CVS Genie" <genie@xxxxxxxxxxx>
To: dltk-commits@xxxxxxxxxxx
Sent: Monday, August 31, 2009 10:38:06 PM GMT +06:00 Almaty, Novosibirsk
Subject: [dltk-commits] rganor org.eclipse.dltk/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core SourceModuleStructureRequestor.java

Update of /cvsroot/technology/org.eclipse.dltk/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core
In directory node1:/tmp/cvs-serv88431/model/org/eclipse/dltk/internal/core

Modified Files:
      Tag: R1_0_maintenance
	SourceModuleStructureRequestor.java 
Log Message:
fix if <> while 

Index: SourceModuleStructureRequestor.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.dltk/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/SourceModuleStructureRequestor.java,v
retrieving revision 1.8
retrieving revision 1.8.4.1
diff -u -d -r1.8 -r1.8.4.1
--- SourceModuleStructureRequestor.java	18 May 2009 16:17:21 -0000	1.8
+++ SourceModuleStructureRequestor.java	31 Aug 2009 15:38:04 -0000	1.8.4.1
@@ -68,7 +68,7 @@
 	 * handle being created until there is no conflict.
 	 */
 	protected void resolveDuplicates(SourceRefElement handle) {
-		while (this.newElements.containsKey(handle)) {
+		if (this.newElements.containsKey(handle)) {
 			handle.occurrenceCount++;
 		}
 	}

_______________________________________________
dltk-commits mailing list
dltk-commits@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-commits
_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev


Back to the top