org.eclipse.emf.emfstore.internal.server.conflictDetection
Class ConflictBucketCandidate

java.lang.Object
  extended by org.eclipse.emf.emfstore.internal.server.conflictDetection.ConflictBucketCandidate

public class ConflictBucketCandidate
extends Object

Represents a bucket containing operations that potentially conflict but that do not neccessarily conflict. It also includes the involved model element ids and the priority of each operation.

The operation with the highest priority is used to determine which of the operations is used to represent all my and all their operations in a conflict. The operation with the highest priority is selected for representation.

Author:
koegel

Constructor Summary
ConflictBucketCandidate()
          Default constructor.
 
Method Summary
 void addConflictBucketCandidate(ConflictBucketCandidate otherBucket)
          Add another another conflict candidate bucket to this bucket including all their collected operations and invoveld ids.
 void addOperation(AbstractOperation operation, boolean isMyOperation, int priority)
          Add an operation for a model element id and its feature to the bucket.
 Set<ConflictBucket> calculateConflictBuckets(ConflictDetector detector, Set<AbstractOperation> myOperationsNonConflictingOperations)
          Calculate a set of conflict buckets from this candidate bucket.
 Set<AbstractOperation> getMyOperations()
           
 ConflictBucketCandidate getRootConflictBucketCandidate()
          Returns the root conflict bucket this bucket belongs to.
 Set<AbstractOperation> getTheirOperations()
           
 boolean isConflicting()
           
 void setParentConflictBucketCandidate(ConflictBucketCandidate parentConflictBucketCandidate)
          Sets the parent conflict bucket of this bucket.
 int size()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConflictBucketCandidate

public ConflictBucketCandidate()
Default constructor.

Method Detail

addOperation

public void addOperation(AbstractOperation operation,
                         boolean isMyOperation,
                         int priority)
Add an operation for a model element id and its feature to the bucket.

Parameters:
operation - the operation
isMyOperation - a boolean to determine if the operation is to be added to mz or their operations
priority - the global priority of the operation

addConflictBucketCandidate

public void addConflictBucketCandidate(ConflictBucketCandidate otherBucket)
Add another another conflict candidate bucket to this bucket including all their collected operations and invoveld ids.

Parameters:
otherBucket - the other bucket

getRootConflictBucketCandidate

public ConflictBucketCandidate getRootConflictBucketCandidate()
Returns the root conflict bucket this bucket belongs to.

Returns:
the root conflict bucket

setParentConflictBucketCandidate

public void setParentConflictBucketCandidate(ConflictBucketCandidate parentConflictBucketCandidate)
Sets the parent conflict bucket of this bucket.

Parameters:
parentConflictBucketCandidate - the parent bucket of this bucket

size

public int size()
Returns:
the size of the bucket in the total number of involved operations

isConflicting

public boolean isConflicting()
Returns:
true, if the set is conflicting, that is my and their operations are not empty

getMyOperations

public Set<AbstractOperation> getMyOperations()
Returns:
my operations

getTheirOperations

public Set<AbstractOperation> getTheirOperations()
Returns:
their operations

calculateConflictBuckets

public Set<ConflictBucket> calculateConflictBuckets(ConflictDetector detector,
                                                    Set<AbstractOperation> myOperationsNonConflictingOperations)
Calculate a set of conflict buckets from this candidate bucket. The result set may be empty if no conflicts are found within the candidate bucket.

Parameters:
detector - the conflict detector
myOperationsNonConflictingOperations - a transient set where all non conflicting my operations are added to during this operation
Returns:
a set of conflict buckets


Copyright © 2015. All Rights Reserved.