001/** 002 * 003 */ 004package org.dllearner.algorithms.isle.index; 005 006import org.semanticweb.owlapi.model.OWLEntity; 007 008/** 009 * @author Lorenz Buehmann 010 * 011 */ 012public class SemanticAnnotation extends Annotation{ 013 014 private OWLEntity entity; 015 016 public SemanticAnnotation(Annotation annotation, OWLEntity entity) { 017 super(annotation.getReferencedDocument(), annotation.getTokens()); 018 this.entity = entity; 019 } 020 021 public OWLEntity getEntity() { 022 return entity; 023 } 024 025 @Override 026 public int hashCode() { 027 final int prime = 31; 028 int result = super.hashCode(); 029 result = prime * result + ((entity == null) ? 0 : entity.hashCode()); 030 return result; 031 } 032 033 @Override 034 public boolean equals(Object obj) { 035 if (this == obj) 036 return true; 037 if (!super.equals(obj)) 038 return false; 039 if (getClass() != obj.getClass()) 040 return false; 041 SemanticAnnotation other = (SemanticAnnotation) obj; 042 if (entity == null) { 043 if (other.entity != null) 044 return false; 045 } else if (!entity.equals(other.entity)) 046 return false; 047 return true; 048 } 049 050 /* (non-Javadoc) 051 * @see org.dllearner.algorithms.isle.index.Annotation#toString() 052 */ 053 @Override 054 public String toString() { 055 return super.toString() + "->" + entity; 056 } 057 058 059}