+ }
+
+ /**
+ *
+ * @param residueIndex
+ * The residue index used for the search
+ * @param atoms
+ * A collection of Atom to search
+ * @return atom position for the given residue index
+ */
+ int getAtomIndex(int residueIndex, Collection<Atom> atoms)
+ {
+ if (atoms == null)
+ {
+ throw new IllegalArgumentException(
+ "atoms collection must not be null!");
+ }
+ for (Atom atom : atoms)
+ {
+ if (atom.resNumber == residueIndex)
+ {
+ return atom.atomIndex;
+ }
+ }
+ return UNASSIGNED;
+ }
+
+ /**
+ * Checks if the residue instance is marked 'Not_observed' or not
+ *
+ * @param residue
+ * @return
+ */
+ private boolean isResidueObserved(Residue residue)
+ {
+ Set<String> annotations = getResidueAnnotaitons(residue,
+ ResidueDetailType.ANNOTATION);
+ if (annotations == null || annotations.isEmpty())
+ {
+ return true;
+ }
+ for (String annotation : annotations)
+ {
+ if (annotation.equalsIgnoreCase(NOT_OBSERVED))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Get annotation String for a given residue and annotation type
+ *
+ * @param residue
+ * @param type
+ * @return
+ */
+ private Set<String> getResidueAnnotaitons(Residue residue,
+ ResidueDetailType type)
+ {
+ HashSet<String> foundAnnotations = new HashSet<String>();
+ List<ResidueDetail> resDetails = residue.getResidueDetail();
+ for (ResidueDetail resDetail : resDetails)
+ {
+ if (resDetail.getProperty().equalsIgnoreCase(type.getCode()))
+ {
+ foundAnnotations.add(resDetail.getContent());
+ }
+ }
+ return foundAnnotations;