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

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

public class ReservationSet
extends Object

Mapping from model elements to their features.

Author:
mkoegel, emueller

Constructor Summary
ReservationSet()
          Default constructor.
 
Method Summary
 void addContainerReservation(String modelElementId)
          Adds an full reservation.
 void addExistenceReservation(String modelElementId)
          Adds an existence reservation.
 void addExistenceReservation(String modelElementId, ConflictBucketCandidate conflictBucketCandidate)
          Adds an existence reservation.
 void addFeatureReservation(String modelElementId, String featureName)
          Adds a feature reservation for the given model element an one of its feature.
 void addFeatureReservation(String modelElementId, String featureName, ConflictBucketCandidate conflictBucketCandidate)
          Adds a feature reservation for the given feature.
 void addFullReservation(String modelElementId)
          Adds an full reservation.
 void addFullReservation(String modelElementId, ConflictBucketCandidate conflictBucketCandidate)
          Adds a full reservation for the given model element.
 void addMapKeyReservation(String modelElementId, String featureName, String key)
          Adds a reservation for a map entry that is contained in a map feature.
 void addMultiReferenceWithOppositeReservation(String modelElementId, String featureName, String oppositeModelElementId)
          Adds a multi-reference feature reservation together with an opposite model element.
 void addMultiReferenceWithOppositeReservation(String modelElementID, String featureName, String oppositeModelElementId, ConflictBucketCandidate conflictBucketCandidate)
          Performs an opposite reservation for multi-reference features.
 Set<String> getAllModelElements()
          Returns all model elements in the reservation set.
 Set<ConflictBucketCandidate> getConflictBucketCandidates(String modelElementId)
          Returns all conflict bucket candidates for the given model element.
 Set<ConflictBucketCandidate> getConflictBucketCandidates(String modelElementId, String featureName)
          Returns all conflict bucket candidates for the given model element and a feature.
 Set<ConflictBucketCandidate> getConflictBucketCandidates(String modelElementId, String featureName, String oppositeModelElement)
          Returns all conflict bucket candidates for the given model element and its feature, together with an opposite model element.
 Set<String> getFeatureNames(String modelElementId)
          Returns all reserved features for the given model element.
 Set<String> getOpposites(String modelElementID, String featureName)
          Returns all opposites for the given model element ID and a feature.
 boolean hasExistenceReservation(String modelElementId)
          Whether the given model element has an existence reservation.
 boolean hasFeatureReservation(String modelElementId, String featureName)
          Whether the given model element has a reservation for the given feature.
 boolean hasFullReservation(String modelElementId)
          Whether the given model element has a full reservation.
 boolean hasOppositeReservation(String modelElementID, String featureName, String oppositeModelElementID)
          Whether the given model element has a feature reservation with the given opposite model element.
 boolean hasOppositeReservations(String modelElementId, String featureName)
          Whether the given model element has a opposite reservation for the given feature.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReservationSet

public ReservationSet()
Default constructor.

Method Detail

addFullReservation

public void addFullReservation(String modelElementId)
Adds an full reservation.

Parameters:
modelElementId - the ID of a model element

addExistenceReservation

public void addExistenceReservation(String modelElementId)
Adds an existence reservation.

Parameters:
modelElementId - the ID of a model element

addContainerReservation

public void addContainerReservation(String modelElementId)
Adds an full reservation.

Parameters:
modelElementId - the ID of a model element

addFeatureReservation

public void addFeatureReservation(String modelElementId,
                                  String featureName)
Adds a feature reservation for the given model element an one of its feature.

Parameters:
modelElementId - the ID of a model element
featureName - the name of a feature

addMultiReferenceWithOppositeReservation

public void addMultiReferenceWithOppositeReservation(String modelElementId,
                                                     String featureName,
                                                     String oppositeModelElementId)
Adds a multi-reference feature reservation together with an opposite model element.

Parameters:
modelElementId - the ID of a model element
featureName - the name of a feature
oppositeModelElementId - the ID of a model element

addMapKeyReservation

public void addMapKeyReservation(String modelElementId,
                                 String featureName,
                                 String key)
Adds a reservation for a map entry that is contained in a map feature.

Parameters:
modelElementId - the ID of a model element
featureName - the name of a feature
key - the key of the map entry

addFullReservation

public void addFullReservation(String modelElementId,
                               ConflictBucketCandidate conflictBucketCandidate)
Adds a full reservation for the given model element.

Parameters:
modelElementId - the ID of a model element
conflictBucketCandidate - the conflict bucket into which the reservation is put

addExistenceReservation

public void addExistenceReservation(String modelElementId,
                                    ConflictBucketCandidate conflictBucketCandidate)
Adds an existence reservation.

Parameters:
modelElementId - the ID of a model element
conflictBucketCandidate - the conflict bucket candidate into which the reservation is put

addFeatureReservation

public void addFeatureReservation(String modelElementId,
                                  String featureName,
                                  ConflictBucketCandidate conflictBucketCandidate)
Adds a feature reservation for the given feature.

Parameters:
modelElementId - the ID of a model element
featureName - the name of a feature
conflictBucketCandidate - the conflict bucket candidate into which the reservation is put

addMultiReferenceWithOppositeReservation

public void addMultiReferenceWithOppositeReservation(String modelElementID,
                                                     String featureName,
                                                     String oppositeModelElementId,
                                                     ConflictBucketCandidate conflictBucketCandidate)
Performs an opposite reservation for multi-reference features.

Parameters:
modelElementID - the ID of a model element
featureName - the name of a multi-reference feature
oppositeModelElementId - the opposite model element ID
conflictBucketCandidate - the conflict bucket candidate into which the reservation is put

getAllModelElements

public Set<String> getAllModelElements()
Returns all model elements in the reservation set.

Returns:
a set of all model elements

hasExistenceReservation

public boolean hasExistenceReservation(String modelElementId)
Whether the given model element has an existence reservation.

Parameters:
modelElementId - the ID of a model element
Returns:
true, if there is an existence reservation for the given model element, false otherwise

hasFullReservation

public boolean hasFullReservation(String modelElementId)
Whether the given model element has a full reservation.

Parameters:
modelElementId - the ID of a model element
Returns:
true, if there is a full reservation for the given model element, false otherwise

getFeatureNames

public Set<String> getFeatureNames(String modelElementId)
Returns all reserved features for the given model element.

Parameters:
modelElementId - the ID of a mode element
Returns:
a set of all feature names that are reserved for the given model element

hasFeatureReservation

public boolean hasFeatureReservation(String modelElementId,
                                     String featureName)
Whether the given model element has a reservation for the given feature.

Parameters:
modelElementId - the ID of a model element
featureName - a feature name
Returns:
true, if the model element has a feature reservation for the given feature, false otherwise

hasOppositeReservations

public boolean hasOppositeReservations(String modelElementId,
                                       String featureName)
Whether the given model element has a opposite reservation for the given feature.

Parameters:
modelElementId - the ID of a model element
featureName - the name of a feature
Returns:
true, if the model element has a opposite reservation for the given feature, false otherwise

getOpposites

public Set<String> getOpposites(String modelElementID,
                                String featureName)
Returns all opposites for the given model element ID and a feature.

Parameters:
modelElementID - the ID of a model element
featureName - the name of a feature
Returns:
a set of opposite model element IDs

getConflictBucketCandidates

public Set<ConflictBucketCandidate> getConflictBucketCandidates(String modelElementId)
Returns all conflict bucket candidates for the given model element.

Parameters:
modelElementId - the ID of a model element
Returns:
a set of ConflictBucketCandidates

getConflictBucketCandidates

public Set<ConflictBucketCandidate> getConflictBucketCandidates(String modelElementId,
                                                                String featureName)
Returns all conflict bucket candidates for the given model element and a feature.

Parameters:
modelElementId - the ID of a model element
featureName - the feature name
Returns:
a set of ConflictBucketCandidates

getConflictBucketCandidates

public Set<ConflictBucketCandidate> getConflictBucketCandidates(String modelElementId,
                                                                String featureName,
                                                                String oppositeModelElement)
Returns all conflict bucket candidates for the given model element and its feature, together with an opposite model element.

Parameters:
modelElementId - the ID of a model element
featureName - the feature name
oppositeModelElement - the ID of the opposite model element
Returns:
a set of ConflictBucketCandidates

hasOppositeReservation

public boolean hasOppositeReservation(String modelElementID,
                                      String featureName,
                                      String oppositeModelElementID)
Whether the given model element has a feature reservation with the given opposite model element.

Parameters:
modelElementID - the ID of the model element
featureName - a feature of the model element
oppositeModelElementID - the ID of the opposite model element
Returns:
true, if there exists a opposite reservation, false otherwise


Copyright © 2015. All Rights Reserved.