/** * {@inheritDoc} */ @Override protected TrigonalBipyramidal create(IAtom focus, List<IAtom> carriers, int cfg) { return new TrigonalBipyramidal(focus, carriers.toArray(new IAtom[5]), cfg); } }
/** * {@inheritDoc} */ @Override protected TrigonalBipyramidal create(IAtom focus, List<IAtom> carriers, int cfg) { return new TrigonalBipyramidal(focus, carriers.toArray(new IAtom[5]), cfg); } }
private IStereoElement newTrigonalBipyramidal(int u, int[] vs, IAtom[] atoms, Configuration c) { if (vs.length != 5) return null; int order = 1 + c.ordinal() - Configuration.TB1.ordinal(); if (order < 1 || order > 20) return null; return new TrigonalBipyramidal(atoms[u], new IAtom[]{atoms[vs[0]], atoms[vs[1]], atoms[vs[2]], atoms[vs[3]], atoms[vs[4]]}, order); }
@Test(expected = IllegalArgumentException.class) public void badConfigurationOrder() { IAtom a0 = Mockito.mock(IAtom.class); IAtom a1 = Mockito.mock(IAtom.class); IAtom a2 = Mockito.mock(IAtom.class); IAtom a3 = Mockito.mock(IAtom.class); IAtom a4 = Mockito.mock(IAtom.class); IAtom a5 = Mockito.mock(IAtom.class); new TrigonalBipyramidal(a0, new IAtom[]{a1,a2,a3,a4,a5}, 32); } }
@Test(expected = IllegalArgumentException.class) public void tooManyCarriers() { IAtom a0 = Mockito.mock(IAtom.class); IAtom a1 = Mockito.mock(IAtom.class); IAtom a2 = Mockito.mock(IAtom.class); IAtom a3 = Mockito.mock(IAtom.class); IAtom a4 = Mockito.mock(IAtom.class); IAtom a5 = Mockito.mock(IAtom.class); IAtom a6 = Mockito.mock(IAtom.class); new TrigonalBipyramidal(a0, new IAtom[]{a1,a2,a3,a4,a5,a6}, 1); }
/** * Normalize the configuration to the lowest configuration order (1) - * the axis goes from the first to last carrier, the three middle carriers * are anti-clockwise looking from the first carrier. * @return the normalized configuration */ public TrigonalBipyramidal normalize() { int cfg = getConfigOrder(); if (cfg == 1) return this; IAtom[] carriers = invapply(getCarriers().toArray(new IAtom[5]), PERMUTATIONS[cfg-1]); return new TrigonalBipyramidal(getFocus(), carriers, 1); }
/** * Normalize the configuration to the lowest configuration order (1) - * the axis goes from the first to last carrier, the three middle carriers * are anti-clockwise looking from the first carrier. * @return the normalized configuration */ public TrigonalBipyramidal normalize() { int cfg = getConfigOrder(); if (cfg == 1) return this; IAtom[] carriers = invapply(getCarriers().toArray(new IAtom[5]), PERMUTATIONS[cfg-1]); return new TrigonalBipyramidal(getFocus(), carriers, 1); }