96
96
public VisitData getVisitData(ModuleRevisionId mrid) {
97
return (VisitData) visitData.get(mrid);
97
VisitData result = (VisitData) visitData.get(mrid);
100
// search again, now ignore the missing extra attributes
101
for (Iterator it = visitData.entrySet().iterator(); it.hasNext();) {
102
Map.Entry entry = (Entry) it.next();
103
ModuleRevisionId current = (ModuleRevisionId) entry.getKey();
105
if (isSubMap(mrid.getAttributes(), current.getAttributes())) {
106
result = (VisitData) entry.getValue();
116
* Checks whether one map is a sub-map of the other.
118
private static boolean isSubMap(Map map1, Map map2) {
119
int map1Size = map1.size();
120
int map2Size = map2.size();
122
if (map1Size == map2Size) {
123
return map1.equals(map2);
126
Map smallest = map1Size < map2Size ? map1 : map2;
127
Map largest = map1Size < map2Size ? map2 : map1;
129
for (Iterator it = smallest.entrySet().iterator(); it.hasNext(); ) {
130
Map.Entry entry = (Entry) it.next();
132
if (!largest.containsKey(entry.getKey())) {
136
Object map1Value = smallest.get(entry.getKey());
137
Object map2Value = largest.get(entry.getKey());
138
if (!isEqual(map1Value, map2Value)) {
146
private static boolean isEqual(Object obj1, Object obj2) {
159
return obj1.equals(obj2);
210
272
public boolean isBlacklisted(String rootModuleConf, ModuleRevisionId mrid) {
211
273
IvyNode node = getNode(mrid);
214
// search again, now ignore the extra attributes
215
// TODO: maybe we should search the node that has at least the
216
// same attributes as mrid
217
for (Iterator it = visitData.entrySet().iterator(); it.hasNext();) {
218
Map.Entry entry = (Entry) it.next();
219
ModuleRevisionId current = (ModuleRevisionId) entry.getKey();
220
if (current.getModuleId().equals(mrid.getModuleId())
221
&& current.getRevision().equals(mrid.getRevision())) {
222
VisitData data = (VisitData) entry.getValue();
223
node = data.getNode();
275
// if (node == null) {
276
// // search again, now ignore the extra attributes
277
// // TODO: maybe we should search the node that has at least the
278
// // same attributes as mrid
279
// for (Iterator it = visitData.entrySet().iterator(); it.hasNext();) {
280
// Map.Entry entry = (Entry) it.next();
281
// ModuleRevisionId current = (ModuleRevisionId) entry.getKey();
282
// if (current.getModuleId().equals(mrid.getModuleId())
283
// && current.getRevision().equals(mrid.getRevision())) {
284
// VisitData data = (VisitData) entry.getValue();
285
// node = data.getNode();
229
291
return node != null && node.isBlacklisted(rootModuleConf);