/** * Two relationships are assumed equal if they have the same source synset, target synset, and type. */ @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Relationship)) return false; Relationship that = (Relationship) o; if (type != that.type) return false; if (!sourceSynset.equals(that.sourceSynset)) return false; if (!targetSynset.equals(that.targetSynset)) return false; return true; }
/** * Two relationships are assumed equal if they have the same source synset, target synset, and type. */ @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Relationship)) return false; Relationship that = (Relationship) o; if (type != that.type) return false; if (!sourceSynset.equals(that.sourceSynset)) return false; if (!targetSynset.equals(that.targetSynset)) return false; return true; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ExtJwnlSynset other = (ExtJwnlSynset) obj; if (realSynset == null) { if (other.realSynset != null) return false; } else if (!realSynset.equals(other.realSynset)) return false; return true; }
/** * Two words are equal if their parent Synsets are equal and they have the same lemma */ public boolean equals(Object object) { return (object instanceof Word) && ((Word) object).getSynset().equals(getSynset()) && ((Word) object).getLemma().equals(getLemma()); }
/** * Two words are equal if their parent Synsets are equal and they have the same lemma */ public boolean equals(Object object) { return (object instanceof Word) && ((Word) object).getSynset().equals(getSynset()) && ((Word) object).getLemma().equals(getLemma()); }
/** * A symmetric relationship is one whose type is symmetric (i.e. is it's own inverse). * * @param type pointer type * @param sourceSynset source synset * @param targetSynset target synset * @param depth depth * @return list of symmetric relationships between source and target */ private static RelationshipList findSymmetricRelationships( final Synset sourceSynset, final Synset targetSynset, PointerType type, int depth) throws JWNLException { PointerTargetTree tree = new PointerTargetTree( sourceSynset, PointerUtils.makePointerTargetTreeList(sourceSynset, type, null, depth, false)); PointerTargetTreeNodeList.Operation opr = testNode -> { if (targetSynset.equals(testNode.getSynset())) { return testNode; } return null; }; List l = tree.getAllMatches(opr); RelationshipList list = new RelationshipList(); for (Object aL : l) { PointerTargetNodeList nodes = findSymmetricRelationship((PointerTargetTreeNode) aL, type); list.add(new SymmetricRelationship(type, nodes, sourceSynset, targetSynset)); } return list; }
/** * A symmetric relationship is one whose type is symmetric (i.e. is it's own inverse). * * @param type pointer type * @param sourceSynset source synset * @param targetSynset target synset * @param depth depth * @return list of symmetric relationships between source and target */ private static RelationshipList findSymmetricRelationships( final Synset sourceSynset, final Synset targetSynset, PointerType type, int depth) throws JWNLException { PointerTargetTree tree = new PointerTargetTree( sourceSynset, PointerUtils.makePointerTargetTreeList(sourceSynset, type, null, depth, false)); PointerTargetTreeNodeList.Operation opr = testNode -> { if (targetSynset.equals(testNode.getSynset())) { return testNode; } return null; }; List l = tree.getAllMatches(opr); RelationshipList list = new RelationshipList(); for (Object aL : l) { PointerTargetNodeList nodes = findSymmetricRelationship((PointerTargetTreeNode) aL, type); list.add(new SymmetricRelationship(type, nodes, sourceSynset, targetSynset)); } return list; }
if (!sourceRoot.getSynset().equals(targetRoot.getSynset())) { return null;
if (!sourceRoot.getSynset().equals(targetRoot.getSynset())) { return null;