http://groups.google.com/group/caMath/browse_thread/thread/e0ff92b3f6a85932=
/?hl=3Den
The basic Period prototype
writen by python,can checkout from camath svnserver and it's revision
is 2.There are 4 .py files.camath.py is the testcase entry.
First, the Segment class : like as the name,it's defined by 2
properties {begin,end}.
And then,the TimeSlice class is declared as a special Segment
class.it's properties' type is time/date. And it contains 3 methods
{contain,plus,minus} and 2 compare operations {__cmp__,__eq__} to
support operations {>,<,=3D=3D,!=3D ..}.
#a and b both are TimeSlice objects.
a.contain(b): 2 TimeSlice objects contain 3 status:
[a.b,a.e] [b.b,b.e] : no cross ;0
[a.b, b.b,a.e b.e] : cross;1
[a.b,b.b,b.e,a.e] : contain;2
a.plus(b): 2 TimeSlice objects can plus (merge) and a.plus(b) =3D=3D
b.plus(a),because of above and the Time's physical meaning:
no cross: TimeSlice(a),TimeSlice(b)
cross: TimeSlice(a.b,b.e)
contain: TimeSlice(a)
a.minus(b):as above:
no cross:TimeSlice(a)
cross:
a<b TimeSlice(a.b,b.b)
a>b TimeSlice(b.e,a.e)
contain:
a<b TimeSlice(a.b,b.b),TimeSlice(b.e,a.e)
a>b TimeSlice()
3th,the Period is reflected by a set of TimeSlice.it contains 3
methods{RemoveSliceByValue,GetPeriodOrder,GetPeriodMerge}.
as above,blabla...
that's all.next post lets discuss the durative hypotheses.
--
Welcome to Cost Accounting Model--a flexible cost accounting system of
organization
main site: http://camath.sourceforge.net
google group: http://groups.google.com/group/caMath
|