@Override public IDescriptorResult getDescriptorResultType() { return new DoubleResult(0.0); }
private IDescriptorResult newDescriptorResult(String descriptorValue) { IDescriptorResult result = null; if ("xsd:double".equals(currentDescriptorDataType)) { result = new DoubleResult(Double.parseDouble(descriptorValue)); } else if ("xsd:integer".equals(currentDescriptorDataType)) { result = new IntegerResult(Integer.parseInt(descriptorValue)); } else if ("xsd:boolean".equals(currentDescriptorDataType)) { result = new BooleanResult(Boolean.valueOf(descriptorValue)); } return result; }
private IDescriptorResult newDescriptorResult(String descriptorValue) { IDescriptorResult result = null; if ("xsd:double".equals(currentDescriptorDataType)) { result = new DoubleResult(Double.parseDouble(descriptorValue)); } else if ("xsd:integer".equals(currentDescriptorDataType)) { result = new IntegerResult(Integer.parseInt(descriptorValue)); } else if ("xsd:boolean".equals(currentDescriptorDataType)) { result = new BooleanResult(Boolean.valueOf(descriptorValue)); } return result; }
private DescriptorValue getDummyDescriptorValue(Exception e) { return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult( Double.NaN), NAMES, e); }
private DescriptorValue getDummyDescriptorValue(Exception e) { return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult( Double.NaN), DESCRIPTOR_NAMES, e); }
/** *{@inheritDoc} * * @param e the exception * @return a dummy value */ private DescriptorValue getDummyDescriptorValue(Exception e) { return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult( Double.NaN), getDescriptorNames(), e); }
/** *{@inheritDoc} * * @param e the exception * @return a dummy value */ private DescriptorValue getDummyDescriptorValue(Exception e) { return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult( Double.NaN), getDescriptorNames(), e); }
private DescriptorValue getDummyDescriptorValue(Exception e) { return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult( Double.NaN), getDescriptorNames(), e); }
private DescriptorValue getDummyDescriptorValue(Exception e) { return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult( Double.NaN), getDescriptorNames(), e); }
@Override public DescriptorValue calculate(IBond bond, IAtomContainer ac) { ensureIsotopeFactory(); if (bond.getAtomCount() != 2) { return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult( Double.NaN), NAMES, new CDKException("Only 2-center bonds are considered")); } IAtom[] atoms = BondManipulator.getAtomArray(bond); return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult( Math.abs(factory.getElement(atoms[0].getSymbol()).getAtomicNumber() - factory.getElement(atoms[1].getSymbol()).getAtomicNumber())), NAMES); }
@Test public void testDescriptorValue_DescriptorSpecification_arrayString_arrayObject_IDescriptorResult_arrayString() { DescriptorSpecification spec = new DescriptorSpecification(DESC_REF, DESC_IMPL_TITLE, DESC_IMPL_ID, DESC_IMPL_VENDOR); DescriptorValue value = new DescriptorValue(spec, new String[0], new Object[0], new DoubleResult(0.7), new String[]{"bla"}); Assert.assertNotNull(value); }
@Test public void testDoubleResult_double() { DoubleResult result = new DoubleResult(5.0); Assert.assertNotNull(result); }
@Test public void testDoubleValue() { DoubleResult result = new DoubleResult(5); Assert.assertEquals(5.0, result.doubleValue(), 0.000001); }
@Test public void testToString() { DoubleResult result = new DoubleResult(5.0); Assert.assertEquals("5.0", result.toString()); }
@Test public void testLength() { DoubleResult result = new DoubleResult(5); Assert.assertEquals(1, result.length()); } }
@Test public void testGetException() { DescriptorSpecification spec = new DescriptorSpecification(DESC_REF, DESC_IMPL_TITLE, DESC_IMPL_ID, DESC_IMPL_VENDOR); DoubleResult doubleVal = new DoubleResult(0.7); DescriptorValue value = new DescriptorValue(spec, new String[0], new Object[0], doubleVal, new String[]{"bla"}, new CDKException("A test exception")); Assert.assertThat(value.getException(), is(instanceOf(CDKException.class))); } }
@Test public void testGetParameterNames() { DescriptorSpecification spec = new DescriptorSpecification(DESC_REF, DESC_IMPL_TITLE, DESC_IMPL_ID, DESC_IMPL_VENDOR); DoubleResult doubleVal = new DoubleResult(0.7); DescriptorValue value = new DescriptorValue(spec, new String[0], new Object[0], doubleVal, new String[]{"bla"}); Assert.assertEquals(0, value.getParameterNames().length); }
@Test public void testGetParameters() { DescriptorSpecification spec = new DescriptorSpecification(DESC_REF, DESC_IMPL_TITLE, DESC_IMPL_ID, DESC_IMPL_VENDOR); DoubleResult doubleVal = new DoubleResult(0.7); DescriptorValue value = new DescriptorValue(spec, new String[0], new Object[0], doubleVal, new String[]{"bla"}); Assert.assertEquals(0, value.getParameters().length); }
@Test public void testGetSpecification() { DescriptorSpecification spec = new DescriptorSpecification(DESC_REF, DESC_IMPL_TITLE, DESC_IMPL_ID, DESC_IMPL_VENDOR); DoubleResult doubleVal = new DoubleResult(0.7); DescriptorValue value = new DescriptorValue(spec, new String[0], new Object[0], doubleVal, new String[]{"bla"}); Assert.assertEquals(spec, value.getSpecification()); }
@Test public void testGetValue() { DescriptorSpecification spec = new DescriptorSpecification(DESC_REF, DESC_IMPL_TITLE, DESC_IMPL_ID, DESC_IMPL_VENDOR); DoubleResult doubleVal = new DoubleResult(0.7); DescriptorValue value = new DescriptorValue(spec, new String[0], new Object[0], doubleVal, new String[]{"bla"}); Assert.assertEquals(doubleVal, value.getValue()); }