@Test public void testMatches() { IpCompletionRelevance relevance = new IpCompletionRelevance("a", "tag1", "gat1"); Ip testIp = Ip.parse("1.1.1.1"); assertTrue(relevance.matches(new String[] {"a"}, testIp)); assertTrue(relevance.matches(new String[] {"tag", "gat"}, testIp)); assertTrue(relevance.matches(new String[] {"1.1"}, testIp)); assertTrue(relevance.matches(new String[] {"1.1", "tag"}, testIp)); assertFalse(relevance.matches(new String[] {"b"}, testIp)); assertFalse(relevance.matches(new String[] {"tag", "b"}, testIp)); }
public boolean matches(String[] subQueries, Ip ip) { return Arrays.stream(subQueries) .allMatch( sq -> ip.toString().contains(sq) || _matchTags.stream().anyMatch(tag -> tag.contains(sq))); }
IpCompletionRelevance implements Serializable { public boolean matches(String[] subQueries, Ip ip) { return Arrays.stream(subQueries) .allMatch( sq -> ip.toString().contains(sq) || _matchTags.stream().anyMatch(tag -> tag.contains(sq))); } }
IpCompletionRelevance implements Serializable { public boolean matches(String[] subQueries, Ip ip) { return Arrays.stream(subQueries) .allMatch( sq -> ip.toString().contains(sq) || _matchTags.stream().anyMatch(tag -> tag.contains(sq))); } IpCompletionRelevance(String display, String... matchTags);  IpCompletionRelevance(String display, List<String> matchTags); }
IpCompletionRelevance implements Serializable { public boolean matches(String[] subQueries, Ip ip) { return Arrays.stream(subQueries) .allMatch( sq -> ip.toString().contains(sq) || _matchTags.stream().anyMatch(tag -> tag.contains(sq))); } IpCompletionRelevance(String display, String... matchTags);  IpCompletionRelevance(String display, List<String> matchTags); boolean matches(String[] subQueries, Ip ip); @JsonProperty(PROP_DISPLAY) String getDisplay(); @JsonProperty(PROP_MATCH_TAGS) List<String> getMatchTags(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override String toString(); }
IpCompletionRelevance implements Serializable { public boolean matches(String[] subQueries, Ip ip) { return Arrays.stream(subQueries) .allMatch( sq -> ip.toString().contains(sq) || _matchTags.stream().anyMatch(tag -> tag.contains(sq))); } IpCompletionRelevance(String display, String... matchTags);  IpCompletionRelevance(String display, List<String> matchTags); boolean matches(String[] subQueries, Ip ip); @JsonProperty(PROP_DISPLAY) String getDisplay(); @JsonProperty(PROP_MATCH_TAGS) List<String> getMatchTags(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override String toString();  }