Skip to content

Commit

Permalink
Allow nullable subscript/superscript for brackets. subscript default …
Browse files Browse the repository at this point in the history
…to n, and superscript to EU (either/unspecified)
  • Loading branch information
johnmay committed Apr 26, 2017
1 parent bea78e7 commit 503798c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Expand Up @@ -264,9 +264,11 @@ public int compare(PolymerSgroup a, PolymerSgroup b) {
sb.append(':');
appendIntegers(ordering, ',', sb, sgroup.atomset);
sb.append(':');
sb.append(sgroup.subscript);
if (sgroup.subscript != null)
sb.append(sgroup.subscript);
sb.append(':');
sb.append(sgroup.supscript.toLowerCase(Locale.ROOT));
if (sgroup.supscript != null)
sb.append(sgroup.supscript.toLowerCase(Locale.ROOT));
}
}

Expand Down
Expand Up @@ -117,7 +117,7 @@ static final class PolymerSgroup {
final String supscript;

PolymerSgroup(String type, List<Integer> atomset, String subscript, String supscript) {
assert type != null && atomset != null && subscript != null && supscript != null;
assert type != null && atomset != null;
this.type = type;
this.atomset = new ArrayList<>(atomset);
this.subscript = subscript;
Expand Down
Expand Up @@ -836,10 +836,11 @@ else if (val == CxSmilesState.Radical.Trivalent)
case CtabGeneric:
case CtabComponent:
case CtabGraft:
String supscript = sgroup.getValue(SgroupKey.CtabConnectivity);
state.sgroups.add(new CxSmilesState.PolymerSgroup(getSgroupPolymerKey(sgroup),
toAtomIdxs(sgroup.getAtoms(), atomidx),
sgroup.getSubscript(),
(String) sgroup.getValue(SgroupKey.CtabConnectivity)));
supscript));
break;

case ExtMulticenter:
Expand Down

0 comments on commit 503798c

Please sign in to comment.