FUNCTION assoc_product_space

(* SCHEMA step_merged_ap_schema; *)
-- IN AP242
FUNCTION assoc_product_space
      (ts1 : tuple_space;
       ts2 : tuple_space ) : tuple_space;
   LOCAL
      types1 : SET OF STRING := stripped_typeof(ts1);
      types2 : SET OF STRING := stripped_typeof(ts2);
      up1 : uniform_product_space := make_uniform_product_space(the_reals, 1);
      up2 : uniform_product_space := make_uniform_product_space(the_reals, 1);
      lp1 : listed_product_space := the_zero_tuple_space;
      lp2 : listed_product_space := the_zero_tuple_space;
      lps : listed_product_space := the_zero_tuple_space;
      et1 : extended_tuple_space := the_tuples;
      et2 : extended_tuple_space := the_tuples;
      ets : extended_tuple_space := the_tuples;
      use_up1 : BOOLEAN;
      use_up2 : BOOLEAN;
      use_lp1 : BOOLEAN;
      use_lp2 : BOOLEAN;
      factors : LIST OF maths_space := [];
      tspace : tuple_space;
   END_LOCAL;
      IF 'UNIFORM_PRODUCT_SPACE' IN types1 THEN
         up1 := ts1;
         use_up1 := TRUE;
         use_lp1 := FALSE;
      ELSE
         IF 'LISTED_PRODUCT_SPACE' IN types1 THEN
            lp1 := ts1;
            use_up1 := FALSE;
            use_lp1 := TRUE;
         ELSE
            IF NOT ('EXTENDED_TUPLE_SPACE' IN types1) THEN
               RETURN (?);
            END_IF;
            et1 := ts1;
            use_up1 := FALSE;
            use_lp1 := FALSE;
         END_IF;
      END_IF;
      IF 'UNIFORM_PRODUCT_SPACE' IN types2 THEN
         up2 := ts2;
         use_up2 := TRUE;
         use_lp2 := FALSE;
      ELSE
         IF 'LISTED_PRODUCT_SPACE' IN types2 THEN
            lp2 := ts2;
            use_up2 := FALSE;
            use_lp2 := TRUE;
         ELSE
            IF NOT ('EXTENDED_TUPLE_SPACE' IN types2) THEN
               RETURN (?);
            END_IF;
            et2 := ts2;
            use_up2 := FALSE;
            use_lp2 := FALSE;
         END_IF;
      END_IF;
      IF use_up1 THEN
         IF use_up2 THEN
            IF up1.base = up2.base THEN
               tspace := make_uniform_product_space(up1.base, up1.exponent + up2.exponent);
            ELSE
               factors := [ up1.base:0, up2.base:0 ];
               tspace := make_listed_product_space(factors);
            END_IF;
         ELSE
            IF use_lp2 THEN
               factors := [ up1.base:0 ];
               factors := factors + lp2.factors;
               tspace := make_listed_product_space(factors);
            ELSE
               tspace := assoc_product_space(up1, et2.base);
               tspace := make_extended_tuple_space(tspace, et2.extender);
            END_IF;
         END_IF;
      ELSE
         IF use_lp1 THEN
            IF use_up2 THEN
               factors := [ up2.base:0 ];
               factors := lp1.factors + factors;
               tspace := make_listed_product_space(factors);
            ELSE
               IF use_lp2 THEN
                  tspace := make_listed_product_space(lp1.factors + lp2.factors);
               ELSE
                  tspace := assoc_product_space(lp1, et2.base);
                  tspace := make_extended_tuple_space(tspace, et2.extender);
               END_IF;
            END_IF;
         ELSE
            IF use_up2 THEN
               IF et1.extender = up2.base THEN
                  tspace := assoc_product_space(et1.base, up2);
                  tspace := make_extended_tuple_space(tspace, et1.extender);
               ELSE
                  RETURN (?);
               END_IF;
            ELSE
               IF use_lp2 THEN
                  factors := lp2.factors;
                  REPEAT i := 1 TO SIZEOF(factors) BY 1;
                     IF et1.extender <> factors[i] THEN
                        RETURN (?);
                     END_IF;
                  END_REPEAT;
                  tspace := assoc_product_space(et1.base, lp2);
                  tspace := make_extended_tuple_space(tspace, et1.extender);
               ELSE
                  IF et1.extender = et2.extender THEN
                     tspace := assoc_product_space(et1, et2.base);
                  ELSE
                     RETURN (?);
                  END_IF;
               END_IF;
            END_IF;
         END_IF;
      END_IF;
      RETURN (tspace);
END_FUNCTION;

Referenced By

Defintion assoc_product_space is references by the following definitions:
DefinitionType
 compatible_spaces FUNCTION
 derive_function_domain FUNCTION
 extract_factors FUNCTION
 parallel_composed_function_composability_check FUNCTION


[Top Level Definitions] [Exit]

Generated by STEP Tools® EXPRESS to HTML Converter
2017-01-19T11:17:24-05:00