Record Class HeavyAtomLimitChecker
- Record Components:
defaultLimit- the default limitlimitsByTag- The map of limits for each tag. Does not have to include all tags.
- All Implemented Interfaces:
TaggedCalculatorInputChecker
Apart from the default limit, specific limits can be given for each CalculatorTag that
affects performance (other tags are ignored). These tags represent
different optional calculations that can be switched on or off on calculators, e.g. the tautomerization plugin
can calculate canonical, dominant, major and generic tautomers with very different computation costs.
Based on these performance-related tags:
- If there is no such tag on the calculator (it has regular performance), or there is a tag, but it has no entry in the map, then the default limit is used.
- If there are multiple tags, then the minimum of their limits is used.
Negative numbers mean infinity (the lack of a limit).
-
Constructor Summary
ConstructorsConstructorDescriptionHeavyAtomLimitChecker(int defaultLimit, Map<CalculatorTag, Integer> limitsByTag) Creates an instance of aHeavyAtomLimitCheckerrecord class. -
Method Summary
Modifier and TypeMethodDescriptionapply(TaggedCalculator calculator, Molecule molecule) Checks the given molecule and returns the found errors, or an empty list if the molecule is valid.static HeavyAtomLimitCheckerCreates a heavy atom limit checker using the default configuration.intReturns the value of thedefaultLimitrecord component.final booleanIndicates whether some other object is "equal to" this one.static HeavyAtomLimitCheckerfromProperties(InputStream inputStream) Parses the given input stream into aPropertiesobject and passes that tofromProperties(Properties).static HeavyAtomLimitCheckerfromProperties(Properties properties) Creates a heavy atom limit checker from the given configuration.final inthashCode()Returns a hash code value for this object.Returns the value of thelimitsByTagrecord component.Exports this checker into the format defined byfromProperties(Properties).final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
HeavyAtomLimitChecker
Creates an instance of aHeavyAtomLimitCheckerrecord class.- Parameters:
defaultLimit- the value for thedefaultLimitrecord componentlimitsByTag- the value for thelimitsByTagrecord component
-
-
Method Details
-
defaultChecker
Creates a heavy atom limit checker using the default configuration.With these default limits, most calculators complete under about 5 seconds per input structure. The few exceptions are simply too slow to finish in such short time with any reasonable limit, but they should still process each input in a few minutes with these limits.
Please note that these limits may change in future versions without any preliminary notice if better values are found. If you want to ensure that your limits do not change, export this checker using
toProperties(), save it, and reload it later withfromProperties(Properties).- Returns:
- the new checker
-
fromProperties
Parses the given input stream into aPropertiesobject and passes that tofromProperties(Properties).- Parameters:
inputStream- the properties file to parse- Returns:
- the new checker
- Throws:
IllegalArgumentException- if the given properties file does not conform to the rules specified in the JavaDoc offromProperties(Properties)IOException
-
fromProperties
Creates a heavy atom limit checker from the given configuration.The properties file is parsed using these rules:
- Values are parsed as ints.
- The special "*" key specifies the default limit. If not set, -1 is used instead.
- All other keys are mapped to a constant in the
CalculatorTagenum with two modifications:- "/" is replaced with "_",
- the key is converted to upper case.
- Parameters:
properties- the properties to parse- Returns:
- the new checker
- Throws:
IllegalArgumentException- if the given properties file does not conform to the rules above
-
toProperties
Exports this checker into the format defined byfromProperties(Properties).- Returns:
- a new properties object describing this checker
-
apply
Description copied from interface:TaggedCalculatorInputCheckerChecks the given molecule and returns the found errors, or an empty list if the molecule is valid.Apart from the molecule that should be checked, this method also receives the calculator instance.
- Specified by:
applyin interfaceTaggedCalculatorInputChecker- Parameters:
calculator- the calculator instancemolecule- the input molecule- Returns:
- a list of found errors, typically empty or containing a single element
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
defaultLimit
public int defaultLimit()Returns the value of thedefaultLimitrecord component.- Returns:
- the value of the
defaultLimitrecord component
-
limitsByTag
Returns the value of thelimitsByTagrecord component.- Returns:
- the value of the
limitsByTagrecord component
-