void KstEquation::replaceDependency(KstVectorPtr oldVector, KstVectorPtr newVector) { QString oldTag = oldVector->tagName(); QString newTag = newVector->tagName(); // replace all occurences of oldTag with newTag QString newExp = _equation.replace("["+oldTag+"]", "["+newTag+"]"); // also replace all occurences of scalar stats for the oldVector QDictIterator<KstScalar> scalarDictIter(oldVector->scalars()); for (; scalarDictIter.current(); ++scalarDictIter) { QString oldTag = scalarDictIter.current()->tagName(); QString newTag = ((newVector->scalars())[scalarDictIter.currentKey()])->tagName(); newExp = newExp.replace("[" + oldTag + "]", "[" + newTag + "]"); } setEquation(newExp); // do the dependency replacements for _inputVectors, but don't call parent function as it // replaces _inputScalars for (KstVectorMap::Iterator j = _inputVectors.begin(); j != _inputVectors.end(); ++j) { if (j.data() == oldVector) { _inputVectors[j.key()] = newVector; } } }
void KstDataObject::replaceDependency(KstVectorPtr oldVector, KstVectorPtr newVector) { for (KstVectorMap::Iterator j = _inputVectors.begin(); j != _inputVectors.end(); ++j) { if (*j == oldVector) { _inputVectors[j.key()] = newVector; } } for (KstScalarMap::Iterator j = _inputScalars.begin(); j != _inputScalars.end(); ++j) { for (ScalarCollection::const_iterator l = oldVector->scalars().begin(); l != oldVector->scalars().end(); ++l) { if (*l == *j) { _inputScalars[j.key()] = (newVector->scalars())[l.key()]; } } } }
void EventMonitorEntry::replaceDependency(KstVectorPtr oldVector, KstVectorPtr newVector) { // replace all occurences of oldTag with newTag QString newExp = _event.replace("[" + oldVector->tagName() + "]", "[" + newVector->tagName() + "]"); // also replace all occurences of vector stats for the oldVector QHashIterator<QString, KstScalar*> scalarDictIter(oldVector->scalars()); while (scalarDictIter.hasNext()) { const QString oldTag = scalarDictIter.next().value()->tagName(); const QString newTag = newVector->scalars()[scalarDictIter.key()]->tagName(); newExp = newExp.replace("[" + oldTag + "]", "[" + newTag + "]"); } setEvent(newExp); setDirty(); // events have no _inputVectors }