@Override public boolean equals(Object obj) { if (obj == this) { return true; } else if (obj instanceof ModelFeatureStructure) { ModelFeatureStructure foreignFS = (ModelFeatureStructure) obj; return mFeatureStructre.equals(foreignFS.mFeatureStructre); } return false; }
@Override public boolean equals(Object object) { boolean result = false; if (this == object) { result = true; } else if (object != null && object instanceof FeatureValue) { FeatureValue valueToCompare = (FeatureValue) object; result = valueToCompare.mStructure.equals(mStructure) && valueToCompare.mFeature.equals(mFeature); } return result; }
/** * Determines whether the given FS is the DocumentAnnotation for its view. This is more than * just a type check; we actually check if it is the one "special" DocumentAnnotation that * CAS.getDocumentAnnotation() would return. */ private static boolean isDocumentAnnotation(FeatureStructure aFS) { return (aFS instanceof AnnotationFS) && aFS.equals(((AnnotationFS) aFS).getView().getDocumentAnnotation()); }
private static List<AnnotationFS> getRelAnnosOnPosition(AnnotationFS aFs, AnnotationFS aOriginFs, AnnotationFS aTargetFs, JCas aJcas) { Type type = aFs.getType(); Feature sourceFeat = type.getFeatureByBaseName(WebAnnoConst.FEAT_REL_SOURCE); Feature targetFeat = type.getFeatureByBaseName(WebAnnoConst.FEAT_REL_TARGET); return selectCovered(aJcas.getCas(), type, aFs.getBegin(), aFs.getEnd()).stream() .filter(fs -> fs.getFeatureValue(sourceFeat).equals(aOriginFs) && fs.getFeatureValue(targetFeat).equals(aTargetFs)) .collect(Collectors.toList()); }
private static List<AnnotationFS> getRelAnnosOnPosition(AnnotationFS aFs, AnnotationFS aOriginFs, AnnotationFS aTargetFs, JCas aJcas) { Type type = aFs.getType(); Feature sourceFeat = type.getFeatureByBaseName(WebAnnoConst.FEAT_REL_SOURCE); Feature targetFeat = type.getFeatureByBaseName(WebAnnoConst.FEAT_REL_TARGET); return selectCovered(aJcas.getCas(), type, aFs.getBegin(), aFs.getEnd()).stream() .filter(fs -> fs.getFeatureValue(sourceFeat).equals(aOriginFs) && fs.getFeatureValue(targetFeat).equals(aTargetFs)) .collect(Collectors.toList()); }