From eeca4c7c2ebbd3d8c2e86483e664507cc86f3a81 Mon Sep 17 00:00:00 2001 From: irengrig Date: Wed, 23 Jun 2010 13:49:31 +0400 Subject: [PATCH] VCS: area map: contains(); [a/c, a/c/d] to insert a/c/e case -> check all occurencies before found insert place --- platform/vcs-api/src/com/intellij/openapi/vcs/AreaMap.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/AreaMap.java b/platform/vcs-api/src/com/intellij/openapi/vcs/AreaMap.java index c9a4197ea3f8..fb2977423d8c 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/AreaMap.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/AreaMap.java @@ -67,6 +67,10 @@ public class AreaMap, Val> { } } + public boolean contains(final Key key) { + return myKeys.contains(key); + } + public void getSimiliar(final Key key, final PairProcessor consumer) { final int idx = Collections.binarySearch(myKeys, key); if (idx < 0) { @@ -76,7 +80,7 @@ public class AreaMap, Val> { if (itemBeforeIdx >= 0) { for (int i = itemBeforeIdx; i >= 0; -- i) { final Key candidate = myKeys.get(i); - if (! myKeysResemblance.process(candidate, key)) break; + if (! myKeysResemblance.process(candidate, key)) continue; if (consumer.process(candidate, myMap.get(candidate))) break; // if need only a part of keys } }