blob: bdab263b32f177498afccbb3b0e7e85d8e55220a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/*******************************************************************************
* Copyright (c) 2004, 2007 Boeing.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.test.cases;
import java.util.Collection;
import java.util.HashSet;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.skynet.core.test.cases.ConflictTestManager.AttributeValue;
class ConflictDefinition {
final Collection<AttributeValue> values = new HashSet<AttributeValue>();
final Collection<AttributeValue> newAttributes = new HashSet<AttributeValue>();
IArtifactType artifactType;
boolean sourceDelete;
boolean destDelete;
int rootArtifact;
int queryNumber;
int numConflicts = 0;
boolean sourceModified = false;
boolean destModified = false;
protected void setValues(IArtifactType artifactType, boolean sourceDelete, boolean destDelete, int rootArtifact, int queryNumber) {
this.artifactType = artifactType;
this.sourceDelete = sourceDelete;
this.destDelete = destDelete;
this.rootArtifact = rootArtifact;
this.queryNumber = queryNumber;
}
protected boolean destinationDeleted(ConflictDefinition[] conflictDefs) {
if (rootArtifact == 0) {
return destDelete;
}
return destDelete || conflictDefs[rootArtifact].destinationDeleted(conflictDefs);
}
protected boolean sourceDeleted(ConflictDefinition[] conflictDefs) {
if (rootArtifact == 0) {
return sourceDelete;
}
return sourceDelete || conflictDefs[rootArtifact].sourceDeleted(conflictDefs);
}
protected int getNumberConflicts(ConflictDefinition[] conflictDefs) {
if (!destinationDeleted(conflictDefs) && !sourceDeleted(conflictDefs)) {
return numConflicts;
} else if (destinationDeleted(conflictDefs) && sourceModified || sourceDeleted(conflictDefs) && destModified) {
return 1;
} else {
return 0;
}
}
protected boolean artifactAdded(ConflictDefinition[] conflictDefs) {
if (!destinationDeleted(conflictDefs) && !sourceDeleted(conflictDefs)) {
return numConflicts > 0;
} else if (destinationDeleted(conflictDefs) && sourceModified || sourceDeleted(conflictDefs) && destModified) {
return true;
}
return false;
}
}
|