-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb963fe
commit c6839f8
Showing
5 changed files
with
115 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
OsmAnd-java/src/main/java/net/osmand/search/core/DynamicTagGroupFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package net.osmand.search.core; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public class DynamicTagGroupFilter { | ||
|
||
public DynamicTagGroupFilter(int tagGroupId) { | ||
addTagGroup(tagGroupId); | ||
} | ||
|
||
private HashSet<Integer> tagGroups = null; | ||
|
||
public boolean isAccept(Set<Integer> tagGroupIds) { | ||
if (tagGroups == null) { | ||
return true; | ||
} | ||
for (int id : tagGroupIds) { | ||
if (tagGroups.contains(id)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
public boolean isAccept(int tagGroupId) { | ||
if (tagGroups == null) { | ||
return true; | ||
} | ||
return tagGroups.contains(tagGroupId); | ||
} | ||
|
||
public void addTagGroup(int tagGroupId) { | ||
if (tagGroups == null) { | ||
tagGroups = new HashSet<>(); | ||
} | ||
tagGroups.add(tagGroupId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters