[Nice-commit] Nice/src/bossa/link Alternative.java,1.38,1.39 Dispatch.java,1.50,1.51
Brought to you by:
bonniot
|
From: <ar...@us...> - 2003-03-19 21:14:34
|
Update of /cvsroot/nice/Nice/src/bossa/link
In directory sc8-pr-cvs1:/tmp/cvs-serv21415/F:/nice/src/bossa/link
Modified Files:
Alternative.java Dispatch.java
Log Message:
Don't dispatch-test duplicate tuples anymore.
Index: Alternative.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/link/Alternative.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** Alternative.java 25 Feb 2003 12:30:57 -0000 1.38
--- Alternative.java 19 Mar 2003 21:14:29 -0000 1.39
***************
*** 170,175 ****
public Pattern[] getPatterns() { return patterns; }
- boolean visiting;
-
/****************************************************************
* Regrouping alternatives per method
--- 170,173 ----
Index: Dispatch.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/link/Dispatch.java,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** Dispatch.java 25 Feb 2003 12:30:58 -0000 1.50
--- Dispatch.java 19 Mar 2003 21:14:30 -0000 1.51
***************
*** 353,371 ****
{
LinkedList res = new LinkedList();
!
for (Iterator i = tuples.iterator(); i.hasNext();)
! add(res, flatten((TypeConstructor[]) i.next(), length));
!
return res;
}
! private static void add(List tuples, TypeConstructor[] tags)
{
! // FIXME
! // This implementation creates duplicate tuples
! tuples.add(tags);
! }
/**
Translates (nullTC, *) into nullTC and (sureTC, tc) into tc
--- 353,398 ----
{
LinkedList res = new LinkedList();
! Set tupleSet = new TreeSet(tagComp);
for (Iterator i = tuples.iterator(); i.hasNext();)
! {
! TypeConstructor[] tags = flatten((TypeConstructor[]) i.next(), length);
! //add only non duplicate tags
! if (tupleSet.add(tags))
! res.add(tags);
! }
return res;
}
! private static Comparator tagComp = new TagComparator();
!
! private static class TagComparator implements Comparator
{
! public TagComparator(){}
!
! public int compare(Object o1, Object o2)
! {
! TypeConstructor[] tc1 = (TypeConstructor[])o1;
! TypeConstructor[] tc2 = (TypeConstructor[])o2;
! if (tc1 == null) return -1; //these cases does happen
! if (tc2 == null) return 1; //for some strange reason
! for(int i = 0; i<tc1.length; i++)
! {
! if (tc1[i] == null) return -1;
! if (tc2[i] == null) return 1;
! int a = tc1[i].getId();
! int b = tc2[i].getId();
! if (a<b) return -1;
! if (a>b) return 1;
! }
! return 0;
! }
+ public boolean equals(Object obj)
+ {
+ return false;
+ }
+
+ }
/**
Translates (nullTC, *) into nullTC and (sureTC, tc) into tc
***************
*** 378,382 ****
{
TypeConstructor[] res = new TypeConstructor[length];
-
for (int i = length; --i >= 0 ;)
if (tags[2 * i] == PrimitiveType.nullTC)
--- 405,408 ----
|