コード例 #1
0
 private <K, C extends ModelChange> void collectSymmetricChanges(Map<K, C> mine, Map<K, C> repo) {
   for (K key :
       SetSequence.fromSet(MapSequence.fromMap(mine).keySet())
           .intersect(SetSequence.fromSet(MapSequence.fromMap(repo).keySet()))) {
     addSymmetric(MapSequence.fromMap(mine).get(key), MapSequence.fromMap(repo).get(key));
   }
 }
コード例 #2
0
 private void addPossibleConflict(ModelChange a, ModelChange b) {
   if (a.isNonConflicting() || b.isNonConflicting()) {
     addSymmetric(a, b);
   } else {
     addConflict(a, b);
   }
 }
コード例 #3
0
 private void collectReferenceConflicts() {
   Tuples._2<
           Map<Tuples._2<SNodeId, String>, SetReferenceChange>,
           Map<Tuples._2<SNodeId, String>, SetReferenceChange>>
       arranged;
   arranged =
       this.<Tuples._2<SNodeId, String>, SetReferenceChange>arrangeChanges(
           new _FunctionTypes._return_P1_E0<Tuples._2<SNodeId, String>, SetReferenceChange>() {
             public Tuples._2<SNodeId, String> invoke(SetReferenceChange src) {
               return MultiTuple.<SNodeId, String>from(src.getAffectedNodeId(), src.getRole());
             }
           },
           SetReferenceChange.class);
   for (Tuples._2<SNodeId, String> nodeName :
       SetSequence.fromSet(MapSequence.fromMap(arranged._0()).keySet())
           .intersect(SetSequence.fromSet(MapSequence.fromMap(arranged._1()).keySet()))) {
     SetReferenceChange mineChange = MapSequence.fromMap(arranged._0()).get(nodeName);
     SetReferenceChange repositoryChange = MapSequence.fromMap(arranged._1()).get(nodeName);
     if (EqualUtil.equals(mineChange.getTargetNodeId(), repositoryChange.getTargetNodeId())
         && EqualUtil.equals(
             mineChange.getTargetModelReference(), repositoryChange.getTargetModelReference())
         && EqualUtil.equals(mineChange.getResolveInfo(), repositoryChange.getResolveInfo())) {
       addSymmetric(mineChange, repositoryChange);
     } else {
       addPossibleConflict(mineChange, repositoryChange);
     }
   }
 }
コード例 #4
0
  private void collectConflicts() {
    Map<Tuples._2<SNodeId, String>, List<NodeGroupChange>> mineGroupChanges =
        arrangeNodeGroupChanges(myMineChangeSet);
    Map<Tuples._2<SNodeId, String>, List<NodeGroupChange>> repositoryGroupChanges =
        arrangeNodeGroupChanges(myRepositoryChangeSet);
    for (Tuples._2<SNodeId, String> nodeRole :
        SetSequence.fromSet(MapSequence.fromMap(mineGroupChanges).keySet())
            .intersect(SetSequence.fromSet(MapSequence.fromMap(repositoryGroupChanges).keySet()))) {
      List<NodeGroupChange> mine = MapSequence.fromMap(mineGroupChanges).get(nodeRole);
      List<NodeGroupChange> repository = MapSequence.fromMap(repositoryGroupChanges).get(nodeRole);
      // This is a quadratic algorithm, it can be optimized to linear,
      // but it is left for simplicity
      for (NodeGroupChange m : ListSequence.fromList(mine)) {
        for (NodeGroupChange r : ListSequence.fromList(repository)) {
          if (m.getEnd() < r.getBegin() || m.getBegin() > r.getEnd()) {
            // ok
          } else {
            if (nodeGroupChangesSymmetric(m, r)) {
              addSymmetric(m, r);
            } else {
              addPossibleConflict(m, r);
            }
          }
        }
      }
    }

    collectGroupChangesWithOthersConflicts(
        mineGroupChanges, myMineChangeSet, myRepositoryChangeSet);
    collectGroupChangesWithOthersConflicts(
        repositoryGroupChanges, myRepositoryChangeSet, myMineChangeSet);

    collectPropertyConflicts();
    collectReferenceConflicts();

    collectSymmetricRootDeletes();
    collectConflictingRootAdds();

    collectSymmetricImportedModelChanges();
    collectSymmetricModuleDependencyChanges();
  }
コード例 #5
0
 private void collectConflictingRootAdds() {
   Tuples._2<Map<SNodeId, AddRootChange>, Map<SNodeId, AddRootChange>> arranged;
   arranged =
       this.<SNodeId, AddRootChange>arrangeChanges(
           new _FunctionTypes._return_P1_E0<SNodeId, AddRootChange>() {
             public SNodeId invoke(AddRootChange drc) {
               return drc.getRootId();
             }
           },
           AddRootChange.class);
   for (SNodeId addedRoot :
       SetSequence.fromSet(MapSequence.fromMap(arranged._0()).keySet())
           .intersect(SetSequence.fromSet(MapSequence.fromMap(arranged._1()).keySet()))) {
     AddRootChange mine = MapSequence.fromMap(arranged._0()).get(addedRoot);
     AddRootChange repository = MapSequence.fromMap(arranged._1()).get(addedRoot);
     if (SNodeCompare.nodeEquals(
         myMyModel.getNode(mine.getRootId()), myRepositoryModel.getNode(repository.getRootId()))) {
       addSymmetric(mine, repository);
     } else {
       addPossibleConflict(mine, repository);
     }
   }
 }