@Override public Collection<TopicNameIF> getTopicNamesByType(TopicIF type) { Set<TopicNameIF> namesbytype = topicmap.cfactory.makeSmallSet(); for (TopicNameIF name : names) { if (name.getType().equals(type)) { namesbytype.add(name); } } return Collections.unmodifiableSet(namesbytype); }
public static List<TopicNameIF> findTopicNames(TopicIF nType, TopicIF topicIF) { List<TopicNameIF> result = new ArrayList<TopicNameIF>(); Iterator<TopicNameIF> it = topicIF.getTopicNames().iterator(); while (it.hasNext()) { TopicNameIF nameIF = it.next(); if (Objects.equals(nameIF.getType(), nType)) result.add(nameIF); } return result; }
@Override public Topic getType() { return topicMap.wrapTopic(wrapped.getType()); }
public static List<TopicNameIF> findTopicNames(TopicIF nType, TopicIF topicIF, String value) { List<TopicNameIF> result = new ArrayList<TopicNameIF>(); Iterator<TopicNameIF> it = topicIF.getTopicNames().iterator(); while (it.hasNext()) { TopicNameIF nameIF = it.next(); if (Objects.equals(nameIF.getValue(), value) && Objects.equals(nameIF.getType(), nType)) result.add(nameIF); } return result; }
public static List<TopicNameIF> findTopicNames(TopicIF nType, TopicIF topicIF) { List<TopicNameIF> result = new ArrayList<TopicNameIF>(); Iterator<TopicNameIF> it = topicIF.getTopicNames().iterator(); while (it.hasNext()) { TopicNameIF nameIF = it.next(); if (ObjectUtils.equals(nameIF.getType(), nType)) result.add(nameIF); } return result; }
public static List<TopicNameIF> findTopicNames(TopicIF nType, TopicIF topicIF, Collection<TopicIF> scope) { List<TopicNameIF> result = new ArrayList<TopicNameIF>(); Iterator<TopicNameIF> it = topicIF.getTopicNames().iterator(); while (it.hasNext()) { TopicNameIF nameIF = it.next(); if (Objects.equals(nameIF.getType(), nType) && CollectionUtils.equalsUnorderedSet(nameIF.getScope(), scope)) result.add(nameIF); } return result; }
public static List<TopicNameIF> findTopicNames(TopicIF nType, TopicIF topicIF, String value, Collection<TopicIF> scope) { List<TopicNameIF> result = new ArrayList<TopicNameIF>(); Iterator<TopicNameIF> it = topicIF.getTopicNames().iterator(); while (it.hasNext()) { TopicNameIF nameIF = it.next(); if (Objects.equals(nameIF.getValue(), value) && Objects.equals(nameIF.getType(), nType) && CollectionUtils.equalsUnorderedSet(nameIF.getScope(), scope)) result.add(nameIF); } return result; }
public static List<TopicNameIF> findTopicNames(TopicIF nType, TopicIF topicIF, Collection<TopicIF> scope) { List<TopicNameIF> result = new ArrayList<TopicNameIF>(); Iterator<TopicNameIF> it = topicIF.getTopicNames().iterator(); while (it.hasNext()) { TopicNameIF nameIF = it.next(); if (ObjectUtils.equals(nameIF.getType(), nType) && CollectionUtils.equalsUnorderedSet(nameIF.getScope(), scope)) result.add(nameIF); } return result; }
public static List<TopicNameIF> findTopicNames(TopicIF nType, TopicIF topicIF, String value) { List<TopicNameIF> result = new ArrayList<TopicNameIF>(); Iterator<TopicNameIF> it = topicIF.getTopicNames().iterator(); while (it.hasNext()) { TopicNameIF nameIF = it.next(); if (ObjectUtils.equals(nameIF.getValue(), value) && ObjectUtils.equals(nameIF.getType(), nType)) result.add(nameIF); } return result; }
public static List<TopicNameIF> findTopicNames(TopicIF nType, TopicIF topicIF, String value, Collection<TopicIF> scope) { List<TopicNameIF> result = new ArrayList<TopicNameIF>(); Iterator<TopicNameIF> it = topicIF.getTopicNames().iterator(); while (it.hasNext()) { TopicNameIF nameIF = it.next(); if (ObjectUtils.equals(nameIF.getValue(), value) && ObjectUtils.equals(nameIF.getType(), nType) && CollectionUtils.equalsUnorderedSet(nameIF.getScope(), scope)) result.add(nameIF); } return result; }
@Override public void run(MasterTest mt) { TopicNameIF bn = (TopicNameIF)topicmap.getObjectById(mt.objectId); assertTrue("Base name theme is set", bn.getType() == null); } });
@Override public TypedIF getTyped(TopicIF topic) { if (topic.getTopicNames().size() == 0) { return null; } TopicNameIF name = topic.getTopicNames().iterator().next(); if (name.getType().getSubjectIdentifiers().contains(PSI.getSAMNameType())) { return null; } return name; } });
@Override public TypedIF getTyped(TopicIF topic) { if (topic.getTopicNames().size() == 0) { return null; } TopicNameIF name = topic.getTopicNames().iterator().next(); if (name.getType().getSubjectIdentifiers().contains(PSI.getSAMNameType())) { return null; } return name; } });
@Override public void run(MasterTest mt) { TopicNameIF bn = (TopicNameIF)topicmap.getObjectById(mt.objectId); TopicIF type = (TopicIF)topicmap.getObjectById(mt.value); assertTrue("Base name theme is not set", type.equals(bn.getType())); } });
public boolean ok(Object object) { if (object instanceof TopicIF) { return includeTopic((TopicIF)object); } else if (object instanceof AssociationIF) { return includeTopic(((AssociationIF)object).getType()); } else if (object instanceof OccurrenceIF) { return includeTopic(((OccurrenceIF)object).getType()); } else if (object instanceof TopicNameIF) { TopicIF type = ((TopicNameIF)object).getType(); return type == null ? true : includeTopic(type); } return true; }
/** * INTERNAL: Copies the name from the source topic to the * target topic. * * @since 4.0 */ public static TopicNameIF copyTopicName(TopicIF target, TopicNameIF source) { TopicMapBuilderIF builder = target.getTopicMap().getBuilder(); TopicNameIF n = builder.makeTopicName(target, source.getType(), source.getValue()); copyScope(n, source); copyVariants(n, source); return n; }
@Override public void run(MasterTest mt) { TopicNameIF bn = (TopicNameIF)topicmap.getObjectById(mt.objectId); assertTrue("Added base name not found", bn != null); if (testInitialProperties) { assertTrue("Source locators is set", bn.getItemIdentifiers().isEmpty()); assertTrue("Scope is set", bn.getScope().isEmpty()); assertTrue("Type is set", bn.getType() == null); assertTrue("Value is set", "".equals(bn.getValue())); assertTrue("Variants is set", bn.getVariants().isEmpty()); } } });
public void testMergeTopicNameTypeUse() { try { TopicIF t1 = builder1.makeTopic(); TopicIF t2 = builder1.makeTopic(); TopicNameIF bn = builder1.makeTopicName(t1, t2, ""); MergeUtils.mergeInto(t1, t2); assertTrue("basename type replacement not done correctly", bn.getType().equals(t1)); } catch (ConstraintViolationException e) { fail("merge of topics unaccountably failed" + e.getMessage()); } }
@Test public void testTopicName() throws Exception { TopicNameIF name = tm1.getBuilder().makeTopicName(foo1, foo1, "foo"); name.setReifier(foo1); // todo: scope, pending #265 concurrentCommit(); // verify no inconsistenties were created check(tm1, name.getType(), "Topic name", "type"); check(tm1, name.getTopic(), "Topic name", "topic"); check(tm1, name.getReifier(), "Topic name", "reifier"); }