public static FeatureEvidence createFeatureEvidence( String name, CvTerm featureType, Range range) { FeatureEvidence feature = new DefaultFeatureEvidence(name, null, featureType); if (range != null) { feature.getRanges().add(range); } return feature; }
public static FeatureEvidence createFeatureEvidence( String name, CvTerm featureType, Collection<Range> ranges) { FeatureEvidence feature = new DefaultFeatureEvidence(name, null, featureType); if (ranges != null) { feature.getRanges().addAll(ranges); } return feature; }
public static FeatureEvidence createFeatureEvidence( String name, CvTerm featureType, Collection<CvTerm> detectionMethods, Range range) { FeatureEvidence feature = new DefaultFeatureEvidence(name, null, featureType); if (detectionMethods != null) { feature.getDetectionMethods().addAll(detectionMethods); } if (range != null) { feature.getRanges().add(range); } return feature; }
@Test @Ignore public void test_write_interaction_inferred() throws XMLStreamException, IOException, IllegalRangeException { BinaryInteractionEvidence interaction = new DefaultNamedBinaryInteractionEvidence(); ParticipantEvidence participant = new DefaultNamedParticipantEvidence(InteractorUtils.createUnknownBasicInteractor()); ParticipantEvidence participant2 = new DefaultNamedParticipantEvidence(InteractorUtils.createUnknownBasicInteractor()); ParticipantEvidence participant3 = new DefaultNamedParticipantEvidence(InteractorUtils.createUnknownBasicInteractor()); ParticipantEvidence participant4 = new DefaultNamedParticipantEvidence(InteractorUtils.createUnknownBasicInteractor()); // two inferred interactiosn f1, f2, f3 and f3,f4 FeatureEvidence f1 = new DefaultFeatureEvidence(); f1.getRanges().add(RangeUtils.createRangeFromString("1-4")); FeatureEvidence f2 = new DefaultFeatureEvidence(); f2.getRanges().add(RangeUtils.createRangeFromString("1-4")); FeatureEvidence f3 = new DefaultFeatureEvidence(); f1.getLinkedFeatures().add(f2); f1.getLinkedFeatures().add(f3); f2.getLinkedFeatures().add(f1); f2.getLinkedFeatures().add(f3); f3.getLinkedFeatures().add(f1); f3.getLinkedFeatures().add(f2); participant.addFeature(f1); participant2.addFeature(f2); participant3.addFeature(f3); interaction.addParticipant(participant); interaction.addParticipant(participant2); elementCache.clear(); XmlNamedBinaryInteractionEvidenceWriter writer = new XmlNamedBinaryInteractionEvidenceWriter(createStreamWriter(), this.elementCache); writer.write(interaction); streamWriter.flush(); Assert.assertEquals(this.interaction_inferred, output.toString()); }