Commit 74c06a53 authored by Jean-Paul Smets's avatar Jean-Paul Smets

During the review of simulation refactoring with Kaz, we found that it made...

During the review of simulation refactoring with Kaz, we found that it made more sense to implement movement aggregation at the applied rule level and implement and N to M matching process rather than a 1 to N. This requires AmountGenerator and MovementGenerator to provide a separate API with no aggregation. Moreover, aggregation process should if possible be implemented consistently accross ERP5. DivergenceTesters seem to be the appropriate core component for that. MovementGroup themselves could be based on embedded DivergenceTesters and getAggregated* method could use themselved MovementGroup, either temporary instances dynamically generated, or existing instances found in appropriate context. This gives an idea of future directions. However, initial implementation will focus first on stable expand.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31476 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 90706ea4
......@@ -3,7 +3,7 @@
#
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
# Łukasz Nowak <luke@nexedi.com>
# Lukasz Nowak <luke@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
......@@ -46,6 +46,26 @@ class IAmountGenerator(Interface):
def getAggregatedAmountList(context, movement_list=None, rounding=False):
"""
Returns an IAmountList generated by a model applied to the context.
and aggregated according to the context divergence testers.
context - an IMovementCollection, an IAmountList or an IAmount
movement_list - optional IAmountList which can be passed explicitly
whenever context is an IMovementCollection and whenever
we want to filter context.getMovementList
rounding - boolean argument, which controls if rounding shall be applied on
generated movements or not
NOTE:
- implement rounding appropriately (True or False seems
simplistic)
- define how to retrieve divergence testers in the context
"""
def getGeneratedAmountList(context, movement_list=None, rounding=False):
"""
Returns an IAmountList generated by a model applied to the context.
context - an IMovementCollection, an IAmountList or an IAmount
......
......@@ -3,7 +3,7 @@
#
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
# Łukasz Nowak <luke@nexedi.com>
# Lukasz Nowak <luke@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
......@@ -45,7 +45,27 @@ class IMovementGenerator(Interface):
def getAggregatedMovementList(context, movement_list=None, rounding=False):
"""
Returns an IMovementList generated by a model applied to the context.
Returns an IMovementList generated by a model applied to the context
and aggregated according to the context divergence testers.
context - an IMovementCollection, an IMovementList or an IMovement
movement_list - optional IMovementList which can be passed explicitely
whenever context is an IMovementCollection and whenever
we want to filter context.getMovementList
rounding - boolean argument, which controls if rounding shall be applied on
generated movements or not
NOTE:
- implement rounding appropriately (True or False seems
simplistic)
- define how to retrieve divergence testers in the context
"""
def getGeneratedMovementList(context, movement_list=None, rounding=False):
"""
Returns an IMovementList generated by a model applied to the context
context - an IMovementCollection, an IMovementList or an IMovement
......
......@@ -32,14 +32,22 @@ from zope.interface import Interface
class IMovementGroup(Interface):
"""Movement Group interface specification
The purpose of MovementGroup is to define how movements are grouped,
and how values are updated from simulation movements.
The purpose of MovementGroup is to define how movements are grouped, [YES] XXX
and how values are updated from simulation movements. [NO] XXX
"""
def test(document, property_dict, **kw):
"""Returns a tuple of 2 values.
First one is True if document contains identical values than some
contained property_dict.
Second one is a modified version of property_dict.
TODO:
- take into account the possibility to use Divergence Testers
to build movement groups
- how does separate method relate to matching provided by
Divergence Testers
- consider an interface for property groups. Is it the same or
different ?
"""
def separate(movement_list):
......
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