/** */ private static boolean checkWildcardCompatibility(String txt1, String txt2) { if (txt1.length() != txt2.length()) { return false; } for (int i = 0; i < txt1.length(); i++) { Character t1 = txt1.charAt(i); Character t2 = txt2.charAt(i); if (!(t1.equals('*') || t2.equals('*') || t1.equals(t2))) { return false; } } return true; }
/** * 是否是bad case * @param name * @return */ public static boolean isBadCase(String name) { Character label = JapanesePersonDictionary.get(name); if (label == null) return false; return label.equals(JapanesePersonDictionary.A); }
/** * Right now, we say they're compatible iff one of them is all * wildcards or they are equivalent * */ @SuppressWarnings("unused") private static boolean checkWildcardAfterCompatibility(String txt1, String txt2) { if (txt1.length() != txt2.length()) { return false; } for (int i = 0; i < txt1.length(); i++) { Character t1 = txt1.charAt(i); Character t2 = txt2.charAt(i); if (!(t1.equals('*') || t2.equals('*') || t1.equals(t2))) { return false; } } return true; }
protected boolean isWildcard(Object key) { return wildcardHashCode == key.hashCode() && wildcard.equals(key); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null) return false; if (!getClass().isAssignableFrom(o.getClass())) return false; ArchiveStatus that = (ArchiveStatus) o; if (archived != null ? !archived.equals(that.archived) : that.archived != null) return false; return true; }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } LikeDimFilter that = (LikeDimFilter) o; if (dimension != null ? !dimension.equals(that.dimension) : that.dimension != null) { return false; } if (pattern != null ? !pattern.equals(that.pattern) : that.pattern != null) { return false; } if (escapeChar != null ? !escapeChar.equals(that.escapeChar) : that.escapeChar != null) { return false; } return extractionFn != null ? extractionFn.equals(that.extractionFn) : that.extractionFn == null; }
@SuppressWarnings("SimplifiableIfStatement") @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final KeyStroke other = (KeyStroke) obj; if (this.keyType != other.keyType) { return false; } if (this.character != other.character && (this.character == null || !this.character.equals(other.character))) { return false; } return this.ctrlDown == other.ctrlDown && this.altDown == other.altDown && this.shiftDown == other.shiftDown; }
/** * {@inheritDoc} */ @Override public boolean equals(Character object, ByteBuffer binary) { return object.equals(read(binary)); } }
@Override public boolean apply(@NonNull final Character value) { return value.equals(character); } }
if (other.modifiable != null) return false; } else if (!modifiable.equals(other.modifiable)) return false; return true;
Character c = consume(); if (last == 0 || last != ESC) { if (c.equals('\'') && c != open && !inDoubleQuote) inSingleQuote = !inSingleQuote; else if (c.equals('"') && c != open && !inSingleQuote) inDoubleQuote = !inDoubleQuote; if (inSingleQuote || inDoubleQuote) continue; if (c.equals(open)) { depth++; if (start == -1) start = pos; else if (c.equals(close)) depth--;
Character character = ((Character) value); value = character.equals(Character.valueOf((char) 0)) ? null : character.toString(); } else if (value instanceof Date) { Date jdkDate = (Date) value;
if (quote == null) { quote = currentQuote; } else if (quote.equals(currentQuote)){ quote = null;
if (((Character) directValue).equals('N')) { attachNullClause = true;
if (CharacterField == null) { if (other.CharacterField != null) return false; } else if (!CharacterField.equals(other.CharacterField)) return false; if (DoubleField == null) { if (other.DoubleField != null) return false;
private void checkEmptyPath(UrlTrie trie, String path, int pathChildrenCount) { for (int i = 1; i < path.length(); ++i) { UrlTrieNode node = trie.getChild(path.substring(0, i)); Assert.assertTrue(node.getValue().equals(path.charAt(i - 1))); Assert.assertEquals(pathChildrenCount, node.getSize()); Assert.assertFalse(node.isExist()); } } }
@Test public void testTrieRoot3() { UrlTrie trie = new UrlTrie("www.linkedin.com/", new ArrayList<String>()); UrlTrieNode root = trie.getRoot(); Assert.assertTrue(root.getValue().equals('/')); Assert.assertEquals(0, root.getSize()); //Assert.assertTrue(root.getParent() == null); }
@Test public void testDuplicate() { UrlTrie trie = new UrlTrie("https://www.linkedin.com/", Arrays.asList("https://www.linkedin.com/", "https://www.linkedin.com/", "https://www.linkedin.com/in/")); UrlTrieNode root = trie.getRoot(); Assert.assertTrue(root.getValue().equals('/')); Assert.assertEquals(1, root.children.size()); Assert.assertTrue(root.isExist()); Assert.assertEquals(3, root.getSize()); // Path1 String path1 = "in/"; checkEmptyPath(trie, path1, 1); UrlTrieNode inNode = trie.getChild("in/"); Assert.assertTrue(inNode.getValue().equals('/')); Assert.assertEquals(1, inNode.getSize()); Assert.assertTrue(inNode.isExist()); }
@Test public void testTrieVertical() { UrlTrie trie = new UrlTrie("https://www.linkedin.com/", Arrays.asList("https://www.linkedin.com/", "https://www.linkedin.com/in/", "https://www.linkedin.com/in/chenguo")); UrlTrieNode root = trie.getRoot(); Assert.assertTrue(root.getValue().equals('/')); Assert.assertEquals(1, root.children.size()); Assert.assertTrue(root.isExist()); Assert.assertEquals(3, root.getSize()); // Path1 String path1 = "in/"; checkEmptyPath(trie, path1, 2); UrlTrieNode inNode = trie.getChild("in/"); Assert.assertTrue(inNode.getValue().equals('/')); Assert.assertEquals(2, inNode.getSize()); Assert.assertTrue(inNode.isExist()); UrlTrieNode chenguo = inNode.getChild("chenguo"); Assert.assertEquals(root.getChild("in/chenguo"), chenguo); Assert.assertTrue(chenguo.getValue().equals('o')); Assert.assertEquals(1, chenguo.getSize()); Assert.assertTrue(chenguo.isExist()); }
@Test public void testTrieFlat() { UrlTrie trie = new UrlTrie("https://www.linkedin.com/", Arrays.asList("https://www.linkedin.com/jobs/", "https://www.linkedin.com/in/")); UrlTrieNode root = trie.getRoot(); Assert.assertTrue(root.getValue().equals('/')); Assert.assertEquals(2, root.children.size()); Assert.assertFalse(root.isExist()); Assert.assertEquals(2, root.getSize()); // Path1 String path1 = "jobs/"; checkEmptyPath(trie, path1, 1); UrlTrieNode jobNode = trie.getChild("jobs/"); Assert.assertTrue(jobNode.getValue().equals('/')); Assert.assertEquals(1, jobNode.getSize()); Assert.assertTrue(jobNode.isExist()); // Path2 String path2 = "in/"; checkEmptyPath(trie, path2, 1); UrlTrieNode inNode = trie.getChild("in/"); Assert.assertTrue(inNode.getValue().equals('/')); Assert.assertEquals(1, inNode.getSize()); Assert.assertTrue(inNode.isExist()); }