Commits

Daniel Lowe  committed b3ec20d

Allowed mono in front of element names

  • Participants
  • Parent commits 621b186

Comments (0)

Files changed (1)

File opsin-core/src/main/java/uk/ac/cam/ch/wwmm/opsin/ComponentGenerator.java

 				throw new ComponentGenerationException("\"acid\" not found after " +groupValue);
 			}
 		}
+		else if (ELEMENTARYATOM_SUBTYPE_VAL.equals(group.getAttributeValue(SUBTYPE_ATR))){
+			Element possibleMono = (Element) XOMTools.getPreviousSibling(group);
+			if (possibleMono !=null && possibleMono.getLocalName().equals(MULTIPLIER_EL) &&
+					possibleMono.getAttributeValue(VALUE_ATR).equals("1")) {
+				possibleMono.detach();//e.g. monooxygen = oxygen
+			}
+		}
+		
 		
 		if(groupValue.equals("thiophen") || groupValue.equals("selenophen") || groupValue.equals("tellurophen")) {//thiophenol is generally phenol with an O replaced with S not thiophene with a hydroxy
 			Element possibleSuffix = (Element) XOMTools.getNextSibling(group);