Show
Ignore:
Timestamp:
08/22/09 20:23:17 (3 years ago)
Author:
martijn
Message:

Work on transitive mapping in Stack
Also added unit test and data file
Not yet implemented for mapID(Set<Xref>, ...

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/corelib/src/org/bridgedb/IDMapperStack.java

    r163 r168  
    398398        private Set<Xref> mapIDtransitive(Xref ref, Set<DataSource> resultDs) throws IDMapperException  
    399399        { 
    400                 throw new UnsupportedOperationException(); 
     400                // first round 
     401                Set<Xref> round1 = new HashSet<Xref>(); 
     402                for (IDMapper child : gdbs) 
     403                { 
     404                        if (child != null && child.isConnected()) 
     405                        { 
     406                                round1.addAll (child.mapID(ref, null)); 
     407                        } 
     408                } 
     409                // second round 
     410                Set<Xref> round2 = new HashSet<Xref>(); 
     411                for (IDMapper child : gdbs) 
     412                { 
     413                        if (child != null && child.isConnected()) 
     414                        { 
     415                                for (Set<Xref> set : child.mapID(round1, resultDs).values()) 
     416                                        round2.addAll (set); 
     417                        } 
     418                } 
     419                return round2; 
    401420        } 
    402421