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

Classes

struct  IdPosition
 

Public Member Functions

virtual void run (MergeData &mergeData) override
 
- Public Member Functions inherited from FilePersistence::MergePipelineComponent
virtual ~MergePipelineComponent ()
 

Static Public Member Functions

static bool isList (const QString &type)
 
static bool isOrderedList (const QString &type)
 
static bool isUnorderedList (const QString &type)
 

Private Types

enum class  Phase : int { Initial , RelabelComplete , HolesRemoved }
 

Private Member Functions

ChangeGraph::IdToLabelMap computeAdjustedIndices (Model::NodeIdType listId, MergeData &mergeData)
 Returns the map of new labels(Integral) of list. More...
 
QList< Model::NodeIdTypecomputeListsToMerge (MergeData &mergeData)
 Finds all the lists that we will process in the merge. More...
 
void computeOffsetsInBranch (const QList< Model::NodeIdType > base, const QList< Model::NodeIdType > version, QList< IdPosition > &list, std::shared_ptr< GenericTree > treeBase, MergeChange::Branches branch)
 Fills the list with the indices mapped to proper positions relative to Base. More...
 
QList< Chunk * > listToChunks (Model::NodeIdType listId, MergeData &mergeData)
 Returns chunks for the given list. More...
 
QList< Model::NodeIdTypenodeListToSortedIdList (const QList< GenericNode * > &list)
 Returns list of nodeIds sorted by labels that is used for computing chunks. More...
 
void printFinalList (const QList< Model::NodeIdType > lists, GenericTree *tree, ChangeGraph &cg)
 For Debugging purpose, prints the list and unapplied changes To be callled after removing holes, at the end of ListMerge Component. More...
 
void printLabelMap (ChangeGraph::IdToLabelMap map)
 
void removeHoles (GenericTree *tree, ChangeGraph &cg)
 Removes Holes from listsToMerge_, makes it continuous and adjusts the CG according to it It gives fractional indices for the elements that were supposed to move in or inserted in the holes. More...
 

Private Attributes

QList< Model::NodeIdTypelistsToMerge_ {}
 
Phase phase_ {Phase::Initial}
 

Member Enumeration Documentation

◆ Phase

Enumerator
Initial 
RelabelComplete 
HolesRemoved 

Member Function Documentation

◆ computeAdjustedIndices()

ChangeGraph::IdToLabelMap FilePersistence::ListMergeComponent::computeAdjustedIndices ( Model::NodeIdType  listId,
MergeData mergeData 
)
private

Returns the map of new labels(Integral) of list.

so that all labels are unique.

◆ computeListsToMerge()

QList< Model::NodeIdType > FilePersistence::ListMergeComponent::computeListsToMerge ( MergeData mergeData)
private

Finds all the lists that we will process in the merge.

Finds the lists having structure changes. Assumes Insertion/Deletion of whole list does not happen.

◆ computeOffsetsInBranch()

void FilePersistence::ListMergeComponent::computeOffsetsInBranch ( const QList< Model::NodeIdType base,
const QList< Model::NodeIdType version,
QList< IdPosition > &  list,
std::shared_ptr< GenericTree treeBase,
MergeChange::Branches  branch 
)
private

Fills the list with the indices mapped to proper positions relative to Base.

◆ isList()

bool FilePersistence::ListMergeComponent::isList ( const QString &  type)
static

◆ isOrderedList()

bool FilePersistence::ListMergeComponent::isOrderedList ( const QString &  type)
static

◆ isUnorderedList()

bool FilePersistence::ListMergeComponent::isUnorderedList ( const QString &  type)
static

◆ listToChunks()

QList< Chunk * > FilePersistence::ListMergeComponent::listToChunks ( Model::NodeIdType  listId,
MergeData mergeData 
)
private

Returns chunks for the given list.

◆ nodeListToSortedIdList()

QList< Model::NodeIdType > FilePersistence::ListMergeComponent::nodeListToSortedIdList ( const QList< GenericNode * > &  list)
private

Returns list of nodeIds sorted by labels that is used for computing chunks.

◆ printFinalList()

void FilePersistence::ListMergeComponent::printFinalList ( const QList< Model::NodeIdType lists,
GenericTree tree,
ChangeGraph cg 
)
private

For Debugging purpose, prints the list and unapplied changes To be callled after removing holes, at the end of ListMerge Component.

◆ printLabelMap()

void FilePersistence::ListMergeComponent::printLabelMap ( ChangeGraph::IdToLabelMap  map)
private

◆ removeHoles()

void FilePersistence::ListMergeComponent::removeHoles ( GenericTree tree,
ChangeGraph cg 
)
private

Removes Holes from listsToMerge_, makes it continuous and adjusts the CG according to it It gives fractional indices for the elements that were supposed to move in or inserted in the holes.

◆ run()

void FilePersistence::ListMergeComponent::run ( MergeData mergeData)
overridevirtual

Member Data Documentation

◆ listsToMerge_

QList<Model::NodeIdType> FilePersistence::ListMergeComponent::listsToMerge_ {}
private

◆ phase_

Phase FilePersistence::ListMergeComponent::phase_ {Phase::Initial}
private