19package denoptim.fitness;
21import java.lang.reflect.Constructor;
22import java.util.ArrayList;
25import org.openscience.cdk.DefaultChemObjectBuilder;
26import org.openscience.cdk.IImplementationSpecification;
27import org.openscience.cdk.interfaces.IChemObjectBuilder;
28import org.openscience.cdk.qsar.IDescriptor;
30import denoptim.exception.DENOPTIMException;
57 protected List<Variable>
variables =
new ArrayList<Variable>();
85 DefaultChemObjectBuilder.getInstance();
179 StringBuilder sb =
new StringBuilder();
180 sb.append(
"DescriptorForFitness [shortName:").append(
shortName);
181 sb.append(
", variables:[");
184 sb.append(v.getName() +
", ");
187 sb.append(
", className:").append(
className);
188 sb.append(
", resultId:").append(
resultId);
189 IImplementationSpecification specs =
implementation.getSpecification();
190 sb.append(
", specReference:").append(
191 specs.getSpecificationReference());
192 sb.append(
", implTitle:").append(
193 specs.getImplementationTitle());
194 sb.append(
", implId:").append(
195 specs.getImplementationIdentifier());
196 sb.append(
", implVendor:").append(
197 specs.getImplementationVendor()).append(
"]");
198 return sb.toString();
208 String NL = System.getProperty(
"line.separator");
209 StringBuilder sb =
new StringBuilder();
210 sb.append(
"Titile: ").append(
dictTitle).append(NL);
212 sb.append(
"Classes: ");
217 sb.append(c).append(
" ");
222 return sb.toString();
263 String
className = oldParent.getImplementation().getClass().getName();
264 IDescriptor descriptor =
null;
268 for (Constructor<?> constructor : cl.getConstructors())
270 Class<?>[] params = constructor.getParameterTypes();
271 if (params.length == 0)
273 descriptor = (IDescriptor) constructor.newInstance();
274 }
else if (params[0].equals(IChemObjectBuilder.class))
277 descriptor = (IDescriptor) constructor.newInstance(
cdkBuilder);
280 }
catch (Throwable t)
285 if (descriptor ==
null)
288 +
className +
"'. No suitable constructor found.");
This is a reference to a specific descriptor value.
IDescriptor implementation
Implementation of the descriptor's calculator.
DescriptorForFitness makeCopy()
Copy this descriptor and created an independent instance of the underlying descriptor implementation.
String dictTitle
The title of descriptor as define in the descriptor dictionary.
List< Variable > variables
Variables that use values calculated by this descriptor.
int resultId
Pointer to a specific results among those that are produced by the calculation of this descriptor,...
void setVariables(List< Variable > variables)
Overwrites the list of variables using this descriptor.
String[] getDictClasses()
DescriptorForFitness(String shortName, String className, IDescriptor implementation, int resultId, String[] dictClasses, String dictDefinition, String dictTitle)
String className
ClassName pointing to the implementation of this descriptor's calculator.
static IDescriptor newDescriptorImplementation(DescriptorForFitness oldParent)
static IChemObjectBuilder cdkBuilder
Utility for constructing CDK objects.
String getDictDefinition()
String getDictString()
Utility only meant to print some info.
DescriptorForFitness(String shortName, String className, IDescriptor implementation, int resultId)
List< Variable > getVariables()
Get the variables that make use of values produced by this descriptor.
DescriptorForFitness cloneAllButImpl()
This is a sort of cloning that returns a new DescriptorForFitness with the same field content of this...
String[] dictClasses
The class(es) of descriptor as define in the descriptor dictionary.
void addDependentVariable(Variable v)
Append the reference to a variable that used data produced by the calculation of this descriptor.
IDescriptor getImplementation()
String dictDefinition
The Definition of descriptor as define in the descriptor dictionary.
String shortName
Descriptor short name.
A variable in the expression defining the fitness.