Changeset 163
- Timestamp:
- 08/19/09 13:33:04 (2 years ago)
- Files:
-
- 1 modified
-
trunk/corelib/src/org/bridgedb/IDMapperStack.java (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/corelib/src/org/bridgedb/IDMapperStack.java
r157 r163 66 66 } 67 67 68 private boolean isTransitive = false; 69 70 /** 71 * Set Transitivity mode, where all mappings are combined to infer 72 * second degree mappings. 73 * @param value true or false 74 */ 75 public void setTransitive(boolean value) 76 { 77 isTransitive = value; 78 } 79 80 /** 81 * @return true if the stack is in transitive mode 82 */ 83 public boolean getTransitive() 84 { 85 return isTransitive; 86 } 87 68 88 /** 69 89 * Remove an idMapper from the stack. … … 244 264 Set<DataSource> tgtDataSources) throws IDMapperException 245 265 { 266 if (isTransitive) 267 { 268 return mapIDtransitive(srcXrefs, tgtDataSources); 269 } 270 else 271 { 272 return mapIDnormal(srcXrefs, tgtDataSources); 273 } 274 } 275 276 /** 277 * helper method to map Id's in non-transitive mode. 278 * @param srcXrefs mapping source 279 * @param tgtDataSources target data sources 280 * @return mapping result 281 * @throws IDMapperException if one of the children fail 282 */ 283 private Map<Xref, Set<Xref>> mapIDnormal(Set<Xref> srcXrefs, 284 Set<DataSource> tgtDataSources) throws IDMapperException 285 { 246 286 Map<Xref, Set<Xref>> result = new HashMap<Xref, Set<Xref>>(); 247 287 … … 265 305 } 266 306 307 /** 308 * helper method to map Id's in transitive mode. 309 * @param srcXrefs mapping source 310 * @param tgtDataSources target data sources 311 * @return mapping result 312 * @throws IDMapperException if one of the children fail 313 */ 314 private Map<Xref, Set<Xref>> mapIDtransitive(Set<Xref> srcXrefs, 315 Set<DataSource> tgtDataSources) throws IDMapperException 316 { 317 throw new UnsupportedOperationException(); 318 } 319 267 320 /** {@inheritDoc} */ 268 321 public Set<String> getAttributes(Xref ref, String attrname) … … 325 378 public Set<Xref> mapID(Xref ref, Set<DataSource> resultDs) throws IDMapperException 326 379 { 380 if (isTransitive) 381 { 382 return mapIDtransitive (ref, resultDs); 383 } 384 else 385 { 386 return mapIDnormal (ref, resultDs); 387 } 388 } 389 390 391 /** 392 * helper method to map Id's in transitive mode. 393 * @param ref Xref to map 394 * @param resultDs target data sources 395 * @return mapping result 396 * @throws IDMapperException if one of the children fail 397 */ 398 private Set<Xref> mapIDtransitive(Xref ref, Set<DataSource> resultDs) throws IDMapperException 399 { 400 throw new UnsupportedOperationException(); 401 } 402 403 /** 404 * helper method to map Id's in transitive mode. 405 * @param ref Xref to map 406 * @param resultDs target data sources 407 * @return mapping result 408 * @throws IDMapperException if one of the children fail 409 */ 410 private Set<Xref> mapIDnormal(Xref ref, Set<DataSource> resultDs) throws IDMapperException 411 { 327 412 Set<Xref> result = new HashSet<Xref>(); 328 413 for (IDMapper child : gdbs) 329 414 { 330 if (child != null && child instanceof AttributeMapper && child.isConnected())415 if (child != null && child.isConnected()) 331 416 { 332 417 result.addAll (child.mapID(ref, resultDs)); … … 336 421 } 337 422 338 339 423 }
