org.eclipse.emf.emfstore.internal.client.model.changeTracking.merging
Class DecisionManager

java.lang.Object
  extended by org.eclipse.emf.emfstore.internal.client.model.changeTracking.merging.DecisionManager

public class DecisionManager
extends Object

DecisionManager is the controller for the merge dialog and therefore it's main component. It calculates the conflicts from incoming changes and can execute resolved conflicts.

Author:
wesendon

Constructor Summary
DecisionManager(Project project, ChangeConflictSet changeConflict, boolean isBranchMerge)
          Default constructor.
 
Method Summary
 void calcResult()
          If all conflicts are resolved this method will generate the resulting operations from the conflicts.
 int countMyLeafOperations()
          Count my leaf operations.
 int countMyOperations()
          Count my leaf operations.
 int countTheirLeafOperations()
          Count their leaf operations.
 int countTheirOperations()
          Count their leaf operations.
 String getAuthorForOperation(AbstractOperation theirOperation)
          Returns the name of the author for a operation in list of their operations.
 ConflictDetector getConflictDetector()
          Returns the conflictdetector.
 ArrayList<VisualConflict> getConflicts()
          Returns the conflicts.
 ModelElementIdToEObjectMapping getIdToEObjectMapping()
          Returns the mapping that is used to resolve model elements correctly.
 org.eclipse.emf.ecore.EObject getModelElement(ModelElementId modelElementId)
          Returns the model element.
 String getModelElementName(org.eclipse.emf.ecore.EObject modelElement)
          Get the Name of an model element.
 String getModelElementName(ModelElementId modelElementId)
          Get the Name of an model element by modelelement id.
 Project getProject()
          Returns the project on which the decision manager is working on.
 boolean isBranchMerge()
          Flat whether branches are merged opposed to versions on the same branch.
 boolean isResolved()
          Checks whether all conflicts are resolved.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DecisionManager

public DecisionManager(Project project,
                       ChangeConflictSet changeConflict,
                       boolean isBranchMerge)
Default constructor.

Parameters:
project - the related project
changeConflict - the ChangeConflictSet containing the changes leading to a potential conflict
isBranchMerge - allows to specify whether two branches are merged, opposed to changes from the same branch. Has an effect on the wording of conflicts
Method Detail

getConflicts

public ArrayList<VisualConflict> getConflicts()
Returns the conflicts.

Returns:
list of conflicts.

isResolved

public boolean isResolved()
Checks whether all conflicts are resolved.

Returns:
true if all are resolved

calcResult

public void calcResult()
If all conflicts are resolved this method will generate the resulting operations from the conflicts.


getConflictDetector

public ConflictDetector getConflictDetector()
Returns the conflictdetector.

Returns:
conflictdetector

isBranchMerge

public boolean isBranchMerge()
Flat whether branches are merged opposed to versions on the same branch.

Returns:
true, if branches

getModelElementName

public String getModelElementName(ModelElementId modelElementId)
Get the Name of an model element by modelelement id.

Parameters:
modelElementId - id of element
Returns:
name as string

getModelElementName

public String getModelElementName(org.eclipse.emf.ecore.EObject modelElement)
Get the Name of an model element.

Parameters:
modelElement - element
Returns:
name as string

getModelElement

public org.eclipse.emf.ecore.EObject getModelElement(ModelElementId modelElementId)
Returns the model element. Therefore the project as well as creation and deletion operations are searched.

Parameters:
modelElementId - the id of an element
Returns:
the model element with the given ID or null if no such model element has been found

getAuthorForOperation

public String getAuthorForOperation(AbstractOperation theirOperation)
Returns the name of the author for a operation in list of their operations.

Parameters:
theirOperation - operation
Returns:
name as string or empty string

countMyLeafOperations

public int countMyLeafOperations()
Count my leaf operations.

Returns:
the number of leaf operations

countTheirLeafOperations

public int countTheirLeafOperations()
Count their leaf operations.

Returns:
the number of leaf operations

countMyOperations

public int countMyOperations()
Count my leaf operations.

Returns:
the number of leaf operations

countTheirOperations

public int countTheirOperations()
Count their leaf operations.

Returns:
the number of leaf operations

getIdToEObjectMapping

public ModelElementIdToEObjectMapping getIdToEObjectMapping()
Returns the mapping that is used to resolve model elements correctly.

Returns:
the ID to EObject mapping

getProject

public Project getProject()
Returns the project on which the decision manager is working on.

Returns:
the project associated with this decision manager


Copyright © 2015. All Rights Reserved.