Envision
A visual programming IDE for object-oriented languages
List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
FilePersistence::ChangeGraph Class Reference

Classes

struct  LabelData
 

Public Types

using IdToLabelMap = QMultiHash< Model::NodeIdType, LabelData >
 

Public Member Functions

 ~ChangeGraph ()
 
void applyNonConflictingChanges (GenericTree *tree)
 
const QList< MergeChange * > & changes () const
 
QList< MergeChange * > changesDependingOn (MergeChange *change) const
 
QList< MergeChange * > changesForChildren (Model::NodeIdType nodeId) const
 
QList< MergeChange * > changesForNode (Model::NodeIdType nodeId) const
 
QList< MergeChange * > changesInDirectConflict () const
 
QList< MergeChange * > dependenciesOf (MergeChange *change) const
 
QList< MergeChange * > directConflictsOf (MergeChange *change) const
 
bool hasDirectConflicts () const
 
void init (Diff &diffA, Diff &diffB, GenericTree *tree)
 Adds all changes from both diffs to the change graph. More...
 
void insert (QList< MergeChange * > changes, GenericTree *tree)
 Inserts the provided changes in the change graph. More...
 
void relabelChildrenUniquely (Model::NodeIdType parentId, IdToLabelMap labelMap, GenericTree *tree)
 
void removeDeleteChangesConflictingWithMoveOrRelabel (MergeChange *rootDeleteChange)
 

Private Member Functions

void applyChange (GenericTree *tree, MergeChange *change)
 
int applyIndependentNonConflictingChanges (GenericTree *tree)
 Applies all non-conflicting changes that are not in an all-or-nothing dependency chain and returns their count. More...
 
void createRelabelChanges (Model::NodeIdType nodeId, QString oldLabel, QList< LabelData > newLabels, Model::NodeIdType parentId)
 
MergeChangefindIdenticalChange (const MergeChange *change) const
 
void insertSingleChange (MergeChange *change)
 
void removeChange (MergeChange *change, bool mayHaveConflicts)
 
QList< MergeChange * >::iterator removeChange (QList< MergeChange * >::iterator changeIt, bool mayHaveConflicts)
 
void removeLabelConflictsBetweenChildren (Model::NodeIdType parentId)
 
void removeLabelDependenciesBetweenChildren (Model::NodeIdType parentId)
 
void removeLabelOnlyChangesInChildren (Model::NodeIdType parentId)
 
void splitMoveInOrInsertChangeForSecondLabel (MergeChange *change, LabelData labelOne, LabelData labelTwo)
 
void updateLabelsOfChangesTo (Model::NodeIdType parentId, IdToLabelMap labelMap, GenericTree *tree)
 
void updateTreeLabels (Model::NodeIdType parentId, IdToLabelMap labelMap, GenericTree *tree)
 

Private Attributes

QList< MergeChange * > changes_
 
QMultiHash< Model::NodeIdType, MergeChange * > changesForChildren_
 
QMultiHash< Model::NodeIdType, MergeChange * > changesForNode_
 
Dependencies dependencies_ {changes_, changesForNode_, changesForChildren_}
 
Conflicts directConflicts_ {changes_, changesForNode_, changesForChildren_}
 

Static Private Attributes

static const QString NEW_NODES_PERSISTENT_UNIT_NAME {"ChangeGraphNewNodes"}
 

Member Typedef Documentation

◆ IdToLabelMap

Constructor & Destructor Documentation

◆ ~ChangeGraph()

FilePersistence::ChangeGraph::~ChangeGraph ( )

Member Function Documentation

◆ applyChange()

void FilePersistence::ChangeGraph::applyChange ( GenericTree tree,
MergeChange change 
)
private

◆ applyIndependentNonConflictingChanges()

int FilePersistence::ChangeGraph::applyIndependentNonConflictingChanges ( GenericTree tree)
private

Applies all non-conflicting changes that are not in an all-or-nothing dependency chain and returns their count.

◆ applyNonConflictingChanges()

void FilePersistence::ChangeGraph::applyNonConflictingChanges ( GenericTree tree)

◆ changes()

const QList< MergeChange * > & FilePersistence::ChangeGraph::changes ( ) const
inline

◆ changesDependingOn()

QList< MergeChange * > FilePersistence::ChangeGraph::changesDependingOn ( MergeChange change) const
inline

◆ changesForChildren()

QList< MergeChange * > FilePersistence::ChangeGraph::changesForChildren ( Model::NodeIdType  nodeId) const
inline

◆ changesForNode()

QList< MergeChange * > FilePersistence::ChangeGraph::changesForNode ( Model::NodeIdType  nodeId) const
inline

◆ changesInDirectConflict()

QList< MergeChange * > FilePersistence::ChangeGraph::changesInDirectConflict ( ) const
inline

◆ createRelabelChanges()

void FilePersistence::ChangeGraph::createRelabelChanges ( Model::NodeIdType  nodeId,
QString  oldLabel,
QList< LabelData newLabels,
Model::NodeIdType  parentId 
)
private

◆ dependenciesOf()

QList< MergeChange * > FilePersistence::ChangeGraph::dependenciesOf ( MergeChange change) const
inline

◆ directConflictsOf()

QList< MergeChange * > FilePersistence::ChangeGraph::directConflictsOf ( MergeChange change) const
inline

◆ findIdenticalChange()

MergeChange * FilePersistence::ChangeGraph::findIdenticalChange ( const MergeChange change) const
private

◆ hasDirectConflicts()

bool FilePersistence::ChangeGraph::hasDirectConflicts ( ) const
inline

◆ init()

void FilePersistence::ChangeGraph::init ( Diff diffA,
Diff diffB,
GenericTree tree 
)

Adds all changes from both diffs to the change graph.

The tree is the tree which the changes will mutate.

◆ insert()

void FilePersistence::ChangeGraph::insert ( QList< MergeChange * >  changes,
GenericTree tree 
)
inline

Inserts the provided changes in the change graph.

This operation will recompute all dependencies. The changes are assumed to modify the tree.

◆ insertSingleChange()

void FilePersistence::ChangeGraph::insertSingleChange ( MergeChange change)
private

◆ relabelChildrenUniquely()

void FilePersistence::ChangeGraph::relabelChildrenUniquely ( Model::NodeIdType  parentId,
IdToLabelMap  labelMap,
GenericTree tree 
)

◆ removeChange() [1/2]

void FilePersistence::ChangeGraph::removeChange ( MergeChange change,
bool  mayHaveConflicts 
)
private

◆ removeChange() [2/2]

QList< MergeChange * >::iterator FilePersistence::ChangeGraph::removeChange ( QList< MergeChange * >::iterator  changeIt,
bool  mayHaveConflicts 
)
private

◆ removeDeleteChangesConflictingWithMoveOrRelabel()

void FilePersistence::ChangeGraph::removeDeleteChangesConflictingWithMoveOrRelabel ( MergeChange rootDeleteChange)

◆ removeLabelConflictsBetweenChildren()

void FilePersistence::ChangeGraph::removeLabelConflictsBetweenChildren ( Model::NodeIdType  parentId)
private

◆ removeLabelDependenciesBetweenChildren()

void FilePersistence::ChangeGraph::removeLabelDependenciesBetweenChildren ( Model::NodeIdType  parentId)
private

◆ removeLabelOnlyChangesInChildren()

void FilePersistence::ChangeGraph::removeLabelOnlyChangesInChildren ( Model::NodeIdType  parentId)
private

◆ splitMoveInOrInsertChangeForSecondLabel()

void FilePersistence::ChangeGraph::splitMoveInOrInsertChangeForSecondLabel ( MergeChange change,
LabelData  labelOne,
LabelData  labelTwo 
)
private

◆ updateLabelsOfChangesTo()

void FilePersistence::ChangeGraph::updateLabelsOfChangesTo ( Model::NodeIdType  parentId,
IdToLabelMap  labelMap,
GenericTree tree 
)
private

◆ updateTreeLabels()

void FilePersistence::ChangeGraph::updateTreeLabels ( Model::NodeIdType  parentId,
IdToLabelMap  labelMap,
GenericTree tree 
)
private

Member Data Documentation

◆ changes_

QList<MergeChange*> FilePersistence::ChangeGraph::changes_
private

◆ changesForChildren_

QMultiHash<Model::NodeIdType, MergeChange*> FilePersistence::ChangeGraph::changesForChildren_
private

◆ changesForNode_

QMultiHash<Model::NodeIdType, MergeChange*> FilePersistence::ChangeGraph::changesForNode_
private

◆ dependencies_

Dependencies FilePersistence::ChangeGraph::dependencies_ {changes_, changesForNode_, changesForChildren_}
private

◆ directConflicts_

Conflicts FilePersistence::ChangeGraph::directConflicts_ {changes_, changesForNode_, changesForChildren_}
private

◆ NEW_NODES_PERSISTENT_UNIT_NAME

const QString FilePersistence::ChangeGraph::NEW_NODES_PERSISTENT_UNIT_NAME {"ChangeGraphNewNodes"}
staticprivate