@Test public void testNoType() { LocatorIF locD = makeLocator("D"); TopicIF otype = builder.makeTopic(); OccurrenceIF occC = builder.makeOccurrence(getTopic("C"), otype, locD); SubjectIdentityDecider decider = new SubjectIdentityDecider(locD); Assert.assertTrue("Decider recognized occurrence it shouldn't recognize", !decider.ok(occC)); }
@Override public boolean ok(T object) { if (object instanceof TopicIF) { TopicIF topic = (TopicIF) object; if (topic.getSubjectIdentifiers().contains(subject_identifier)) return true; } if (object instanceof TypedIF) { TopicIF topic = ((TypedIF) object).getType(); if (topic == null) return false; return topic.getSubjectIdentifiers().contains(subject_identifier); } else if (object instanceof TopicIF) { Iterator<TopicIF> it = ((TopicIF) object).getTypes().iterator(); while (it.hasNext()) { TopicIF topic = it.next(); if (topic.getSubjectIdentifiers().contains(subject_identifier)) return true; } } return false; }
SubjectIdentityDecider implements DeciderIF<T> { @Override public boolean ok(T object) { if (object instanceof TopicIF) { TopicIF topic = (TopicIF) object; if (topic.getSubjectIdentifiers().contains(subject_identifier)) return true; } if (object instanceof TypedIF) { TopicIF topic = ((TypedIF) object).getType(); if (topic == null) return false; return topic.getSubjectIdentifiers().contains(subject_identifier); } else if (object instanceof TopicIF) { Iterator<TopicIF> it = ((TopicIF) object).getTypes().iterator(); while (it.hasNext()) { TopicIF topic = it.next(); if (topic.getSubjectIdentifiers().contains(subject_identifier)) return true; } } return false; } }
SubjectIdentityDecider implements DeciderIF<T> { @Override public boolean ok(T object) { if (object instanceof TopicIF) { TopicIF topic = (TopicIF) object; if (topic.getSubjectIdentifiers().contains(subject_identifier)) return true; } if (object instanceof TypedIF) { TopicIF topic = ((TypedIF) object).getType(); if (topic == null) return false; return topic.getSubjectIdentifiers().contains(subject_identifier); } else if (object instanceof TopicIF) { Iterator<TopicIF> it = ((TopicIF) object).getTypes().iterator(); while (it.hasNext()) { TopicIF topic = it.next(); if (topic.getSubjectIdentifiers().contains(subject_identifier)) return true; } } return false; } SubjectIdentityDecider(LocatorIF subject_identifier); }
SubjectIdentityDecider implements DeciderIF<T> { @Override public boolean ok(T object) { if (object instanceof TopicIF) { TopicIF topic = (TopicIF) object; if (topic.getSubjectIdentifiers().contains(subject_identifier)) return true; } if (object instanceof TypedIF) { TopicIF topic = ((TypedIF) object).getType(); if (topic == null) return false; return topic.getSubjectIdentifiers().contains(subject_identifier); } else if (object instanceof TopicIF) { Iterator<TopicIF> it = ((TopicIF) object).getTypes().iterator(); while (it.hasNext()) { TopicIF topic = it.next(); if (topic.getSubjectIdentifiers().contains(subject_identifier)) return true; } } return false; } SubjectIdentityDecider(LocatorIF subject_identifier); @Override boolean ok(T object); }
SubjectIdentityDecider implements DeciderIF<T> { @Override public boolean ok(T object) { if (object instanceof TopicIF) { TopicIF topic = (TopicIF) object; if (topic.getSubjectIdentifiers().contains(subject_identifier)) return true; } if (object instanceof TypedIF) { TopicIF topic = ((TypedIF) object).getType(); if (topic == null) return false; return topic.getSubjectIdentifiers().contains(subject_identifier); } else if (object instanceof TopicIF) { Iterator<TopicIF> it = ((TopicIF) object).getTypes().iterator(); while (it.hasNext()) { TopicIF topic = it.next(); if (topic.getSubjectIdentifiers().contains(subject_identifier)) return true; } } return false; } SubjectIdentityDecider(LocatorIF subject_identifier); @Override boolean ok(T object);  }