org.eclipse.emf.emfstore.internal.client.model.changeTracking.merging.conflict
Class VisualConflict

java.lang.Object
  extended by java.util.Observable
      extended by org.eclipse.emf.emfstore.internal.client.model.changeTracking.merging.conflict.VisualConflict
Direct Known Subclasses:
AttributeConflict, CompositeConflict, DeletionConflict, MultiAttributeConflict, MultiAttributeMoveConflict, MultiAttributeMoveSetConflict, MultiAttributeSetConflict, MultiAttributeSetSetConflict, MultiReferenceConflict, MultiReferenceSetConflict, MultiReferenceSetSetConflict, MultiReferenceSetSingleConflict, MultiReferenceSingleConflict, ReferenceConflict, SingleReferenceConflict

public abstract class VisualConflict
extends Observable

Main class representing a conflict. It offers all kind of convenience methods and organizes the conflicts initialization.

Author:
wesendon

Constructor Summary
VisualConflict(ConflictBucket conflictBucket, AbstractOperation leftOperation, AbstractOperation rightOperation, DecisionManager decisionManager, boolean leftIsMy, boolean init)
          Construct conflict from given specific left and right operation.
VisualConflict(ConflictBucket conflictBucket, DecisionManager decisionManager)
          Constructor.
VisualConflict(ConflictBucket conflictBucket, DecisionManager decisionManager, boolean leftIsMy, boolean init)
          Construct conflict from given specific left and right operation.
 
Method Summary
 Set<AbstractOperation> getAcceptedMine()
          This method is used by DecisionManager in order to create the resulting operations.
 ConflictContext getConflictContext()
          Returns the conflict context.
 ConflictDescription getConflictDescription()
          Returns the conflict description.
 DecisionManager getDecisionManager()
          Returns the DecisionManager.
 AbstractOperation getLeftOperation()
          Get first left operation.
 Set<AbstractOperation> getLeftOperations()
          Get left operations.
 AbstractOperation getMyOperation()
          Get my operation.
<T> T
getMyOperation(Class<T> clazz)
          Get my operation and cast.
 Set<AbstractOperation> getMyOperations()
          Get my operations.
 ConflictOption getOptionOfType(ConflictOption.OptionType type)
          Get an option by its type.
 List<ConflictOption> getOptions()
          Returns the list of options.
 Set<AbstractOperation> getRejectedTheirs()
          This method is used by DecisionManager in order to create the resulting operations.
 AbstractOperation getRightOperation()
          get first right operation.
 Set<AbstractOperation> getRightOperations()
          get right operations.
 ConflictOption getSolution()
          Returns the solution.
 AbstractOperation getTheirOperation()
          Get their operation.
<T> T
getTheirOperation(Class<T> clazz)
          Get their operation and cast.
 Set<AbstractOperation> getTheirOperations()
          Get their operations.
 boolean hasDetails()
          Checks whether the related options have details.
 boolean isLeftMy()
          Determines whether left operations are my.
 boolean isResolved()
          Returns whether this conflict is resolved.
 void resolve()
          Resolves this conflict.
 void setLeftIsMy(boolean leftIsMy)
          Whether the left operations is mine operation.
 void setSolution(ConflictOption conflictOption)
          Sets an options as solution for this conflict.
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VisualConflict

public VisualConflict(ConflictBucket conflictBucket,
                      AbstractOperation leftOperation,
                      AbstractOperation rightOperation,
                      DecisionManager decisionManager,
                      boolean leftIsMy,
                      boolean init)
Construct conflict from given specific left and right operation.

Parameters:
conflictBucket - the underlying conflict
leftOperation - the left operation
rightOperation - the right operation
decisionManager - the decision manager
leftIsMy - true if left operation is my operation
init - true if conflict should be initialized on construction

VisualConflict

public VisualConflict(ConflictBucket conflictBucket,
                      DecisionManager decisionManager,
                      boolean leftIsMy,
                      boolean init)
Construct conflict from given specific left and right operation.

Parameters:
conflictBucket - the underlying conflict
decisionManager - the decision manager
leftIsMy - true if left operation is my operation
init - true if conflict should be initialized on construction

VisualConflict

public VisualConflict(ConflictBucket conflictBucket,
                      DecisionManager decisionManager)
Constructor.

Parameters:
conflictBucket - the underlying conflict
decisionManager - the decision manager
Method Detail

isLeftMy

public boolean isLeftMy()
Determines whether left operations are my.

Returns:
boolean

getConflictContext

public ConflictContext getConflictContext()
Returns the conflict context.

Returns:
context.

getConflictDescription

public ConflictDescription getConflictDescription()
Returns the conflict description.

Returns:
conflict description

getOptions

public List<ConflictOption> getOptions()
Returns the list of options.

Returns:
list options

isResolved

public boolean isResolved()
Returns whether this conflict is resolved.

Returns:
true if resolved

hasDetails

public boolean hasDetails()
Checks whether the related options have details.

Returns:
true, if at least one got details.

setSolution

public void setSolution(ConflictOption conflictOption)
Sets an options as solution for this conflict.

Parameters:
conflictOption - option

getDecisionManager

public DecisionManager getDecisionManager()
Returns the DecisionManager.

Returns:
decisionManager

getSolution

public ConflictOption getSolution()
Returns the solution.

Returns:
solution

getRejectedTheirs

public Set<AbstractOperation> getRejectedTheirs()
This method is used by DecisionManager in order to create the resulting operations.

Returns:
a set containing the rejected operations

getAcceptedMine

public Set<AbstractOperation> getAcceptedMine()
This method is used by DecisionManager in order to create the resulting operations.

Returns:
set containing the accepted operations

getOptionOfType

public ConflictOption getOptionOfType(ConflictOption.OptionType type)
Get an option by its type.

Parameters:
type - type
Returns:
option or null

getMyOperations

public Set<AbstractOperation> getMyOperations()
Get my operations.

Returns:
list of operations

getTheirOperations

public Set<AbstractOperation> getTheirOperations()
Get their operations.

Returns:
list of operations

getLeftOperations

public Set<AbstractOperation> getLeftOperations()
Get left operations.

Returns:
list of operations

getRightOperations

public Set<AbstractOperation> getRightOperations()
get right operations.

Returns:
list of operations

getLeftOperation

public AbstractOperation getLeftOperation()
Get first left operation.

Returns:
operation

getRightOperation

public AbstractOperation getRightOperation()
get first right operation.

Returns:
operation

getMyOperation

public AbstractOperation getMyOperation()
Get my operation.

Returns:
operation

getTheirOperation

public AbstractOperation getTheirOperation()
Get their operation.

Returns:
operation

getMyOperation

public <T> T getMyOperation(Class<T> clazz)
Get my operation and cast.

Type Parameters:
T - cast type
Parameters:
clazz - AbstractOperation class to which will be casted
Returns:
operation

getTheirOperation

public <T> T getTheirOperation(Class<T> clazz)
Get their operation and cast.

Type Parameters:
T - cast type
Parameters:
clazz - AbstractOperation class to which will be casted
Returns:
operation

resolve

public void resolve()
Resolves this conflict.


setLeftIsMy

public void setLeftIsMy(boolean leftIsMy)
Whether the left operations is mine operation.

Parameters:
leftIsMy - should be true, if the left operation belongs to me, false otherwise


Copyright © 2015. All Rights Reserved.