Commit 8a5a0fdb authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

implement VariationDivergenceTester.generateHashKey().


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31438 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ab9db421
...@@ -88,6 +88,26 @@ class VariationDivergenceTester(Predicate, DivergenceTesterMixin): ...@@ -88,6 +88,26 @@ class VariationDivergenceTester(Predicate, DivergenceTesterMixin):
dict(property_name=tested_property)) dict(property_name=tested_property))
return None return None
def generateHashKey(self, movement):
"""
Returns a hash key which can be used to optimise the
matching algorithm between movements. The purpose
of this hash key is to reduce the size of lists of
movements which need to be compared using the compare
method (quadratic complexity).
If decision_movement is a simulation movement, use
the recorded properties instead of the native ones.
"""
value_list = []
for tested_property in ('variation_category_list',
'variation_property_dict'):
if movement.isPropertyRecorded(tested_property):
value_list.append(movement.getRecordedProperty(tested_property))
else:
value_list.append(movement.getProperty(tested_property))
return '%s/%r' % (self.getPortalType(), value_list)
def getUpdatablePropertyDict(self, prevision_movement, decision_movement): def getUpdatablePropertyDict(self, prevision_movement, decision_movement):
""" """
Returns a list of properties to update on decision_movement Returns a list of properties to update on decision_movement
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment