/** * Create a new octahedral configuration. * @param focus the focus * @param carriers the carriers * @param order the order of the configuration 0-30. */ public Octahedral(IAtom focus, IAtom[] carriers, int order) { super(focus, carriers, IStereoElement.OC | (order & 0xff)); if (getConfigOrder() < 0 || getConfigOrder() > 30) throw new IllegalArgumentException("Invalid configuration order!" + "Should be in range 1-30"); }
/** * Create a new octahedral configuration. * @param focus the focus * @param carriers the carriers * @param order the order of the configuration 0-30. */ public Octahedral(IAtom focus, IAtom[] carriers, int order) { super(focus, carriers, IStereoElement.OC | (order & 0xff)); if (getConfigOrder() < 0 || getConfigOrder() > 30) throw new IllegalArgumentException("Invalid configuration order!" + "Should be in range 1-30"); }
/** * Normalize the configuration to the lowest order (1). For example * <pre>C[Co@OH8](F)(Br)(Cl)(I)S</pre> * is the same as * <pre>C[Co@OH1](F)(Cl)(Br)(I)S</pre>. The normalised form is easy to * work with as the first and last carriers form an axis, the middle four * equatorial carriers are arranged anti-clockwise looking from the first carrier. * @return the normalized form */ public Octahedral normalize() { int cfg = getConfigOrder(); if (cfg == 1) return this; if (cfg < 1 || cfg > 30) throw new IllegalArgumentException( "Invalid config order: " + cfg + ", octahedral should be" + "1 <= order <= 30!"); IAtom[] carriers = invapply(getCarriers().toArray(new IAtom[6]), PERMUTATIONS[cfg-1]); return new Octahedral(getFocus(), carriers, 1); }
/** * Normalize the configuration to the lowest order (1). For example * <pre>C[Co@OH8](F)(Br)(Cl)(I)S</pre> * is the same as * <pre>C[Co@OH1](F)(Cl)(Br)(I)S</pre>. The normalised form is easy to * work with as the first and last carriers form an axis, the middle four * equatorial carriers are arranged anti-clockwise looking from the first carrier. * @return the normalized form */ public Octahedral normalize() { int cfg = getConfigOrder(); if (cfg == 1) return this; if (cfg < 1 || cfg > 30) throw new IllegalArgumentException( "Invalid config order: " + cfg + ", octahedral should be" + "1 <= order <= 30!"); IAtom[] carriers = invapply(getCarriers().toArray(new IAtom[6]), PERMUTATIONS[cfg-1]); return new Octahedral(getFocus(), carriers, 1); }