@Override public void processEvent(Object object, String event, Object new_value, Object old_value) { VariantNameIF vn = (VariantNameIF)object; TopicNameIF bn = vn.getTopicName(); if (bn != null) { TopicIF topic = bn.getTopic(); if (topic != null) topicModified(topic); } } }
public void testTopicName() { assertTrue("parent is not right object", variant.getTopicName().equals(parent)); }
protected void addVariant(VariantNameIF variant) { if (variant == null) throw new NullPointerException(MSG_NULL_ARGUMENT); // Check to see if variant is already a member of this topic name if (variant.getTopicName() == this) return; // Check if used elsewhere. if (variant.getTopicName() != null) throw new ConstraintViolationException("Moving objects is not allowed."); // Notify listeners fireEvent(TopicNameIF.EVENT_ADD_VARIANT, variant, null); // Set parent name property ((VariantName) variant).setTopicName(this); // Notify transaction valueAdded(LF_variants, variant, false); // Add inherited themes to variant name for (TopicIF theme : getScope()) ((VariantName)variant)._addTheme(theme, false); }
public VariantImpl wrapVariant(VariantNameIF variant) { if (variant == null) return null; NameImpl name = nameIndex.getName(variant.getTopicName()); // if we don't have a wrapped name, we create one if (name==null) { name = wrapName(variant.getTopicName()); } VariantImpl v = null; for (Variant tmp : name.getVariants()) { if (((VariantImpl)tmp).getWrapped().equals(variant)) { v = (VariantImpl) tmp; break; } } if (v == null) { v = new VariantImpl(this, name, variant); name.addVariant(v); } return v; }
protected void removeVariant(VariantNameIF variant) { if (variant == null) throw new NullPointerException(MSG_NULL_ARGUMENT); // Check to see if variant is not a member of this topic name if (variant.getTopicName() != this) return; // Notify listeners fireEvent(TopicNameIF.EVENT_REMOVE_VARIANT, null, variant); // Remove inherited themes from variant name for (TopicIF theme : getScope()) ((VariantName)variant)._removeTheme(theme, false); // Unset parent name property ((VariantName) variant).setTopicName(null); // Notify transaction valueRemoved(LF_variants, variant, false); }
name = vn.getTopicName(); else name = vn;
public void testTopic() { TopicIF topic = variant.getTopicName().getTopic(); assertTrue("parent is not right object", variant.getTopic().equals(topic)); }
SnapshotVariantName(VariantNameIF original, int snapshotType, Map<TMObjectIF, SnapshotTMObject> processed) { this.snapshotType = snapshotType; switch (snapshotType) { case SNAPSHOT_REFERENCE: this.objectId = original.getObjectId(); break; case SNAPSHOT_COMPLETE: this.objectId = original.getObjectId(); this.srclocs = new ArrayList<LocatorIF>(original.getItemIdentifiers()); this.basename = SnapshotTopicName.makeSnapshot(original.getTopicName(), SnapshotTopic.SNAPSHOT_REFERENCE, processed); this.topic = SnapshotTopic.makeSnapshot(original.getTopic(), SnapshotTopic.SNAPSHOT_REFERENCE, processed); this.datatype = original.getDataType(); this.value = original.getValue(); this.scope = new ArrayList<TopicIF>(); Iterator<TopicIF> siter = original.getScope().iterator(); while (siter.hasNext()) { this.scope.add(SnapshotTopic.makeSnapshot(siter.next(), snapshotType, processed)); } this.reifier = SnapshotTopic.makeSnapshot(original.getReifier(), SnapshotTopic.SNAPSHOT_REFERENCE, processed); break; default: throw new OntopiaRuntimeException("Unknown snapshot type: " + snapshotType); } }
public void testTopicOfVariant() { assertTrue("parent and grandparent do not agree", variant.getTopicName().getTopic().equals(((TopicNameIF) parent).getTopic())); }
public void testTopic() { if (parent instanceof TopicIF) { // we are now testing a basename assertTrue("parent is not right object", parent.equals(basename.getTopic())); } else { VariantNameIF variant = (VariantNameIF) basename; assertTrue("parent and grandparent do not agree", variant.getTopicName().getTopic().equals(basename.getTopic())); } }
err.println(" Variant name: '" + vn.getValue() + "'"); printScope(vn.getScope()); err.println(" Topic: " + printTopic(vn.getTopicName().getTopic()));
object = ((VariantNameIF) matches.data[ix][ix1]).getTopicName(); break; case FILTER_ASSOCIATION_ROLE:
@Test public void testVariant() throws Exception { TopicNameIF name = tm1.getBuilder().makeTopicName(foo1, foo1, "foo"); VariantNameIF variant = tm1.getBuilder().makeVariantName(name, "foo", Collections.singletonList(foo1)); variant.setReifier(foo1); concurrentCommit(); // verify no inconsistenties were created check(tm1, variant.getTopicName(), "Variant", "name"); check(tm1, variant.getReifier(), "Variant", "reifier"); // todo: scope, pending #265 }
newRow[toix] = ((VariantNameIF) newRow[fromix]).getTopicName(); break; case SUBJLOC_TO_TOPIC: