Skip to content

Commit

Permalink
Switched order of IRing and IAtomContainer matching, to fix construct…
Browse files Browse the repository at this point in the history
…ion if IRing classes

Signed-off-by: Rajarshi Guha <rajarshi.guha@gmail.com>
  • Loading branch information
egonw authored and rajarshi committed Dec 15, 2011
1 parent 2fc6b61 commit 4741983
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/main/org/openscience/cdk/debug/DebugChemObjectBuilder.java
Expand Up @@ -159,6 +159,20 @@ public <T extends ICDKObject>T newInstance(
params[0] instanceof IAtomContainer) {
return (T)new DebugCrystal((IAtomContainer)params[0]);
}
} else if (IRing.class.isAssignableFrom(clazz)) {
if (params.length == 0) {
return (T)new DebugRing();
} else if (params.length == 1) {
if (params[0] instanceof IAtomContainer) {
return (T)new DebugRing((IAtomContainer)params[0]);
} else if (params[0] instanceof Integer) {
return (T)new DebugRing((Integer)params[0]);
}
} else if (params.length == 2 &&
params[0] instanceof Integer &&
params[1] instanceof String) {
return (T)new DebugRing((Integer)params[0], (String)params[1]);
}
} else if (IAtomContainer.class.isAssignableFrom(clazz)) {
if (params.length == 0) {
return (T)new DebugAtomContainer();
Expand All @@ -174,20 +188,6 @@ public <T extends ICDKObject>T newInstance(
(Integer)params[0], (Integer)params[1], (Integer)params[2], (Integer)params[3]
);
}
} else if (IRing.class.isAssignableFrom(clazz)) {
if (params.length == 0) {
return (T)new DebugRing();
} else if (params.length == 1) {
if (params[0] instanceof IAtomContainer) {
return (T)new DebugRing((IAtomContainer)params[0]);
} else if (params[0] instanceof Integer) {
return (T)new DebugRing((Integer)params[0]);
}
} else if (params.length == 2 &&
params[0] instanceof Integer &&
params[1] instanceof String) {
return (T)new DebugRing((Integer)params[0], (String)params[1]);
}
} else if (IAtomType.class.isAssignableFrom(clazz)) {
if (params.length == 1) {
if (params[0] instanceof String)
Expand Down

0 comments on commit 4741983

Please sign in to comment.