From 095e0c7e51b361cb2c1de2cac93c3948dd6c709d Mon Sep 17 00:00:00 2001 From: halw Date: Mon, 3 Nov 2008 23:31:09 +0000 Subject: [PATCH] Author:halw Date:2008-11-03T23:31:09.000000Z git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@104 abb3cda0-5349-4a8f-a601-0c33ac3a8c38 --- .../eiffeltime-tutorial/absolute-time.wiki | 8 ++-- .../eiffeltime-tutorial/duration.wiki | 2 +- .../eiffeltime-tutorial/interval.wiki | 40 +++++++++---------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/documentation/current/solutions/dates-and-times/eiffeltime/eiffeltime-tutorial/absolute-time.wiki b/documentation/current/solutions/dates-and-times/eiffeltime/eiffeltime-tutorial/absolute-time.wiki index b9260eff..3dc2ad2b 100644 --- a/documentation/current/solutions/dates-and-times/eiffeltime/eiffeltime-tutorial/absolute-time.wiki +++ b/documentation/current/solutions/dates-and-times/eiffeltime/eiffeltime-tutorial/absolute-time.wiki @@ -13,19 +13,19 @@ The default way to compare absolute objects is to compare their respective durat ====Creation==== -There are three ways to create an instance of the class TIME: by choosing the time (make), by getting the time from the system (make_now), or by choosing the number of seconds elapsed from the origin (make_by_seconds). The arguments of make and make_by_seconds have to respect the range of a day (see preconditions). +There are three ways to create an instance of the class TIME: by choosing the time (make), by getting the time from the system (make_now), or by choosing the number of seconds elapsed from the origin (make_by_seconds). The arguments of make and make_by_seconds have to respect the range of a day (see preconditions). ====Origin and cyclic representation==== -The origin is 0 hour 0 minute and 0 second. Notion of time is relative to a day in a cyclic representation: days begin at 0:0:0 and end at 23:59:59. If a second is added to 23:59:59 then the result will be 0:0:0. Subtracting a minute to 0:0:0 will yield 23:59:0. +The origin is 0 hour 0 minute and 0 second. Notion of time is relative to a day in a cyclic representation: days begin at 0:0:0 and end at 23:59:59. If a second is added to 23:59:59 then the result will be 0:0:0. Subtracting a minute from 0:0:0 will yield 23:59:0. ====Comparison==== -Instances of [[ref:libraries/time/reference/time_chart|TIME ]] may be compared. Functions <, +, >, and >= are available. Function is_equal (or ~) can be used to test object equality, while = will compare references. +Instances of [[ref:libraries/time/reference/time_chart|TIME ]] may be compared. Functions <, +, >, and >= are available. Function is_equal (or ~) can be used to test object equality, whereas = will compare references. ====Measurement==== -The duration linked to an instance of [[ref:libraries/time/reference/time_chart|TIME]] (attribute duration) is an instance of [[ref:libraries/time/reference/time_duration_chart|TIME_DURATION]] . It is the duration from the origin until the current time. The function seconds returns the number of seconds since the origin. This function may be useful to get the number of seconds between two events.The feature - creates an interval between two instances of TIME. The duration of this interval is given by the function duration. However, this duration is not canonical (See [[Duration|Duration]] for precisions). In TIME, the feature relative_duration returns the same duration, but more efficiently and also it is canonical. +The duration linked to an instance of [[ref:libraries/time/reference/time_chart|TIME]] (query duration) results in an instance of [[ref:libraries/time/reference/time_duration_chart|TIME_DURATION]] . It is the duration from the origin until the current time. The query seconds returns the number of seconds since the origin. This query may be useful to get the number of seconds between two events.The feature - creates an interval between two instances of TIME. The duration of this interval is given by the function duration. However, this duration is non-canonical (See [[Duration|Duration]] for precisions). In TIME, the feature relative_duration returns the same duration, but more efficiently and also it is canonical. ====Operations==== * Set directly hour, minute, and second with set_hour, set_minute, and set_second. Arguments must satisfy the rules of creation. diff --git a/documentation/current/solutions/dates-and-times/eiffeltime/eiffeltime-tutorial/duration.wiki b/documentation/current/solutions/dates-and-times/eiffeltime/eiffeltime-tutorial/duration.wiki index f90e7399..7577fbf5 100644 --- a/documentation/current/solutions/dates-and-times/eiffeltime/eiffeltime-tutorial/duration.wiki +++ b/documentation/current/solutions/dates-and-times/eiffeltime/eiffeltime-tutorial/duration.wiki @@ -123,7 +123,7 @@ The rules are the same than those for DATE_DURATION. Features < It is possible to change reference of time and date with the features set_time and set_date. To change only one element (for example hour), features from TIME_DURATION or DATE_DURATION have to be used. ====Operation==== -* DATE_TIME_DURATION inherits from GROUP_ELEMENT. infix and prefix +, infix and prefix - are available to compose instances to each other. +* DATE_TIME_DURATION inherits from GROUP_ELEMENT. infix and prefix +, infix and prefix - are available to compose instances to each other. * Only day_add is present. To add only one element, features from TIME_DURATION or DATE_DURATION have to be used. ====Conversion==== diff --git a/documentation/current/solutions/dates-and-times/eiffeltime/eiffeltime-tutorial/interval.wiki b/documentation/current/solutions/dates-and-times/eiffeltime/eiffeltime-tutorial/interval.wiki index fbaa5e1a..2cf760d1 100644 --- a/documentation/current/solutions/dates-and-times/eiffeltime/eiffeltime-tutorial/interval.wiki +++ b/documentation/current/solutions/dates-and-times/eiffeltime/eiffeltime-tutorial/interval.wiki @@ -1,43 +1,43 @@ [[Property:title|Interval]] [[Property:weight|2]] [[Property:uuid|d33d0216-fa71-60dc-f3b0-61ff42d621e6]] -Class INTERVAL deals with intervals between two instances of the same class which conform to ABSOLUTE ( DATE, TIME, DATE_TIME). The notions of interval is directly linked with the notion of order. - -The start_bound must be before the end_bound. - +Class INTERVAL [G -> ABSOLUTE] deals with intervals between two instances of the same class (an actual generic parameter substituting for G) which conforms to ABSOLUTE ( DATE, TIME, DATE_TIME). ====Creation==== -The features make, set_start_bound and set_end_bound take clones of their arguments, so that if these arguments are changed, the interval previously created is not. - -It would have been possible to create intervals with references to date or time, but a modification of the dates would have been effective in the interval so that only the invariant would have been able to check if the start_bound is still before the end_bound. +The creation procedure + + make (s, e: G) +takes as arguments two instances of type G (or G's actual type from a declaration, e.g., my_time_interval: INTERVAL [TIME] ), which will become the start bound and the end bound of the INTERVAL. The start bound argument must be "before" the end bound argument (i.e., s <= e). make creates twins of its arguments so that the objects referenced as arguments will not change even if the values in the INTERVAL change. ====Interval measurement==== -The measure of intervals is made by duration: the result is an instance of the class DURATION. However, as DURATION is the common parent of TIME_DURATION, DATE_DURATION, and DATE_TIME_DURATION, it does not have many features available. Some features in class TIME, DATE, and DATE_TIME return the same result and are more efficient to use. DURATION has to be use as the last solution. +The measurement of an interval is done by applying the query duration. Although the result of duration will be an instance of class DURATION, it will be a direct instance of the DURATION descendant that is appropriate to the actual value of the generic parameter G. So, for an INTERVAL [TIME], the result of duration will be a direct instance of TIME_DURATION. ====Comparison==== -It includes intersection, inclusion and a special comparison. -* is_equal is present and compare values, not references. -* Feature intersects returns the mathematical result of the intersection of two intervals. -* is_strict_included_by, strict_includes, is_included_by and includes are connected to the same notion of inclusion. -* <, + > and >= use a special rule to compare intervals. int1 < int2 is true if int1 starts and ends strictly before int2. The other features use the same rule and is_equal if needed. -* overlaps looks like intersects but the argument has to be after the current interval. is_overlapped is the opposite. -* meets and is_met are used to test if two intervals have a common bound. +* infix < and infix > compare two intervals on a "strict" basis. This means that int_1 < int_2 is True if int_1 starts and ends strictly before int_2. In other words, int_1 must have a start bound less than that of int_2 and an end bound less than that of int_2. +* infix <= and infix >= compare two intervals on a non-strict basis. So, int_1 <= int_2 is True if int_1 has a start bound less than or equal to that of int_2 and an end bound less than or equal to that of int_2. +* is_equal performs object comparison. +* intersects is true if one (target) INTERVAL shares some of the same bounded area with a second (argument) INTERVAL. +* overlaps is similar to intersects with the exception that the argument INTERVAL has to be after the target INTERVAL. is_overlapped is the opposite of overlaps. +* meets and is_met are used to test whether two intervals have a common bound. +* strict_includes can be used to test whether the target INTERVAL strictly includes the argument INTERVAL. So, int_1.strict_includes (int_2) will be True if the start bound of int_2 is greater than the start bound of int_1 and the end bound of int_2 is less than the end bound of int_1. is_strict_included_by provides the opposite of strict_includes. +* includes and is_included_by test for inclusion on a non-strict basis. ====Status Report==== -The main part of the functions need an argument from the same generic type and return a BOOLEAN value. -* empty tests if the bounds are equal. -* has, strict_before, strict_after, before and after test the position of an element relatively to the current interval. +* empty is True if the INTERVAL is empty, i.e., if the value of the start bound is equal to the value of the end bound. +* has, strict_before, strict_after, before, and after test the position of an element relative to the current interval. ====Element change==== -set_start_bound and set_end_bound are available to change the bounds. +set_start_bound and set_end_bound are available to change the bounds. set_start_bound and set_end_bound create new objects from their arguments (twins), so that if these bounds are altered later, the original objects which had been referenced as arguments will not change. ====Operations==== -Union and intersection are the mathematical functions. gather requires that two intervals meet each other and then yields the union. +* union provides a new INTERVAL that includes the entire range covered by both the target INTERVAL and an argument INTERVAL which intersects the target. +* intersection returns a new INTERVAL that represents the area common to both the target INTERVAL and the argument INTERVAL. intersection returns Void if the target and argument do not intersect. +* gather requires that a target and argument INTERVAL have a common bound (i.e., int_1.meets (int_2) is True) and then returns a new INTERVAL with the union of the two.