FUNCTION simplify_maths_space
(* SCHEMA step_merged_ap_schema; *)
-- IN AP238 STEP-NC/AP242
FUNCTION simplify_maths_space
(spc : maths_space ) : maths_space;
LOCAL
stypes : SET OF STRING := stripped_typeof(spc);
sset : SET OF maths_value;
zset : SET OF maths_value := [];
zval : maths_value;
zspc : maths_space;
zallint : BOOLEAN := TRUE;
zint : INTEGER;
zmin : INTEGER;
zmax : INTEGER;
factors : LIST OF maths_space;
zfactors : LIST OF maths_space := [];
rspc : maths_space;
END_LOCAL;
IF 'FINITE_SPACE' IN stypes THEN
sset := spc\finite_space.members;
REPEAT i := 1 TO SIZEOF(sset);
zval := simplify_maths_value(sset[i]);
zset := zset + [ zval ];
IF zallint AND ('INTEGER' IN TYPEOF(zval)) THEN
zint := zval;
IF i = 1 THEN
zmin := zint;
zmax := zint;
ELSE
IF zint < zmin THEN
zmin := zint;
END_IF;
IF zint > zmax THEN
zmax := zint;
END_IF;
END_IF;
ELSE
zallint := FALSE;
END_IF;
END_REPEAT;
IF zallint AND (SIZEOF(zset) = zmax - zmin + 1) THEN
RETURN (make_finite_integer_interval(zmin, zmax));
END_IF;
RETURN (make_finite_space(zset));
END_IF;
IF 'UNIFORM_PRODUCT_SPACE' IN stypes THEN
zspc := simplify_maths_space(spc\uniform_product_space.base);
RETURN (make_uniform_product_space(zspc, spc\uniform_product_space.exponent));
END_IF;
IF 'LISTED_PRODUCT_SPACE' IN stypes THEN
factors := spc\listed_product_space.factors;
REPEAT i := 1 TO SIZEOF(factors);
INSERT( zfactors, simplify_maths_space(factors[i]), i - 1 );
END_REPEAT;
RETURN (make_listed_product_space(zfactors));
END_IF;
IF 'EXTENDED_TUPLE_SPACE' IN stypes THEN
zspc := simplify_maths_space(spc\extended_tuple_space.base);
rspc := simplify_maths_space(spc\extended_tuple_space.extender);
RETURN (make_extended_tuple_space(zspc, rspc));
END_IF;
IF 'FUNCTION_SPACE' IN stypes THEN
zspc := simplify_maths_space(spc\function_space.domain_argument);
rspc := simplify_maths_space(spc\function_space.range_argument);
RETURN (make_function_space(spc\function_space.domain_constraint, zspc, spc\function_space.range_constraint, rspc));
END_IF;
RETURN (spc);
END_FUNCTION;
Referenced By
Defintion simplify_maths_space is references by the following definitions:
[Top Level Definitions] [Exit]Generated by STEP Tools® EXPRESS to HTML Converter
2024-09-06T14:00:33-04:00